tustvold commented on code in PR #2846:
URL: https://github.com/apache/arrow-rs/pull/2846#discussion_r990606974


##########
arrow/src/compute/kernels/cast.rs:
##########
@@ -1329,30 +1321,13 @@ pub fn cast_with_options(
             let converted = if from_size >= to_size {
                 divide_scalar(&time_array, from_size / to_size)?
             } else {
-                multiply(
-                    &time_array,
-                    &Int64Array::from(vec![to_size / from_size; array.len()]),
-                )?
+                multiply_scalar(&time_array, to_size / from_size)?
             };
-            let array_ref = Arc::new(converted) as ArrayRef;
-            use TimeUnit::*;
-            match to_unit {
-                Second => {
-                    cast_array_data::<TimestampSecondType>(&array_ref, 
to_type.clone())
-                }
-                Millisecond => cast_array_data::<TimestampMillisecondType>(
-                    &array_ref,
-                    to_type.clone(),
-                ),
-                Microsecond => cast_array_data::<TimestampMicrosecondType>(
-                    &array_ref,
-                    to_type.clone(),
-                ),
-                Nanosecond => cast_array_data::<TimestampNanosecondType>(
-                    &array_ref,
-                    to_type.clone(),
-                ),
-            }
+            Ok(make_timestamp_array(
+                &converted,
+                to_unit.clone(),
+                to_tz.clone(),
+            ))

Review Comment:
   Not sure, the values should be UTC. Regardless this was the prior behaviour 
and there is a ticket already taking this



-- 
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...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to