andygrove commented on code in PR #335: URL: https://github.com/apache/datafusion-comet/pull/335#discussion_r1586743530
########## core/src/execution/datafusion/expressions/cast.rs: ########## @@ -86,6 +89,24 @@ macro_rules! cast_utf8_to_int { }}; } +macro_rules! cast_utf8_to_timestamp { + ($array:expr, $eval_mode:expr, $array_type:ty, $cast_method:ident) => {{ + let len = $array.len(); + let mut cast_array = PrimitiveArray::<$array_type>::builder(len).with_timezone("UTC"); + for i in 0..len { + if $array.is_null(i) { + cast_array.append_null() + } else if let Ok(Some(cast_value)) = $cast_method($array.value(i).trim(), $eval_mode) { + cast_array.append_value(cast_value); + } else { + cast_array.append_null() + } + } + let result: CometResult<ArrayRef> = Ok(Arc::new(cast_array.finish()) as ArrayRef); + result.unwrap() Review Comment: We can remove the `unwrap` here: ```suggestion let result: ArrayRef = Arc::new(cast_array.finish()) as ArrayRef; result ``` -- 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