chore(audit): audit Average and expand tests#4439
Open
andygrove wants to merge 3 commits into
Open
Conversation
Interval inputs fall through avgDataTypeSupported and convert() returns None, so they are unsupported (no native code path), not incompatible (no allowIncompatible opt-in).
Member
Author
|
Good point. I think we should add tests now for windows support so that we can catch regressions when window support is enabled. I will add to this PR |
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?
N/A. Autonomous audit pass.
Rationale for this change
Audit of the
Average(avg) aggregate expression against Spark 3.4.3, 3.5.8, and 4.0.1. The aggregate logic is identical across all three versions (4.0.1 only changes aQueryContextimport path). The Comet serde and the RustAvg/AvgDecimalaccumulators correctly handle numeric and decimal inputs, including ANSI-mode decimal overflow. The audit found one inaccurate user-facing string in the serde and several uncovered edge cases that are now exercised.What changes are included in this PR?
spark_expressions_support.mdrecording dates and the per-version finding for 3.4.3, 3.5.8, and 4.0.1.CometAverage.getIncompatibleReasonstext. The previous text claimed "Falls back to Spark in ANSI mode. Supports all numeric inputs except decimal types", neither of which is accurate: ANSI mode is wired through to the nativeAvgDecimalaccumulator, and decimal inputs are supported viaavgDataTypeSupported. The new text describes the real caveat: Comet falls back to Spark forYearMonthIntervalTypeandDayTimeIntervalTypeinputs (which Spark supports since 3.4).expressions/aggregate/avg.sqlwith new SQL test cases: single-row group; tinyint and smallint inputs; all-NULL groups; empty input; double NaN / +Infinity / -Infinity mixes; Long boundary values; negative-only inputs; decimal at precision 20; cross-check againstcount.How are these changes tested?
./mvnw test -DwildcardSuites=CometSqlFileTestSuite -Dsuites="org.apache.comet.CometSqlFileTestSuite avg" -Dtest=none(passes locally; all new queries match Spark)Scaffolded by the
audit-comet-expression-autonomousskill.