-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 : Incorrect NULL handling in BETWEEN expression #14007
Conversation
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.
Thanks @getChan -- this is a nice fix ❤️
Thanks to @2010YOUY01 for filing the ticket.
@@ -426,7 +426,7 @@ impl TreeNodeRewriter for TypeCoercionRewriter<'_> { | |||
)) | |||
})?; | |||
let high_type = high.get_type(self.schema)?; | |||
let high_coerced_type = comparison_coercion(&expr_type, &low_type) | |||
let high_coerced_type = comparison_coercion(&expr_type, &high_type) |
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.
🤦 -- nice fix
@@ -0,0 +1,32 @@ | |||
# Licensed to the Apache Software Foundation (ASF) under one |
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.
Would it be possible to move this file into this https://github.com/apache/datafusion/tree/main/datafusion/sqllogictest/test_files/expr directory?
We can do it as a follow on PR too
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.
thanks. moved it.
Thanks again @getChan 🚀 |
Which issue does this PR close?
Closes #13976.
Rationale for this change
What changes are included in this PR?
in
BETWEEN
expression,The type of the
high
value is determined by the type of thehigh
value, not the type of thelow
value.As a result, the coercion type in a BETWEEN expression is determined by comparing the
low
,high
, andcompare
values.datafusion/datafusion/optimizer/src/analyzer/type_coercion.rs
Lines 420 to 441 in a2a353b
Are these changes tested?
unit tested, sqllogic tested.
Are there any user-facing changes?
in
BETWEEN
expression,Type coercion will work as intended.