mbutrovich commented on code in PR #12422:
URL: https://github.com/apache/arrow-rs/pull/12422#discussion_r4680847808


##########
arrow-cast/tests/cast/date_time.rs:
##########
@@ -2723,3 +2723,64 @@ fn test_cast_temporal_scaling_boundaries() {
     check::<Date64Type, TimestampMicrosecondType>(MICROSECONDS / MILLISECONDS);
     check::<Date64Type, TimestampNanosecondType>(NANOSECONDS / MILLISECONDS);
 }
+
+#[test]
+fn test_cast_timestamp_and_duration_to_coarser_unit() {
+    // Truncates toward zero, as `/` does, and keeps nulls
+    let edges = [
+        i64::MIN,
+        i64::MIN + 1,
+        -1_000_000_001,
+        -1_000_000_000,
+        -999_999_999,
+        -1001,
+        -1000,
+        -999,
+        -1,
+        0,
+        1,
+        999,
+        1000,
+        1001,
+        999_999_999,
+        1_000_000_000,
+        1_000_000_001,
+        i64::MAX - 1,
+        i64::MAX,
+    ];
+    let values: Int64Array = edges
+        .into_iter()
+        .map(Some)
+        .chain([None])
+        .cycle()
+        .take(70)

Review Comment:
   It doesn't need to. The 19 edge values and the null already run both the 
loop that handles 8 values at a time and the tail after it, so I removed the 
repeat.



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