rustyconover opened a new pull request, #24664:
URL: https://github.com/apache/datafusion/pull/24664

   ## Which issue does this PR close?
   
   - Closes #24663.
   
   ## Rationale for this change
   
   Rendering a physical plan in tree format can panic when an operator name or 
detail contains multibyte UTF-8 characters. The renderer measures text in 
characters but previously used those character positions as byte offsets when 
slicing strings. Those offsets are not necessarily valid UTF-8 boundaries.
   
   ## What changes are included in this PR?
   
   Use character-based iteration consistently when truncating and wrapping text 
in the physical plan tree renderer. Also use the number of characters, rather 
than the number of bytes, when checking for remaining text.
   
   ## Are these changes tested?
   
   Yes. Unit tests cover both wrapping and truncating text containing multibyte 
characters.
   
   The following checks pass:
   
   - `cargo fmt --all -- --check`
   - `cargo test -p datafusion-physical-plan --lib`
   - `cargo clippy -p datafusion-physical-plan --all-targets --all-features -- 
-D warnings`
   
   ## Are there any user-facing changes?
   
   `EXPLAIN` output using the tree renderer no longer panics when rendered plan 
details contain multibyte UTF-8 characters. There are no public API changes.


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