-
Notifications
You must be signed in to change notification settings - Fork 163
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: making is_nullable ansi aware for sum_decimal and avg_decimal #981
base: main
Are you sure you want to change the base?
Conversation
Triggered CI. |
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.
Where is the error thrown when ansi_mode is enabled and an overflow occurs?
As per issue-ticket's description - I thought the scope of this work is only to make nullable either true or false based on ANSI mode. @parthchandra |
Thanks for working on this @vaibhawvipul. I checked Spark's source code in the master branch, and it also hard codes nullable as true. This makes sense because if we perform a sum on a column that only contains nulls, then we would expect a null output. It would be good to add a test in Parth raises a good point that we should check that we have the behavior for the ANSI overflow case, but that can be a separate issue/PR. |
Oh, I didn't realize the scope for this PR was limited. I wonder if we may end up with incorrect results if we change the nullability for ansi mode but do not throw an exception on overflow.
That's a good idea. |
@andygrove I have added a test in CometAggregateSuite and we can observe that we have behaviour parity with spark. I can work on the issue raised by Parth in a separate PR. Please let me know your thoughts. |
(-999.99, 999.99), | ||
(-999.99, 999.99) | ||
""") | ||
checkSparkAnswer("SELECT SUM(col1), AVG(col1), SUM(col2), AVG(col2) FROM test") |
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 should use checkSparkAnswerAndOperator
here to make sure that the Comet query really is running with Comet expressions.
checkSparkAnswer("SELECT SUM(col1), AVG(col1), SUM(col2), AVG(col2) FROM test") | |
checkSparkAnswerAndOperator("SELECT SUM(col1), AVG(col1), SUM(col2), AVG(col2) FROM test") |
Which issue does this PR close?
Closes #961 .
Rationale for this change
making is_nullable ansi aware for sum_decimal and avg_decimal
What changes are included in this PR?
Updated
planner.rs
,sum_decimal.rs
andavg_decimal.rs
How are these changes tested?
CI tests pass