[BugFix] Fix dedup aggregation pushdown nullifying renamed fields (#5150)#27
[BugFix] Fix dedup aggregation pushdown nullifying renamed fields (#5150)#27qianheng-aws wants to merge 2 commits intorefactor/dedupe-reusable-workflowfrom
Conversation
…pensearch-project#5269) (opensearch-project#5293) When querying across indices with conflicting field mappings (boolean vs text), numeric values like 0 were not coerced to boolean, causing "node must be a boolean, found NUMBER" error. Added numeric handling to parseBooleanValue() consistent with ObjectContent.booleanValue(). Signed-off-by: Heng Qian <qianheng@amazon.com>
…ensearch-project#5150) When a field is renamed via `rename` and a subsequent `dedup` operates on a different field, the aggregation-based DedupPushdownRule returns null for all renamed fields. The root cause is that the top_hits response uses original index field names from _source, but the enumerator expects the renamed names from the logical plan's rowType. Fix: Build a rename mapping (originalName -> renamedName) in the LITERAL_AGG case of AggregateAnalyzer and pass it to TopHitsParser. The parser applies this mapping when constructing result maps, so field names match what the enumerator expects. Signed-off-by: Heng Qian <qianheng@amazon.com>
Decision LogRoot Cause: The Approach: Added a Alternatives Rejected:
Pitfalls:
Things to Watch:
|
Description
When a field is renamed via
renameand a subsequentdedupoperates on a different field, the aggregation-basedDedupPushdownRulereturns null for all renamed fields. This is because thetop_hitsresponse uses original index field names from_source, but theOpenSearchIndexEnumeratorexpects the renamed names from the logical plan'srowType.Root cause: In
AggregateAnalyzer.createTopHitsBuilder(),helper.inferNamedField()resolvesRexInputReffields to original index names (e.g.,value), but the enumerator's field list uses renamed names (e.g.,val). No mapping bridges this gap.Fix: Build a rename mapping (
originalName -> renamedName) in theLITERAL_AGGcase ofAggregateAnalyzerby comparing the resolved index field name with the project's field name. Pass this mapping toTopHitsParser, which applies it when constructing result maps from the_sourceresponse.Related Issues
Resolves opensearch-project#5150
Check List
-s)spotlessCheckpassed