Skip to content

Commit aaf50ea

Browse files
committed
fix: prefer higher-precision time unit in supertype computation
The get_time_units function was selecting the wrong time unit when comparing timestamps with different precisions (e.g., Microseconds vs Milliseconds). Fix it to always return the higher-precision unit (Nanoseconds > Microseconds > Milliseconds).
1 parent 0649bc9 commit aaf50ea

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/daft-core/src/utils/supertype.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use crate::datatypes::{DataType, TimeUnit};
1010

1111
fn get_time_units(tu_l: &TimeUnit, tu_r: &TimeUnit) -> TimeUnit {
1212
match (tu_l, tu_r) {
13-
(TimeUnit::Nanoseconds, TimeUnit::Microseconds) => TimeUnit::Microseconds,
14-
(_, TimeUnit::Milliseconds) => TimeUnit::Milliseconds,
15-
_ => *tu_l,
13+
(TimeUnit::Nanoseconds, _) | (_, TimeUnit::Nanoseconds) => TimeUnit::Nanoseconds,
14+
(TimeUnit::Microseconds, _) | (_, TimeUnit::Microseconds) => TimeUnit::Microseconds,
15+
_ => TimeUnit::Milliseconds,
1616
}
1717
}
1818

0 commit comments

Comments
 (0)