-
Notifications
You must be signed in to change notification settings - Fork 802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Faster utf8 validation #6668
base: master
Are you sure you want to change the base?
Faster utf8 validation #6668
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -679,9 +679,12 @@ impl ByteViewArrayDecoderDelta { | |
|
||
/// Check that `val` is a valid UTF-8 sequence | ||
pub fn check_valid_utf8(val: &[u8]) -> Result<()> { | ||
match std::str::from_utf8(val) { | ||
match simdutf8::basic::from_utf8(val) { | ||
Ok(_) => Ok(()), | ||
Err(e) => Err(general_err!("encountered non UTF-8 data: {}", e)), | ||
Err(_) => { | ||
let e = simdutf8::compat::from_utf8(val).unwrap_err(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We call compat There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the role of simdutf8::basic::from_utf8 and re-run with simdutf8::compat -- does this deserve a code comment? (at least the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same in offset_buffer.rs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I agree deserves some comments explaining why we rerun it in case of error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is a positive sentiment about using |
||
Err(general_err!("encountered non UTF-8 data: {}", e)) | ||
} | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be optional as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How mature is the library and its dependencies?
My random spike led me to https://github.com/rusticstuff/simdutf8/blob/main/src/implementation/aarch64/neon.rs#L16 and https://docs.rs/flexpect/latest/flexpect/ lacks documentation.
Should we help simdutf8 to bring it to arrow's maturity level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it is just some macro helper for clippy split off as crate / dependency. Doesn't seem too bad.