Bring CalcitePPLEnhancedCoalesceIT to parity on the analytics-engine route#5552
Merged
ahkcs merged 1 commit intoJun 16, 2026
Merged
Conversation
Swiddis
approved these changes
Jun 15, 2026
…route
Four ordering-sensitive tests failed on the analytics route only because they
used 'head N' without a sort, and the analytics scan surfaces raw-PUT docs
ahead of bulk-loaded docs (non-deterministic row set). Fixed in place by adding
an explicit 'sort - age' where the sort key is unique over the head window (or
the tie projects identical values), so the expectations are unchanged and hold
on both routes:
- testCoalesceNested
- testCoalesceEmptyFieldWithFallback
- testCoalesceWithMultipleNonExistentFields
- testCoalesceWithNullLiteralAndIntegerField
Three tests are skipped on the analytics route (assumeNotAnalytics + gradle
exclude list, recorded as AnalyticsRouteLimitation constants):
- testCoalesceBasic, testCoalesceWithMixedTypes: 'head 3' whose third row
needs a nullable tiebreak (age=25 tie between a real doc and a raw-PUT
null-name doc); null placement diverges between the v2/Calcite and
analytics routes, so a sort can't make the expectation hold on both.
- testCoalesceWithAllNonExistentFields: COALESCE over all-untyped-null
operands is rejected by the analytics-engine capability registry
(No backend supports scalar function [COALESCE]); the v2 path returns an
undefined-typed null (opensearch-project#5175). Genuine engine gap.
The v2/Calcite path is unchanged: all 19 tests run and pass there.
Signed-off-by: Kai Huang <ahkcs@amazon.com>
36f14ca to
f19eeda
Compare
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
Brings
CalcitePPLEnhancedCoalesceITto parity on the analytics-engine route (:integ-test:integTestRemote -Dtests.analytics.parquet_indices=true): 4 failing → 0.coalesceitself computes correctly on the route (it's wired viaSTANDARD_PROJECT_OPS); every failure was a row-ordering or capability edge case, not a coalesce bug.Where a
sortmakes the test deterministic, the test is fixed in place — not skipped. Only the cases asortcan't make correct on both routes are skipped, behindassumeNotAnalytics(...)+ the gradle exclude list (theAnalyticsRouteLimitationregistry / pattern from #5546).Fixed in place with an explicit
sort(no skip)These used
head Nwithout a sort. On the analytics route the scan surfaces the raw-PUTdocs (added ininit()) ahead of the bulk-loaded docs, soheadreturned a different row set. Addingsort - agemakes them deterministic with their original expectations unchanged, because the sort key is unique over the head window (or the tie projects identical values):testCoalesceNested(head 2)sort - age— top-2 ages (70, 30) uniquetestCoalesceEmptyFieldWithFallback(head 1)sort - age— max age (70) uniquetestCoalesceWithMultipleNonExistentFields(head 1)sort - age— max age (70) uniquetestCoalesceWithNullLiteralAndIntegerField(head 3)sort - age— the age=25 tie projects identical[25, 25], so the expectation holds regardless of tie orderSkipped on the analytics route (a
sortcan't fix these)testCoalesceBasic,testCoalesceWithMixedTypes(head 3)John) vs. a raw-PUTnull-name doc. Null placement under sort diverges between the v2/Calcite and analytics routes, so nosortmakes the expectation hold on both.testCoalesceWithAllNonExistentFieldscoalesce(field1, field2, field3)where every operand is untyped NULL is rejected by the analytics-engine capability registry:No backend supports scalar function [COALESCE] among [datafusion]. The v2/Calcite path returns anundefined-typed null instead (#5175). Genuine engine-side gap.Pass rate
:integTestRemote -Dtests.analytics.parquet_indices=true):integ-test:integTest, fresh cluster)Note for reviewers
The skips are genuine route divergences (recorded as
AnalyticsRouteLimitationconstants): the COALESCE-over-all-null-operands one is an engine capability gap, and thehead-without-stable-sort + nullable-tiebreak one is a route ordering difference that a test-side sort can't reconcile. The foursortfixes are pure determinism additions — expectations and the v2 path are unchanged.Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.