Skip to content

Commit d1e23e0

Browse files
committed
test: check EXTRACT(EPOCH) on the reproducer from apache#26673.
1 parent 9e8b4b0 commit d1e23e0

1 file changed

Lines changed: 19 additions & 4 deletions

File tree

‎datafusion/sqllogictest/test_files/datetime/date_part.slt‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,10 +1185,25 @@ SELECT extract(epoch from arrow_cast(2147483647, 'Duration(Nanosecond)')),
11851185
----
11861186
2.147483647 2.147483648
11871187

1188-
query R
1189-
SELECT extract(epoch from timestamp '2025-01-01 00:00:12.923350' - timestamp '2025-01-01 00:00:00')
1190-
----
1191-
12.92335
1188+
# Reproducer from https://github.com/apache/datafusion/issues/26673: every row keeps its fraction.
1189+
# Before the fix, the rows at or above 2^31 ns (2.147483648 s) lost their fraction.
1190+
query TTR
1191+
SELECT description,
1192+
arrow_typeof(finished_at - started_at),
1193+
extract(epoch from finished_at - started_at)
1194+
FROM (VALUES
1195+
('1.25 seconds', timestamp '2025-01-01 00:00:00', timestamp '2025-01-01 00:00:01.250000'),
1196+
('2.10 seconds', timestamp '2025-01-01 00:00:00', timestamp '2025-01-01 00:00:02.100000'),
1197+
('2.50 seconds', timestamp '2025-01-01 00:00:00', timestamp '2025-01-01 00:00:02.500000'),
1198+
('4.763 seconds', timestamp '2025-01-01 00:00:00', timestamp '2025-01-01 00:00:04.763000'),
1199+
('12.923350 seconds', timestamp '2025-01-01 00:00:00', timestamp '2025-01-01 00:00:12.923350')
1200+
) AS t(description, started_at, finished_at)
1201+
----
1202+
1.25 seconds Duration(ns) 1.25
1203+
2.10 seconds Duration(ns) 2.1
1204+
2.50 seconds Duration(ns) 2.5
1205+
4.763 seconds Duration(ns) 4.763
1206+
12.923350 seconds Duration(ns) 12.92335
11921207

11931208
query R
11941209
SELECT extract(epoch from arrow_cast(2147483648, 'Duration(Microsecond)'))

0 commit comments

Comments
 (0)