Jefffrey commented on code in PR #10907:
URL: https://github.com/apache/arrow-rs/pull/10907#discussion_r3886641381


##########
arrow-cast/src/cast/mod.rs:
##########
@@ -1818,32 +1818,48 @@ pub fn cast_with_options(
                 .unary::<_, Time64NanosecondType>(|x| x as i64 * (NANOSECONDS 
/ MILLISECONDS)),
         )),
 
-        (Time64(TimeUnit::Microsecond), Time32(TimeUnit::Second)) => 
Ok(Arc::new(
-            array
-                .as_primitive::<Time64MicrosecondType>()
-                .unary::<_, Time32SecondType>(|x| (x / MICROSECONDS) as i32),
-        )),
-        (Time64(TimeUnit::Microsecond), Time32(TimeUnit::Millisecond)) => 
Ok(Arc::new(
-            array
+        (Time64(TimeUnit::Microsecond), Time32(TimeUnit::Second)) => {
+            let array = array
                 .as_primitive::<Time64MicrosecondType>()
-                .unary::<_, Time32MillisecondType>(|x| (x / (MICROSECONDS / 
MILLISECONDS)) as i32),
-        )),
-        (Time64(TimeUnit::Microsecond), Time64(TimeUnit::Nanosecond)) => 
Ok(Arc::new(
-            array
+                .unary::<_, Int64Type>(|x| x / MICROSECONDS);
+            let array = cast_with_options(&array, &Int32, cast_options)?;

Review Comment:
   this way of doing unary into another cast means allocating this intermediate 
array; is it too much trouble to try do the cast in one unary?
   
   same for the other instances below



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

Reply via email to