compiler-segfault opened a new pull request, #3634:
URL: https://github.com/apache/iceberg-rust/pull/3634

   ## Which issue does this PR close?
   
   - Closes #3626.
   
   ## What changes are included in this PR?
   
   `truncate[N]` truncates strings by Unicode code points, but the projection 
compared the literal length in UTF-8 bytes. A prefix of two code points and 
three bytes (`Év`) therefore looked as wide as `truncate[3]`, `STARTS WITH` was 
rewritten to `=`, and scans silently returned no rows. `NOT STARTS WITH` was 
affected the same way.
   
   The four comparisons in `Transform::strict_project` and 
`Transform::adjust_operator` now count code points for string literals; binary 
literals keep byte counting. The other evaluators 
(`inclusive_metrics_evaluator`, `row_group_metrics_evaluator`, 
`page_index_evaluator`) already use `chars().count()`.
   
   ## Are these changes tested?
   
   Two unit tests in `transform/truncate.rs` cover the inclusive and the strict 
projection for prefixes of two, three and four code points over `truncate[3]`. 
Both fail before the change (`city = "Év"` instead of `city STARTS WITH "Év"`) 
and pass with it. `cargo test -p iceberg --lib` passes: 2135 tests.
   
   ## AI Disclosure
   
   Diagnosis and patch were written with an AI assistant. I read the projection 
code paths and ran the full `iceberg` lib suite locally. Points worth a 
reviewer's attention: `strict_project` returns `None` for `STARTS WITH` when 
the prefix is wider than the truncate width (left unchanged, as it was), and 
binary literals are still compared in bytes, which matches `truncate_binary`.
   


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