Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a3cb6da

Browse files
committedDec 30, 2024·
g This is a combination of 2 commits.
fix comm fix ci
1 parent 1571e8f commit a3cb6da

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

‎e2e_test/batch/types/timestamp_ns.slt.part

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ select v1, v2, coalesce(v2, '1900-01-01 00:00:00') as coalesce_v2 from t1;
5151
query T
5252
select count(v2) as total_rows from t1;
5353
----
54-
4
54+
5
5555

5656
query T rowsort
5757
select * from t1 order by v2;

‎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)
Please sign in to comment.