Skip to content

Commit 2a866bb

Browse files
committed
fix comm
1 parent 1571e8f commit 2a866bb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/expr/impl/src/scalar/extract.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,18 @@ fn extract_from_datelike(date: impl Datelike, unit: Unit) -> Decimal {
4242

4343
/// Extract field from `Timelike`.
4444
fn extract_from_timelike(time: impl Timelike, unit: Unit) -> Decimal {
45-
let usecs = || time.second() as u64 * 1_000_000_000 + time.nanosecond() as u64;
45+
let nanos = || time.second() as u64 * 1_000_000_000 + time.nanosecond() as u64;
4646
match unit {
4747
Hour => time.hour().into(),
4848
Minute => time.minute().into(),
49-
Second => Decimal::from_i128_with_scale(usecs() as i128, 9),
50-
Millisecond => Decimal::from_i128_with_scale(usecs() as i128, 6),
51-
Microsecond => Decimal::from_i128_with_scale(usecs() as i128, 3),
52-
Nanosecond => usecs().into(),
49+
Second => Decimal::from_i128_with_scale(nanos() as i128, 9),
50+
Millisecond => Decimal::from_i128_with_scale(nanos() as i128, 6),
51+
Microsecond => Decimal::from_i128_with_scale(nanos() as i128, 3),
52+
Nanosecond => nanos().into(),
5353
Epoch => {
54-
let usecs =
54+
let nanos =
5555
time.num_seconds_from_midnight() as u64 * 1_000_000_000 + time.nanosecond() as u64;
56-
Decimal::from_i128_with_scale(usecs as i128, 9)
56+
Decimal::from_i128_with_scale(nanos as i128, 9)
5757
}
5858
u => unreachable!("invalid unit {:?} for time", u),
5959
}

0 commit comments

Comments
 (0)