-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support DataType::Decimal
for IN
and NOT IN
expressions
#2764
Conversation
.collect(); | ||
// TODO in the arrow-rs, should support NULL type to Decimal Data type | ||
// TODO support in the arrow-rs, NULL value cast to Decimal Value | ||
let result_type = get_coerce_type(expr_type, &list_types); |
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 IN operator is a shorthand for multiple OR conditions.
We should get the coerced data type for IN 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.
In this issue: #2759
The type of list is BOOLEAN, INT32
, and these two type are not compatible.
e641539
to
9851725
Compare
); | ||
|
||
// expression: "a in (0, 1, NULL)" | ||
let list = vec![ | ||
lit(ScalarValue::Int64(Some(0))), | ||
lit(ScalarValue::Int64(Some(1))), | ||
lit(ScalarValue::Utf8(None)), | ||
lit(ScalarValue::Null), |
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.
We can't get the coerced data type between INT64 and UTF8.
I think the type of NULL is Null
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.
From this test case, we can know that we should not treat Null as UTF8 data type
9851725
to
88cfa73
Compare
@alamb @andygrove @viirya PTAL |
@@ -310,6 +313,8 @@ pub fn create_physical_expr( | |||
&list_expr_data_type, | |||
&value_expr_data_type, | |||
) { | |||
// TODO: Can't cast from list type to value type directly |
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.
we can't cast the list data type to the value data type directly, and need to coerced common data type if they are compatible.
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.
about issue: #2759
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
88cfa73
to
fb3cef3
Compare
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 left some suggestions for code improvements that I think should be done, but the logic and tests in this PR look good to me. 👍 thanks @liukun4515
f0d0d7c
to
8837d9d
Compare
Codecov Report
@@ Coverage Diff @@
## master #2764 +/- ##
==========================================
+ Coverage 84.95% 85.13% +0.17%
==========================================
Files 271 272 +1
Lines 48053 48207 +154
==========================================
+ Hits 40824 41039 +215
+ Misses 7229 7168 -61
Continue to review full report at Codecov.
|
All comments have be resolved. |
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.
Thank you @liukun4515
DataType::Decimal
for IN
and NOT IN
expressions
Which issue does this PR close?
Part of #2755
Rationale for this change
What changes are included in this PR?
Are there any user-facing changes?