andygrove commented on code in PR #627:
URL: https://github.com/apache/datafusion-comet/pull/627#discussion_r1670557442


##########
native/core/src/execution/datafusion/expressions/cast.rs:
##########
@@ -91,22 +92,24 @@ macro_rules! cast_utf8_to_int {
         result
     }};
 }
-
 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 {
+        let mut cast_array =
+            
PrimitiveArray::<$array_type>::builder($array.len()).with_timezone("UTC");
+
+        for i in 0..$array.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);
+                cast_array.append_null();
             } else {
-                cast_array.append_null()
+                let value = $array.value(i).trim();
+                match $cast_method(value, $eval_mode) {
+                    Ok(Some(cast_value)) => 
cast_array.append_value(cast_value),
+                    _ => cast_array.append_null(),
+                }
             }
         }
-        let result: ArrayRef = Arc::new(cast_array.finish()) as ArrayRef;
-        result
+
+        Arc::new(cast_array.finish()) as ArrayRef
     }};
 }

Review Comment:
   It looks like there is no functional change here and this seems unrelated to 
the goal of the PR. I think it would be better to remove this change from this 
PR.



-- 
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

Reply via email to