comphead commented on code in PR #307: URL: https://github.com/apache/datafusion-comet/pull/307#discussion_r1583665422
########## core/src/execution/datafusion/expressions/cast.rs: ########## @@ -64,6 +68,24 @@ pub struct Cast { pub timezone: String, } +macro_rules! cast_utf8_to_int { + ($array:expr, $eval_mode:expr, $array_type:ty, $cast_method:ident) => {{ + let len = $array.len(); + let mut cast_array = PrimitiveArray::<$array_type>::builder(len); + for i in 0..len { + if $array.is_null(i) { Review Comment: maybe it can be simplified to ``` if let Some(cast_value) = $cast_method($array.value(i).trim(), $eval_mode)? { cast_array.append_value(cast_value); } else { cast_array.append_null() } ``` -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org