-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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): breaking💥 fix coalesce function correctness #4490
Merged
Conversation
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 should be marked as a breaking change💥 |
bluestreak01
changed the title
fix(sql): fix coalesce function correctness
fix(sql): breaking💥 fix coalesce function correctness
May 14, 2024
ideoma
reviewed
May 17, 2024
core/src/main/java/io/questdb/griffin/engine/functions/bind/BindVariableServiceImpl.java
Outdated
Show resolved
Hide resolved
core/src/main/java/io/questdb/griffin/engine/functions/conditional/NullCaseFunction.java
Outdated
Show resolved
Hide resolved
core/src/test/java/io/questdb/test/cutlass/pgwire/PGJobContextTest.java
Outdated
Show resolved
Hide resolved
core/src/test/java/io/questdb/test/cutlass/pgwire/PGJobContextTest.java
Outdated
Show resolved
Hide resolved
ideoma
reviewed
May 20, 2024
core/src/test/java/io/questdb/test/griffin/WhereClauseParserTest.java
Outdated
Show resolved
Hide resolved
ideoma
previously approved these changes
May 20, 2024
ideoma
approved these changes
May 20, 2024
[PR Coverage check]😍 pass : 771 / 872 (88.42%) file detail
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fixes #4478
fixes #4477
fixes #4505
Scope
This PR impacts all SQL functions that accept var-arg argument. More specifically impacted functions are:
Bind variable behaviour (general)
Bind variables are utilized by:
The prepared statement can be reused. Potentially allowing user to change bind variable type from one execution to the next.
Old behaviour
The affected functions use to accept bind variables and implicitly type them as
STRING
during the preparation stage. When user sets type of bind variable as string, the result would be predictable. However, if user sets bind variable type to something other than string - the result is generally undefined. You can get anything between incorrect result and an obscure error.New behaviour
After SQL preparation stage the type of bind variables is UNDEFINED. The type becomes defined once bind variable is assigned a value. Some functions cannot allow that, because type of their arguments also influences the return type of the function itself. As a result these function no longer accept bind variables:
Additionally this function:
enforces the types of its arguments to be "compatible", e.g. to belong to the same group of types. The groups of types are:
arguments, which types belong to different groups will be rejected by `COALESCE
This function:
will now narrow down the type of bind variables to those compatible with the type of its left argument. The types must belong to the same group, as described for
COALESCE