branch-4.1 [fix](match) Allow MATCH on aliased variant subcolumns#63811
Merged
yiguolei merged 1 commit intoMay 29, 2026
Merged
Conversation
Issue Number: None Related PR: apache#63772 Problem Summary: MATCH predicates fail for VARIANT dot subcolumn access such as cast(msg.trace_id as string), while the equivalent bracket access msg['trace_id'] works. Dot access can leave an Alias around the pruned subcolumn slot, and CheckMatchExpression rejected the aliased slot. Fix MATCH predicates on VARIANT dot subcolumn access such as msg.trace_id so they are accepted like equivalent bracket subcolumn access. - Test: - Unit Test: ./run-fe-ut.sh --run org.apache.doris.nereids.rules.rewrite.CheckMatchExpressionTest - Unit Test: ./run-fe-ut.sh --run org.apache.doris.nereids.rules.rewrite.VariantPruningLogicTest#testMatchOnDotVariantSubColumnUsesSlotRefInScanPredicate - Behavior changed: Yes. MATCH validation now accepts alias/cast chains that resolve to a SlotReference, while still rejecting aliases over non-slot expressions. - Does this need documentation: No (cherry picked from commit d0cfb94) (cherry picked from commit 26abcfcdb9a04a3d7244ccad5d17c7bdd7a1dfa9)
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Member
Author
|
run buildall |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes MATCH predicate validation for VARIANT dot-access subcolumns (e.g., v.trace_id) when pruning/rewrites introduce Alias (and Cast) wrappers around the underlying SlotReference, making dot access behave like equivalent bracket access (e.g., v['trace_id']).
Changes:
- Extend MATCH validation to unwrap
Aliasin addition toCastwhen resolving the left operand down to aSlotReference. - Add unit tests ensuring alias/cast chains over VARIANT subcolumn slots are accepted, while aliases over non-slot expressions are still rejected.
- Add an integration-style planner test verifying the scan predicate uses a
SlotRefwith the expected VARIANT subcolumn labels for dot access.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/CheckMatchExpression.java | Allow MATCH left operand resolution through Alias + Cast chains to reach the underlying SlotReference. |
| fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/CheckMatchExpressionTest.java | Add test coverage for alias/cast chains on VARIANT subcolumn MATCH and rejection for alias-on-expression. |
| fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/VariantPruningLogicTest.java | Verify planned scan conjunct contains a MatchPredicate whose left child resolves to a SlotRef with trace_id subcolumn labels. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
FE Regression Coverage ReportIncrement line coverage |
yiguolei
approved these changes
May 29, 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.
cherry-pick #63772