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

   ### What problem does this PR solve?
   
   Issue Number: N/A
   
   Related PR: #63498, #68214
   
   Problem Summary:
   With low-cardinality optimization enabled, a query such as `SELECT 
length(varchar_column) FROM t` can fail with `NOT_IMPLEMENTED_ERROR: Method 
insert_offsets_from_lengths is not supported` when the storage reader only 
reads string offsets. `Schema::get_predicate_column_ptr()` creates a 
`ColumnDictI32`, but the dictionary decoder writes lengths to it without 
converting it to a string column.
   
   This is an adapted backport of #63498 to `branch-4.2`. The offset-only 
dictionary decoding path was introduced on this branch by #68214. Convert 
dictionary destinations before length insertion in both `next_batch()` and 
`read_by_rowids()`, matching the existing plain-page fallback. This branch 
already converts dictionaries to `ColumnString`, which implements 
`insert_offsets_from_lengths()`, so the removed `PredicateColumnType` 
implementation from the original PR is unnecessary.
   
   The original SQL regression suite and its generated result file are 
preserved unchanged. A BE unit test additionally covers both dictionary page 
formats, nullable/non-nullable destinations, empty/repeated strings, sequential 
batch appends, and rowid selection with a nonzero page ordinal.
   
   ### Release note
   
   Fix `length()` failing on dictionary-encoded string columns when 
low-cardinality and offset-only reading optimizations are combined.
   
   ### Check List (For Author)
   
   - Test:
     - clang-format 16.0.6 check and `git diff --check` passed.
     - Local ASAN BE unit-test build: validation in progress; this section will 
be updated with the result.
     - The upstream SQL regression suite is included unchanged; it has not been 
run against a local cluster.
   - Behavior changed: Yes. Valid string-length queries no longer fail on an 
unsupported dictionary-column operation.
   - Does this need documentation: No
   


-- 
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