andygrove commented on code in PR #3248:
URL: https://github.com/apache/datafusion-comet/pull/3248#discussion_r2729328056
##########
native/spark-expr/src/conversion_funcs/cast.rs:
##########
@@ -2351,73 +2347,98 @@ fn parse_string_to_decimal(s: &str, precision: u8,
scale: i8) -> SparkResult<Opt
return Ok(None);
}
- // validate and parse mantissa and exponent
- match parse_decimal_str(trimmed) {
- Ok((mantissa, exponent)) => {
- // Convert to target scale
- let target_scale = scale as i32;
- let scale_adjustment = target_scale - exponent;
+ // validate and parse mantissa and exponent or bubble up the error
+ let (mantissa, exponent) = parse_decimal_str(
+ trimmed,
+ input_str,
+ "STRING",
+ &format!("DECIMAL({},{})", precision, scale),
Review Comment:
do we need to allocate this string here with the `format!`? It looks like
this string is only used when an error occurs?
Can you share benchmarks showing before/after these 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]