-
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
Return scalar result when all inputs are constants in map
and make_map
#11461
Conversation
cc @alamb @goldmedal |
map
and make_map
udfsmap
and make_map
udfs
map
and make_map
udfsmap
and make_map
map
and make_map
map
and make_map
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, @Rachelint. LGTM. I guess this PR is also related to #11436. Maybe @dharanad could take a look at it.
query error | ||
SELECT map(column5, column6) FROM t; | ||
# TODO: support array value | ||
# ---- | ||
# {k1:1, k2:2} | ||
# {k3: 3} | ||
# {k5: 5} |
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.
query error | |
SELECT map(column5, column6) FROM t; | |
# TODO: support array value | |
# ---- | |
# {k1:1, k2:2} | |
# {k3: 3} | |
# {k5: 5} |
I think this test is the same as the above one. We can remove it.
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.
fixed
Mind taking a quick look? @dharanad |
Taking a look |
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 @Rachelint this PR LGTM.
datafusion/functions/src/core/map.rs
Outdated
/// SELECT make_map('type', 'test') from test | ||
/// ``` | ||
/// We can evaluate the result of `make_map` directly. | ||
#[inline] |
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.
Any specific reason for using inline over here ?
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.
Just a personal habit to mark the very short function, and try to reduce the function call cost(it will be really inlined or not... determinded by the compiler).
Will it cause some problems that I haven't noticed before?
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.
Since it more of a suggestion to complier, i dont think this should cause problems. TIL: Inlining small functions can provide small speed wins.
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 there is rare case for inline
. I perfer not to inline unless the benmark shows that compiler fail to do the good job for us
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.
Seem inline here is actually unnecessary according to the article mentioned by @jayzhan211 , removed.
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 @Rachelint @dharanad @goldmedal and @jayzhan211 |
…_map` (apache#11461) * return scalar result when all inputs are constants. * support convert map array to scalar. * disable the const evaluate for Map type before impl its hash calculation. * add tests in map.slt. * improve error return. * fix error. * fix remove unused import. * remove duplicated testcase. * remove inline.
…_map` (apache#11461) * return scalar result when all inputs are constants. * support convert map array to scalar. * disable the const evaluate for Map type before impl its hash calculation. * add tests in map.slt. * improve error return. * fix error. * fix remove unused import. * remove duplicated testcase. * remove inline.
…_map` (apache#11461) * return scalar result when all inputs are constants. * support convert map array to scalar. * disable the const evaluate for Map type before impl its hash calculation. * add tests in map.slt. * improve error return. * fix error. * fix remove unused import. * remove duplicated testcase. * remove inline.
…_map` (apache#11461) * return scalar result when all inputs are constants. * support convert map array to scalar. * disable the const evaluate for Map type before impl its hash calculation. * add tests in map.slt. * improve error return. * fix error. * fix remove unused import. * remove duplicated testcase. * remove inline.
Which issue does this PR close?
Closes #11460 #6485
Rationale for this change
See #11460
What changes are included in this PR?
See title.
Are these changes tested?
Test by new uts.
Are there any user-facing changes?
Can success to run sql like: