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

   ### What problem does this PR solve?
   
   Issue Number: None
   
   Problem Summary:
   
   Nested access paths are collected with a lower-cased column name, while a 
whole-column access path is rebuilt from the name the catalog stores. When a 
column name is not all lower case, the prefix check that decides whether the 
all access paths already cover a predicate access path compares the two 
spellings case-sensitively and reports "not covered", so the sub-field path is 
added next to the whole-column path:
   
   ```sql
   CREATE TABLE t (id INT, S STRUCT<City: STRING, Zip: INT>);
   SELECT S FROM t WHERE struct_element(S, 'City') = 'x';
   -- all access paths: [S], [s.city]
   ```
   
   BE does not accept both for the same slot. 
`ColumnIterator::_get_sub_access_paths` consumes the whole-column path as the 
"read this column" marker and removes it from the list, so the remaining 
`[city]` is treated as the only sub-column to read and 
`StructFileColumnIterator::set_access_paths` marks the siblings `SKIP_READING`. 
The projected column then comes back without those fields, and no error is 
reported:
   
   | | before | after |
   | --- | --- | --- |
   | all access paths | `[S]`, `[s.city]` | `[S]` |
   | `SELECT S ... WHERE struct_element(S, 'City') = 'x'` | `Zip` is empty | 
full struct |
   
   Compare the path components case-insensitively, which is what BE does when 
it matches the root (`StringCaseEqual`) and the struct fields (`to_lower`). A 
column name that is all lower case was never affected.
   
   Only OLAP scans lose data. External and TVF file scans read the whole column 
either way, because `AccessPathParser` marks a one-component path as 
`project_all` and then ignores the finer paths.
   
   ### Release note
   
   Fix a struct/map column losing the fields that a predicate does not read 
when the column name is not all lower case.
   
   ### Check List (For Author)
   
   - Test
       - [x] 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. A sub-field predicate path is no longer added next to the 
whole-column path.
   
   - 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