test(integ-test): stabilize eval max/min schema assertions across shards - #5740
Open
mengweieric wants to merge 1 commit into
Open
test(integ-test): stabilize eval max/min schema assertions across shards#5740mengweieric wants to merge 1 commit into
mengweieric wants to merge 1 commit into
Conversation
The eval max()/min() result column has no plan-time type, so the reported type is taken from the first row of the result set. On a single shard that row is always the same document, so the assertions were stable. On multiple shards the arriving row varies and the reported type varies with it, which failed testEvalMaxNumeric, testEvalMinNumeric and testEvalMinIgnoresNulls. Each of those tests now filters to a single known document, so the sampled row is deterministic under any shard count, and a companion test covers the other selection direction that the original two-row query also asserted. Values, method names and the remaining tests are unchanged. The int-asserting tests are gated on EVAL_MAX_MIN_INT_WIDENING because the analytics-engine route reports a wider type for the same value. Signed-off-by: Eric Wei <[email protected]>
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
mengweieric
marked this pull request as ready for review
September 2, 2026 21:43
mengweieric
requested review from
LantaoJin,
RyanL1997,
Swiddis,
acarbonetto,
ahkcs,
anirudha,
dai-chen,
joshuali925,
noCharger,
penghuo,
ps48,
qianheng-aws,
songkant-aws,
vamsimanohar,
ykmr1224 and
yuancu
as code owners
September 2, 2026 21:43
dai-chen
approved these changes
Sep 3, 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.
Description
CalcitePPLEvalMaxMinFunctionIThad three tests that passed on a single shard and failed on five.eval max()/min()carries no plan-time result type, so the reported type of the computed column is taken from the first row of the result set.OpenSearchExecutionEnginedoes this deliberately as a documented workaround forANY-typed columns. With one shard the first row is always the same document and the reported type is stable. With more shards the arriving row varies, and because the winning operand differs per row, so does the type.Both rows are correct. Only the column label moves, between
intandbigint, depending on which row arrives first. The failures were always inverifySchema, never inverifyDataRows.The three affected tests now filter to a single known document, which makes the sampled row deterministic under any shard count. Each one gained a companion test for the other selection direction, so the pair still asserts everything the original two-row query asserted.
testEvalMaxNumericwhere age = 23inttestEvalMaxNumericWhenFieldSelected(new)where age = 44biginttestEvalMinNumericwhere age = 22biginttestEvalMinNumericWhenLiteralSelected(new)where age = 43inttestEvalMinIgnoresNullswhere key = 'values'3.1415doubletestEvalMinIgnoresNullsWhenLiteralSelected(new)where key != 'values'5intThe three tests that assert
intare gated onEVAL_MAX_MIN_INT_WIDENING, since the analytics-engine route reports a wider type for the same value.Scope notes:
testEvalMaxIgnoresNullsand the four string and mixed-type tests are unchanged.max(int, 3)is aninton every row, so that test was already shard-stable.max()ormin()return.Validation
Run on an external cluster, comparing the same class before and after the change.
The five-shard run before the change reproduced exactly the three reported failures, and the cluster log confirms the fixtures were created with five primary shards.
spotlessJavaCheck,compileTestJavaandgit diff --checkpass.This class is not a member of the
CalciteNoPushdownITsuite, so that mode is unaffected. The analytics-engine lane was reasoned from the capability gate rather than executed locally, because that plugin is not available in this tree.Related Issues
The underlying limitation is that the result type is recovered from data rather than declared at plan time. That is a separate product discussion and is not addressed here.
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.