alamb commented on code in PR #10396:
URL: https://github.com/apache/arrow-rs/pull/10396#discussion_r3651155410
##########
arrow-cast/src/parse.rs:
##########
@@ -445,7 +445,10 @@ pub trait Parser: ArrowPrimitiveType {
impl Parser for Float16Type {
fn parse(string: &str) -> Option<f16> {
- let string = truncate_white_space(string);
+ if let Ok(raw_float) = lexical_core::parse(string.as_bytes()) {
+ return Some(f16::from_f32(raw_float));
+ }
+ let string = trim_pre_and_post_whitespace(string);
Review Comment:
this is a good strategy -- try the common/ fast path first and then fallback
to checking whitespace afterwards
--
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]