diff --git a/rust/cubesql/cubesql/src/compile/engine/df/scan.rs b/rust/cubesql/cubesql/src/compile/engine/df/scan.rs index 9f8c4aabe4e59..11d7f03695d5f 100644 --- a/rust/cubesql/cubesql/src/compile/engine/df/scan.rs +++ b/rust/cubesql/cubesql/src/compile/engine/df/scan.rs @@ -1135,10 +1135,16 @@ pub fn transform_response( )) })?; // TODO switch parsing to microseconds - if timestamp.timestamp_millis() > (((1 as i64) << 62) / 1_000_000) { + if timestamp.timestamp_millis() > (((1i64) << 62) / 1_000_000) { builder.append_null()?; + } else if let Some(nanos) = timestamp.timestamp_nanos_opt() { + builder.append_value(nanos)?; } else { - builder.append_value(timestamp.timestamp_nanos_opt().unwrap())?; + log::error!( + "Unable to cast timestamp value to nanoseconds: {}", + timestamp.to_string() + ); + builder.append_null()?; } }, },