-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Databricks: support for lambda functions #1257
Conversation
/// ```sql | ||
/// SELECT transform(array(1, 2, 3), x -> x + 1); -- returns [2,3,4] | ||
/// ``` | ||
fn supports_lambda_functions(&self) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I was unsure of here is whether to enable this for the generic dialect. Our policy is to enable everything for generic, but this syntax conflicts with the ->
operator from dialects like Postgres. So supporting this would be a breaking change of somewhat dubious benefit, since we both gain and lose a feature in generic. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense to not support via GenericDialect when there is a conflict
🤔 that might be a good thing to add to the policy https://github.com/sqlparser-rs/sqlparser-rs?tab=readme-ov-file#new-syntax
Pull Request Test Coverage Report for Build 8952370439Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! cc @alamb
|
||
let res = databricks().parse_sql_statements("SELECT EXISTS ("); | ||
assert_eq!( | ||
// TODO: improve this error message... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was the todo meant for this PR or as a general improvement/followup with error reporting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the latter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lGTM -- thank you @jmhain
databricks().verified_only_select(sql).projection[0] | ||
); | ||
|
||
databricks().verified_expr( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty neat!
/// ```sql | ||
/// SELECT transform(array(1, 2, 3), x -> x + 1); -- returns [2,3,4] | ||
/// ``` | ||
fn supports_lambda_functions(&self) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense to not support via GenericDialect when there is a conflict
🤔 that might be a good thing to add to the policy https://github.com/sqlparser-rs/sqlparser-rs?tab=readme-ov-file#new-syntax
Thanks again for the review @iffyio |
No description provided.