test(isthmus): use loose round-trip comparison for statistical aggregate tests#1023
Merged
vbarua merged 1 commit intoJul 22, 2026
Conversation
…te integer inputs The round-trip helper that StatisticalFunctionTest's integer-input cases relied on was removed, leaving the isthmus test module uncompilable on main. Those cases cannot use the standard assertFullRoundTrip: the statistical- aggregate cast rewrite stacks a cast projection over the aggregate's input projection, which Calcite merges (and prunes the redundant column) when it rebuilds the plan on the Substrait -> Calcite leg. The plan straight from SQL therefore differs from the one after a Calcite -> Substrait -> Calcite round trip. Switch them to the existing assertSqlSubstraitRelRoundTripLoosePojoComparison helper, which is documented for exactly this optimizer-normalization case: it asserts that the normalized plan is stable across a round trip rather than requiring equality with the initial plan.
vbarua
approved these changes
Jul 22, 2026
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.
Problem
The round-trip helper that
StatisticalFunctionTest's integer-input cases relied on (assertFullRoundTripWithIdentityProjectionWorkaround) was removed in #1009, but those cases were added in #780. Because #1009 branched before #780 merged, it did not see the new call sites, leaving the:isthmustest module uncompilable onmain.Why not just use
assertFullRoundTripThese cases can't use the standard
assertFullRoundTrip. The statistical-aggregate cast rewrite (castStatisticalAggregatesToFloatingPoint) stacks acast(... AS fp64)projection over the aggregate's input projection. When the plan is rebuilt on the Substrait → Calcite leg, Calcite merges those projections and prunes the redundant pass-through column — project-merge/column-pruning, distinct from the redundant identity projections #1009 now elides. So the plan produced straight from SQL differs structurally from the one produced after a Calcite → Substrait → Calcite round trip, and a strict equality assertion fails.Fix
Switch the three integer-input cases to the existing
assertSqlSubstraitRelRoundTripLoosePojoComparisonhelper, which is documented for exactly this optimizer-normalization situation: it asserts that the normalized plan is stable across a round trip rather than requiring equality with the initial plan. No new helper is reintroduced.The fp32/fp64 cases keep the stronger
assertFullRoundTrip, andusesEnumArgSignaturestill pins the Substrait function structure.Verification
./gradlew :isthmus:test --tests "io.substrait.isthmus.StatisticalFunctionTest"→ 14/14 pass./gradlew :isthmus:spotlessCheck :isthmus:pmdTest→ clean🤖 Generated with AI