diff --git a/src/query/storages/common/table_meta/src/meta/utils.rs b/src/query/storages/common/table_meta/src/meta/utils.rs index 1a1e2a99351c0..07dc79dd73cb2 100644 --- a/src/query/storages/common/table_meta/src/meta/utils.rs +++ b/src/query/storages/common/table_meta/src/meta/utils.rs @@ -53,6 +53,11 @@ pub fn monotonically_increased_timestamp( pub fn uuid_from_date_time(ts: DateTime) -> Uuid { let seconds = ts.timestamp(); let nanos = ts.timestamp_subsec_nanos(); + // avoid overflow silently in release mode + let _ = seconds + .checked_mul(1000) + .unwrap() + .checked_add(nanos as i64 / 1_000); let uuid_ts = uuid::Timestamp::from_unix(NoContext, seconds as u64, nanos); Uuid::new_v7(uuid_ts) } diff --git a/src/query/storages/fuse/src/io/locations.rs b/src/query/storages/fuse/src/io/locations.rs index 41464be60879a..073257784c063 100644 --- a/src/query/storages/fuse/src/io/locations.rs +++ b/src/query/storages/fuse/src/io/locations.rs @@ -80,8 +80,7 @@ impl TableMetaLocationGenerator { &self, base_snapshot_timestamp: Option>, ) -> (Location, Uuid) { - let part_uuid = - uuid_from_date_time(base_snapshot_timestamp.unwrap_or(DateTime::::MIN_UTC)); + let part_uuid = uuid_from_date_time(base_snapshot_timestamp.unwrap_or_default()); let location_path = format!( "{}/{}/g{}{}_v{}.parquet", &self.prefix, @@ -111,8 +110,7 @@ impl TableMetaLocationGenerator { &self, base_snapshot_timestamp: Option>, ) -> String { - let segment_uuid = - uuid_from_date_time(base_snapshot_timestamp.unwrap_or(DateTime::::MIN_UTC)); + let segment_uuid = uuid_from_date_time(base_snapshot_timestamp.unwrap_or_default()); format!( "{}/{}/g{}_v{}.mpk", &self.prefix,