-
Notifications
You must be signed in to change notification settings - Fork 594
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
fix(sql-udf): correctly handle udf_binding_flag
& udf_global_count
#14906
Merged
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bd6492f
only top most sql udf should unset the binding flag
xzhseh 8a1804b
remove redundant debug statement
xzhseh 8e3e11b
fix check
xzhseh 84ac21a
add related test case
xzhseh ada4d76
correctly decrement global count
xzhseh 313a2da
remove redundant debug statement
xzhseh 3052545
set global count before conducting semantic check
xzhseh 82f2ab2
remove debugging statement
xzhseh 449465c
remove udf_binding_flag
xzhseh b74d18c
remove mysterious code snippet
xzhseh 6798822
remove mysterious code snippet
xzhseh bbf2e02
remove unnecessary statement
xzhseh 6f9177d
remove flag from constructor
xzhseh dc1b7c2
Merge branch 'main' into xzhseh/fix-named-sql-udf-binding
xzhseh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,6 +190,10 @@ pub async fn handle_create_sql_function( | |
|
||
binder.set_udf_binding_flag(); | ||
|
||
// Need to set the initial global count to 1 | ||
// otherwise the flag will be unset during the semantic check | ||
binder.udf_context_mut().incr_global_count(); | ||
|
||
if let Ok(expr) = UdfContext::extract_udf_expression(ast) { | ||
match binder.bind_expr(expr) { | ||
Ok(expr) => { | ||
|
@@ -204,7 +208,7 @@ pub async fn handle_create_sql_function( | |
} | ||
} | ||
Err(e) => return Err(ErrorCode::InvalidInputSyntax(format!( | ||
"failed to conduct semantic check, please see if you are calling non-existence functions: {}", | ||
"failed to conduct semantic check, please see if you are calling non-existence functions or parameters\ndetailed error message: {}", | ||
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 is just a current work around, I prefer a better hint display in the future, related: #14853. |
||
e.as_report() | ||
)) | ||
.into()), | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Looks like
udf_binding_flag
can be inferred byudf_global_counter != 0
. Can we removeudf_binding_flag
now?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 so, let me do a tiny refactor.