chore: more info for i64-to-u128 panic message (#4881)

* chore: more info for i64-to-u128 panic message

* chore: Apply suggestions from code review

Co-authored-by: Dom <dom@itsallbroken.com>

* chore: fix fmt

Co-authored-by: Dom <dom@itsallbroken.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/24376/head
Nga Tran 2022-06-16 11:49:43 -04:00 committed by GitHub
parent c6bffac5d3
commit d57b0eb1fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -158,8 +158,12 @@ impl QueryChunk for QueryableParquetChunk {
// it is not safe to use it for sorting chunk
fn id(&self) -> ChunkId {
let timestamp_nano = self.min_time.get();
let timestamp_nano_u128 =
u128::try_from(timestamp_nano).expect("Cannot convert timestamp nano to u128 ");
let timestamp_nano_u128 = u128::try_from(timestamp_nano).unwrap_or_else(|_| {
panic!(
"Cannot convert timestamp nano to u128. Timestamp nano: {}, Paritition id: {}",
timestamp_nano, self.partition_id
)
});
ChunkId::new_id(timestamp_nano_u128)
}