Fix 500 on PPL query over alias spanning mapping-less index - #22665
Open
alchemist51 wants to merge 1 commit into
Open
Fix 500 on PPL query over alias spanning mapping-less index#22665alchemist51 wants to merge 1 commit into
alchemist51 wants to merge 1 commit into
Conversation
An alias (or index pattern) spanning an index that was created empty
and never written to — so it has no mapping — alongside a populated
index caused analytics-engine PPL queries to fail with a 500.
FieldStorageResolver threw IllegalStateException ("No mapping found
for index") when the per-index resolution loop reached the
mapping-less index. The schema builder and IndexResolution already
skip such indices, so the resolver was the lone component treating
them as an error.
Treat a null mapping / missing properties as an empty field set
instead: the index contributes nothing to the field-storage union,
matching how the rest of the pipeline (and the GENERAL engine mode)
handles it. A query targeting only mapping-less indices still fails
cleanly upstream at Calcite validation with "table not found".
Adds unit tests for the empty resolver and the merged union, plus an
integration test reproducing the alias shape end-to-end.
Signed-off-by: Arpit Bandejiya <abandeji@amazon.com>
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
An alias (or index pattern) spanning an index that was created empty and never written to — so it has no mapping — alongside a populated index caused analytics-engine PPL queries to fail with a 500:
The same query on a GENERAL-mode domain returns the populated index's count.
Root cause: three components in the analytics planning path read index mappings.
OpenSearchSchemaBuilderandIndexResolution.validateSchemaCompatibilityalready skip a null mapping, butFieldStorageResolverthrewIllegalStateException("No mapping found for index")whenCapabilityRegistry.resolveFieldStorage(List)'s per-index loop reached the mapping-less backing index.Fix:
FieldStorageResolvernow treats a null mapping / missingpropertiesas an empty field set. The empty index contributes nothing to the merged field-storage union, matching the rest of the pipeline. A query targeting only mapping-less indices still fails cleanly upstream at Calcite validation with "table not found" (the schema builder yields no row type), so that error path is unchanged.Testing:
FieldStorageResolverTests#testIndexWithoutMappingContributesNoFields,#testMergedResolverSkipsMappinglessIndexAliasIT#testAliasSpansMappinglessEmptyIndex— creates the exact alias shape (empty index with no mappings + populated index) and assertsstats count()returns the populated index's doc countRelated Issues
N/A
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.