-
Notifications
You must be signed in to change notification settings - Fork 2.1k
chore(deps): Update sqlparser to 0.58 #16456
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
Changes from 1 commit
e2673da
7bda63c
9121a58
bf7ef2e
e77da71
21640bd
0541c7e
44296bb
12192cf
c22d64b
be145e0
837a19e
e46e532
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,10 +16,10 @@ | |||||||||||||||||||
| // under the License. | ||||||||||||||||||||
|
|
||||||||||||||||||||
| use crate::planner::{ContextProvider, PlannerContext, SqlToRel}; | ||||||||||||||||||||
| use datafusion_common::{not_impl_err, plan_err}; | ||||||||||||||||||||
| use datafusion_common::{internal_datafusion_err, plan_err}; | ||||||||||||||||||||
| use datafusion_common::{DFSchema, Result, ScalarValue}; | ||||||||||||||||||||
| use datafusion_expr::planner::PlannerResult; | ||||||||||||||||||||
| use datafusion_expr::Expr; | ||||||||||||||||||||
| use datafusion_expr::{expr::ScalarFunction, planner::PlannerResult, Expr}; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| use sqlparser::ast::Expr as SQLExpr; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| impl<S: ContextProvider> SqlToRel<'_, S> { | ||||||||||||||||||||
|
|
@@ -62,6 +62,7 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |||||||||||||||||||
| substring_from: None, | ||||||||||||||||||||
| substring_for: None, | ||||||||||||||||||||
| special: false, | ||||||||||||||||||||
| shorthand: false, | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| return plan_err!("Substring without for/from is not valid {orig_sql:?}"); | ||||||||||||||||||||
|
|
@@ -77,8 +78,16 @@ impl<S: ContextProvider> SqlToRel<'_, S> { | |||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| not_impl_err!( | ||||||||||||||||||||
| "Substring not supported by UserDefinedExtensionPlanners: {substring_args:?}" | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| let fun = self | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This basically hard codes the use of a function named "substr" into the planner I think the preferred way is to use the datafusion/datafusion/expr/src/planner.rs Line 134 in d987d2d
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not familiar with that API, though it seems to be used above already? datafusion/datafusion/sql/src/expr/substring.rs Lines 72 to 79 in c22d64b
So this code here (that hardcodes the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I spent some time debugging and I think the solution is that we needed to register the appropriate planner with the tests. I pushed a commit here: e46e532 Note I also found the name of the extension planner very confusing, and I will make a separate PR to fix it
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sense to me, yeah. Was confusing to have that fallback behaviour 😅 |
||||||||||||||||||||
| .context_provider | ||||||||||||||||||||
| .get_function_meta("substr") | ||||||||||||||||||||
| .ok_or_else(|| { | ||||||||||||||||||||
| internal_datafusion_err!("Unable to find expected 'substr' function") | ||||||||||||||||||||
| })?; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Ok(Expr::ScalarFunction(ScalarFunction::new_udf( | ||||||||||||||||||||
| fun, | ||||||||||||||||||||
| substring_args, | ||||||||||||||||||||
| ))) | ||||||||||||||||||||
|
Jefffrey marked this conversation as resolved.
Outdated
|
||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.