hubgeter opened a new pull request, #68331:
URL: https://github.com/apache/doris/pull/68331

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Related PR: #68214
   
   Problem Summary:
   
   `retainPredicatePathsInFinalAllAccessPaths`, added by #68214, removes every 
predicate access path that is not literally one of the final all access paths. 
That is what NULL/OFFSET paths need, because they are stripped from the all 
paths on purpose, but it also removes ordinary sub-field paths whenever the all 
paths collapse to the whole-column path:
   
   ```sql
   SELECT s FROM tbl WHERE struct_element(s, 'city') = 'x';
   -- all access paths: [s], predicate access paths: [] (was [s.city])
   ```
   
   BE then cannot tell which sub-column the predicate reads, so it loses the 
eager/lazy split and reads the column as one unit. On branch-4.2 this shows up 
in `test_iceberg_variant_read`, where the lazy-read check sees 
`FilteredRowsByLazyRead = 0` for
   
   ```sql
   SELECT CAST(v AS STRING) FROM variant_page_pruning WHERE CAST(v['n'] AS INT) 
> 3000
   ```
   
   Only file scans hit this: on OLAP tables a variant sub-path predicate gets 
its own sub-column slot, so its all paths already contain the predicate path. 
That is why the existing unit tests did not catch it, and why the new test uses 
a struct column, which keeps one slot for the whole column.
   
   This PR keeps the NULL/OFFSET cleanup, since BE switches the whole iterator 
to `NULL_MAP_ONLY`/`OFFSET_ONLY` once such a path shows up and skips the 
children. Every other predicate path is kept, and added to the all paths when 
no wider path covers it — the behaviour of master's 
`addPredicatePathsToFinalAllAccessPaths`.
   
   ### Release note
   
   Fix nested/variant sub-field predicates losing lazy materialization on 
branch-4.2 when the whole column is read.
   
   ### Check List (For Author)
   
   - Test
       - [ ] Regression test
       - [x] Unit Test
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. Sub-field predicates keep their access paths, restoring 
predicate-first reads.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to