-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-5262] [SPARK-5244] [SQL] add coalesce in SQLParser and widen types for parameters of coalesce #4057
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
Conversation
|
Test build #25599 has started for PR 4057 at commit
|
|
Test build #25599 has finished for PR 4057 at commit
|
|
Test PASSed. |
|
Thank you for working it! Can you explain why your change can make Also, if we want to parse |
|
Also, I already merged #4040, can you add the test here? |
|
@adrian-wang Seems we need to add rule in |
|
@yhuai I don't think we need to cast data types, since coalesce() only return the first non-null value from its parameters, so use the first parameter's datatype is OK. I was adding tests in ExpressionEvaluationSuite but was blocked by some code-gen tests, and I am working on that. @marmbrus it seems #4040 is reverted due to some conflicts... should I port all the code into this PR together? |
|
Although coalesce only returns the first non-null value, but we need to correctly set the type of coalesce. Let's say we have two columns. The type of one is LongType and the type of another one is IntType, when we do coalesce, the return type of coalesce should be LongType. Right now, there will be an error when we are trying to call coalesce for these two columns. In FunctionArgumentConversion, we should make sure all expressions of coalesce are in the same type and if they are not, we should add cast. |
|
Test build #26016 has started for PR 4057 at commit
|
|
Yes, I moved my work to FunctionArgumentConversion, and since #4040 is reverted due to conflicts, I added the code together here. So I leave Coalesce() untouched, since we would have the same type in Coalesce for sure. I'll change the title accordingly. |
|
Test build #26016 has finished for PR 4057 at commit
|
|
Test FAILed. |
|
Test build #26017 has started for PR 4057 at commit
|
|
Test build #26017 has finished for PR 4057 at commit
|
|
Test PASSed. |
|
ping @yhuai |
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.
It will be good to add a comment to explain what we are doing at here.
|
A few things I feel we should add in this PR.
I think we also need to add a rule in |
|
@yhuai Thanks for your comments! I'll modify this PR accordingly. |
|
Test build #26385 has started for PR 4057 at commit
|
|
Test build #26385 has finished for PR 4057 at commit
|
|
Test PASSed. |
|
Thanks! Merged to master. |
I'll add test case in #4040