Test: Add test coverage and documentation for SumDecimal/AvgDecimal nullability behavior#3766
Merged
parthchandra merged 7 commits intoapache:mainfrom Mar 25, 2026
Merged
Conversation
Contributor
parthchandra
left a comment
There was a problem hiding this comment.
Ci is failing because the benchmarks have a couple of call sites that need to be updated.
…vior In Spark, Sum.nullable and Average.nullable both return true irrespective of ANSI mode. Reverted the ANSI-aware is_nullable logic and added comments documenting this Spark behavior. Test updated to assert nullable is always true.
Contributor
Author
|
@parthchandra I have added a test in I have reverted my changes in the rust code to keep comet's behaviour consistent with spark. |
Contributor
|
rebasing on main should fix the |
Contributor
Author
@parthchandra thank you for the approval. I think this can be merged. |
Contributor
Author
|
@parthchandra thank you for re-basing. i missed it. |
Contributor
|
Merged. Thanks @vaibhawvipul |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #961 .
Rationale for this change
SumDecimal and AvgDecimal hardcode
nullable=true. In Spark,Sum.nullableandAverage.nullableboth return true irrespective of ANSI mode. This PR documents that behavior and adds test coverage to ensure Comet stays consistent with Spark.What changes are included in this PR?
SumDecimal.is_nullable()andAvgDecimal.is_nullable()documenting that Spark always returnstruefor nullable, regardless of ANSI mode.is_nullable()override toAvgDecimal(previously relied on default) with the same documentation.How are these changes tested?
Added a test in
CometAggregateSuitethat exercises SUM and AVG on decimal columns with both nullable and non-nullable inputs, under both ANSI and non-ANSI modes. The test assertsnullable == truein all cases and usescheckSparkAnswerAndOperatorto verify results match Spark.