Skip to content

Commit 60037f5

Browse files
committed
test: make the low-end Iceberg rounding row reach the pre-epoch adjustment
i64::MIN + 775_807 ends in 999999 but lies 71_945_999_999 micros into its day and 3_545_999_999 into its hour, so a plain floor gave the same four values as the i64::MIN row. Use -290307-01-01T00:00:00.999999 instead, 999999 micros into the lowest year boundary in range, where all four transforms take the unit before. The expected values come from DateTimeUtil and Transforms in Iceberg 1.5.2, 1.8.1, 1.10.0 and 1.11.0.
1 parent d9d943c commit 60037f5

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎native/spark-expr/src/iceberg_funcs/temporal.rs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,15 @@ mod tests {
359359
// `(int)` narrowing wraps it exactly as `as i32` does.
360360
(i64::MAX, 292_277, 3_507_324, 106_751_991, -1_732_919_508),
361361
(i64::MIN, -292_278, -3_507_325, -106_751_992, 1_732_919_507),
362-
// The lowest `i64` that ends in 999999, where moving the value a second earlier would
363-
// overflow.
362+
// -290307-01-01T00:00:00.999999, 999999 micros into the lowest year boundary in
363+
// range, so all four take the unit before it. A floor gives -292_277, -3_507_324,
364+
// -106_751_981, and 1_732_919_752.
364365
(
365-
i64::MIN + 775_807,
366+
-106_751_981 * MICROS_PER_DAY + 999_999,
366367
-292_278,
367368
-3_507_325,
368-
-106_751_992,
369-
1_732_919_507,
369+
-106_751_982,
370+
1_732_919_751,
370371
),
371372
(
372373
8_000_000_000_000_000_000,

0 commit comments

Comments
 (0)