From d57b0eb1fa694ec9ffe9093487ca5698edf1809c Mon Sep 17 00:00:00 2001 From: Nga Tran Date: Thu, 16 Jun 2022 11:49:43 -0400 Subject: [PATCH] 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 * chore: fix fmt Co-authored-by: Dom Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- compactor/src/query.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compactor/src/query.rs b/compactor/src/query.rs index f2668ec29a..0157ba1464 100644 --- a/compactor/src/query.rs +++ b/compactor/src/query.rs @@ -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) }