Skip to content

branch-4.1: [fix](variant) fix array subscript on pruned variant subpath #63891#63971

Open
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-63891-branch-4.1
Open

branch-4.1: [fix](variant) fix array subscript on pruned variant subpath #63891#63971
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-63891-branch-4.1

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 1, 2026

Cherry-picked from #63891

### What problem does this PR solve?

Fix variant subpath pruning for projections where the top-level
expression is an array subscript or `element_at` over a variant subpath.
The planner could leave the outer subscript on the original variant
access chain after pruning, which made valid 1-based array subscripts
return `NULL`.

The original array-of-objects repro depends on nested-group variant
semantics, so the regression in this PR uses a plain `VARIANT` array
leaf without nested group. Since that query result is already correct on
current master, the regression asserts the verbose plan instead: the
scan uses `subColPath=[items, type]` and the final array subscript is
applied to the pruned variant slot.

### Check List

- [x] Added regression test
- [x] Added FE planner unit test

### Tests

- `./run-regression-test.sh --run --conf tmp/regression-conf.auto.groovy
-d variant_p0 -s test_variant_array_subscript`
- `./run-fe-ut.sh --run
org.apache.doris.nereids.rules.rewrite.VariantPruningLogicTest` passed
earlier on the same FE code; rerun after this regression-only amend was
blocked by system pid/thread exhaustion before test execution.
@github-actions github-actions Bot requested a review from yiguolei as a code owner June 1, 2026 14:16
@hello-stephen
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen
Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (2/2) 🎉
Increment coverage report
Complete coverage report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants