cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Inline comment next to un-tickmarked SET statement = Syntax error

Graham
New Contributor III

Running this code in databricks SQL works great:

SET USE_CACHED_RESULT = FALSE;
 
-- Result:
-- key                                      value
-- USE_CACHED_RESULT     FALSE

If I add an inline comment, however, I get a syntax error:

SET USE_CACHED_RESULT = FALSE; -- this comment causes issues
 
-- Result:
-- Expected format is 'SET', 'SET key', or 'SET key=value'. If you want to include special characters in key, or include semicolon in value, please use quotes, e.g., SET `key`=`value`.line 1, pos 0

Edit: it's been helpfully mentioned that adding tickmarks resolves the issue. That's great to know. However, tickmarks are optional for this kind of statement--in other words, default behavior is that it should still work without tickmarks! This issue is, simply stated, a bug in the Databricks SQL runtime.

There are other similar solutions:

  • Just remove the inline comment
  • Convert the inline comment to a block comment
  • Don't run this SET statement and find another way to avoid caching

No matter which of these we try (with great results!), this bug will persist in the Databricks SQL runtime.

This post, then, is less of a request for workarounds--and more of a bug alert. If there is a better place for this kind of feedback, please let me know so I can put it there!

1 ACCEPTED SOLUTION

Accepted Solutions

Graham
New Contributor III

Thanks Kaniz! I sent a reply to Landan for his insightful answer. His is a great workaround. However, it should still work without his workaround (adding tickmarks). So I'm leaving this up here for now; I think this is just a bug that needs to be brought before the appropriate internal Databricks team.

View solution in original post

5 REPLIES 5

LandanG
Honored Contributor
Honored Contributor

Hi Graham,

Does using backticks (`) like below fix the issue?

SET `USE_CACHED_RESULT` = `FALSE`; --this comment causes issues
 
-- Result:
-- key                                      value
-- USE_CACHED_RESULT     FALSE

Graham
New Contributor III

This works! Thank you! however, it should still work without tick marks, so I'm leaving this question up here. Again, thanks for your find.

Kaniz_Fatma
Community Manager
Community Manager

Hi @Graham Carman​ , We haven’t heard from you since the last response from @Landan George​ ​ ​, and I was checking back to see if my suggestions helped you.

Or else, If you have any solution, please share it with the community, as it can be helpful to others.

Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

Graham
New Contributor III

Thanks Kaniz! I sent a reply to Landan for his insightful answer. His is a great workaround. However, it should still work without his workaround (adding tickmarks). So I'm leaving this up here for now; I think this is just a bug that needs to be brought before the appropriate internal Databricks team.

Hi @Graham Carman​, Thanks for your update. This has been reported to the internal Databricks team.

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!