BUG: spark.sql() function breaks successive comment line formatting in notebook
The code below is copied from a pyspark notebook cell. What happens is that when you use the spark.sql() function and the next line is a comment line, the comment line is not formatted green, as you can see with the first comment. Even the second comment line is not formatted, until you a some other code line. But it will repeat itself when the spark.sql() function is used again (fourth comment). When the spark.sql() function is followed by an attached function (fifth comment) or code lines (sixth comment), the formatting is correct.
df = spark.sql('SELECT * FROM table_name')
# first comment
# second comment
print('text')
# third comment
df = spark.sql('SELECT * FROM table_name')
# fourth comment
df = spark.sql('SELECT * FROM table_name').where('')
# fifth comment
df = spark.sql('SELECT * FROM table_name')
print('text')
# sixth comment
2 Comments
- niels_vandecoevNew Member
Here's another code snippet that the spark.sql() function seems to break, allthough the code is able to run. The code below gives the red squiggly underline errors "no viable alternative at input '\n'" and "extraneous input '.' expecting {
, 'assert', 'async'...". But the code still runs. The errors can be solved by using backslashes on each line for line continuation, but that makes the code messy. When commenting or removing the spark.sql() line, the errors disappear. df = spark.sql(query)
df1 = (df
.withColumn("col1", lit(1))
.select(col('*'))
)
- fbcideas_migusrNew MemberStatus added:New
Recent ideas
How to Back Up and Restore a Fabric Lakehouse for Debugging
Is there a way to clone a Lakehouse, including its data, in Microsoft Fabric? When we encounter a data issue in Production, our usual approach is to take a backup of the database, restore it to a se...gsrinivasan3 hours agoNew MemberNew37Views0likes1CommentTenant Administration for Fabric Cloud Connections - Enterprise Governance Gap
Microsoft Fabric currently provides robust security around cloud connections by treating them as user-owned securable resources. While this model works well for personal connections, it creates signi...hrenollet4 hours agoRegular VisitorNew77Views7likes1CommentEnable Ownership Change / Take‑Over for Mirrored Database Items in Fabric
Mirrored DBs do not support ownership transfer today. This becomes an issue when someone leaves the company. And the user tied to the ownership is beeing disabled. That means you need to recreate the...Sigurd6 hours agoNew MemberNew873Views25likes3CommentsOption to hide item counts in filter pane
Allow report authors to hide counts displayed next to filter values while preserving filtering functionality. Currently, Power BI displays record counts next to values in filter panes and certain s...saul_galdamez8 hours agoNew MemberNew21Views0likes0CommentsAllow Detect Data Changes for Historic Data Outside Incremental Window
In Power BI Incremental Refresh,Detect Data Changes only works inside the incremental refresh window. If historic data gets updated, Power BI cannot detect or refresh it unless I expand the increment...NAGAKEERTHI_Y12 hours agoNew MemberNew119Views1like1Comment