fix: handle multibyte characters in physical plan tree renderer - #24664
Open
rustyconover wants to merge 2 commits into
Open
fix: handle multibyte characters in physical plan tree renderer#24664rustyconover wants to merge 2 commits into
rustyconover wants to merge 2 commits into
Conversation
saadtajwar
approved these changes
Aug 25, 2026
saadtajwar
left a comment
Contributor
There was a problem hiding this comment.
Gotta love Rust 😆 this makes sense & LGTM!
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24664 +/- ##
=======================================
Coverage 81.44% 81.44%
=======================================
Files 1118 1118
Lines 399550 399568 +18
Branches 399550 399568 +18
=======================================
+ Hits 325398 325414 +16
+ Misses 55154 55153 -1
- Partials 18998 19001 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nuno-faria
reviewed
Aug 25, 2026
nuno-faria
left a comment
Contributor
There was a problem hiding this comment.
Thanks @rustyconover. Could you also add a sqllogictest at explain_tree.slt? Something like this which currently panics on main:
create table t (a varchar);
explain select * from t where a = '🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤🌤';
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
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 -- --checkcargo test -p datafusion-physical-plan --libcargo clippy -p datafusion-physical-plan --all-targets --all-features -- -D warningsAre there any user-facing changes?
EXPLAINoutput using the tree renderer no longer panics when rendered plan details contain multibyte UTF-8 characters. There are no public API changes.