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
Allow Managed Private Endpoint to be disabled/enabled per notebook
Could notebooks have an option to use or not use the workspace's Managed Private Endpoint (MPE)? MPE can significantly increase notebook startup time, even for notebooks that don't need private conn...frithjof_v4 hours agoCommunity ChampionNew19Views1like0CommentsJustification Prompts When Downgrading or Removing Sensitivity Labels in Power BI Desktop
Description Currently, organizations can configure Microsoft Purview sensitivity label policies to require users to provide a justification when removing a label or lowering its classification. T...vvargasv20 hours agoMicrosoft EmployeeNew11Views0likes0CommentsVisual Type Defaults in Visualization Pane
This would change my life with fussy clients and client/public facing apps. In addition, it would allow me to add more value to the clients on retainers who do not have the 'hours' to allocate to...IolaWhiteley22 hours agoAdvocate IINew53Views7likes0CommentsMatrix: column totals as a bar chart docked to the edge
What's missing Data bars already work on the Total row and column through conditional formatting, so row totals can be read as length. Column totals cannot: they render as a horizontal bar inside a ...Sayurivalente22 hours agoRegular VisitorNew79Views6likes1CommentAllow Bookmarks to Affect Multiple Report Pages
Description: I would like to request the ability for a single Power BI bookmark to affect and maintain a state across multiple report pages, rather than being limited to a single page. For example,...Josegonzalez2122 hours agoNew MemberNew20Views4likes1Comment