[refactor](search) Simplify Variant search iterator binding - #66449
Conversation
### What problem does this PR solve? Issue Number: None Related PR: apache#60847, apache#63660 Problem Summary: The scanner materializes Variant path slots, and the storage layer resolves direct or inherited index metadata before constructing an iterator for that child scan column. VSearch additionally tried to resolve a physical parent ColumnId, borrow the parent iterator, and synthesize the stored field name when the child iterator was absent. That duplicated storage ownership, mixed scan column indexes with tablet ColumnIds, and could bypass the path and index selection used by NestedGroup. Remove the expression-level parent rebinding, use only the iterator associated with the SlotRef scan column, remove the fallback-only IndexExecContext APIs, and add a focused parent-present child-missing test. ### Release note Variant SEARCH no longer borrows a parent Variant iterator when the materialized child iterator is absent. ### Check List (For Author) - Test: Unit Test and Regression Test - ASAN BE build: ./build.sh --be - Unit Test: 60 focused VSearch and NestedGroup provider tests passed - Regression Test: variant_p0/test_variant_search_subcolumn passed - Static analysis: run-clang-tidy was attempted; repository core/types.h NOLINT parsing and system stddef.h discovery errors prevented completion - Behavior changed: Yes. A missing Variant child iterator now produces an empty index result instead of being reinterpreted through the parent iterator. - Does this need documentation: No
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
1 similar comment
|
run buildall |
TPC-H: Total hot run time: 28734 ms |
TPC-DS: Total hot run time: 165897 ms |
ClickBench: Total hot run time: 23.8 s |
|
/review |
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Refactors Variant SEARCH iterator binding to rely solely on the SlotRef’s scan-column iterator, removing the expression-level fallback that borrowed a parent Variant iterator when a materialized subcolumn iterator is missing.
Changes:
- Removed parent-iterator rebinding logic for Variant subcolumns in
VSearchExprinput collection. - Introduced a helper to collect SlotRef-based search inputs using explicit scan column indexes.
- Added a focused unit test covering the “parent iterator exists, child iterator missing” boundary case.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| be/src/exprs/vsearch.cpp | Removes parent fallback logic; adds helper to bind SEARCH inputs strictly by scan column index + iterator presence. |
| be/src/exprs/vexpr_context.h | Deletes fallback-only IndexExecContext APIs used by the removed rebinding logic. |
| be/test/exprs/vsearch_expr_test.cpp | Adds a regression-style unit test ensuring missing Variant child iterators do not cause parent iterator usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codex automated review failed and did not complete. Error: All Codex review accounts are usage-limited; earliest retry is 2026-08-08T03:32:00Z. Please trigger /review again after that time. |
|
skip check_coverage |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
Related PR: #60847, #63660 Problem Summary: OlapScanner materializes a requested Variant path as a scan-schema column. For example, data.items.message gets its own SlotRef and scan column position. VariantColumnReader then resolves either direct subcolumn index metadata or metadata inherited from data, and SegmentIterator constructs the runtime iterator for that child column with the complete stored Variant path. VSearch duplicated that storage responsibility. When the child iterator was absent, it resolved the tablet ColumnId for data, borrowed the parent iterator, and synthesized a stored field name. This mixed scan column positions with tablet ColumnIds and could bypass the path and physical index selection already performed by the storage layer, including NestedGroup selection. This PR removes the expression-level parent rebinding. VSearch now consumes only the iterator attached to the SlotRef scan column. If that iterator is absent, the field remains an empty index input. It also removes the three fallback-only IndexExecContext APIs and separates SlotRef collection into a small helper that names the scan column index explicitly. A focused unit test constructs the exact boundary case: the data parent iterator exists, while the data.items.message child iterator does not. The test verifies that SEARCH does not mark or execute the parent iterator. ### Release note Variant SEARCH no longer borrows a parent Variant iterator when the materialized child iterator is absent.
What problem does this PR solve?
Issue Number: None
Related PR: #60847, #63660
Problem Summary:
OlapScanner materializes a requested Variant path as a scan-schema column. For example, data.items.message gets its own SlotRef and scan column position. VariantColumnReader then resolves either direct subcolumn index metadata or metadata inherited from data, and SegmentIterator constructs the runtime iterator for that child column with the complete stored Variant path.
VSearch duplicated that storage responsibility. When the child iterator was absent, it resolved the tablet ColumnId for data, borrowed the parent iterator, and synthesized a stored field name. This mixed scan column positions with tablet ColumnIds and could bypass the path and physical index selection already performed by the storage layer, including NestedGroup selection.
This PR removes the expression-level parent rebinding. VSearch now consumes only the iterator attached to the SlotRef scan column. If that iterator is absent, the field remains an empty index input. It also removes the three fallback-only IndexExecContext APIs and separates SlotRef collection into a small helper that names the scan column index explicitly.
A focused unit test constructs the exact boundary case: the data parent iterator exists, while the data.items.message child iterator does not. The test verifies that SEARCH does not mark or execute the parent iterator.
Release note
Variant SEARCH no longer borrows a parent Variant iterator when the materialized child iterator is absent.
Check List (For Author)