Skip to content

Commit 4ea0740

Browse files
authored
fix(cubesql): fix unhandled timestamp unwrapping in df/transform_response (#8952)
1 parent 591a383 commit 4ea0740

File tree

1 file changed

+8
-2
lines changed
  • rust/cubesql/cubesql/src/compile/engine/df

1 file changed

+8
-2
lines changed

rust/cubesql/cubesql/src/compile/engine/df/scan.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,10 +1135,16 @@ pub fn transform_response<V: ValueObject>(
11351135
))
11361136
})?;
11371137
// TODO switch parsing to microseconds
1138-
if timestamp.timestamp_millis() > (((1 as i64) << 62) / 1_000_000) {
1138+
if timestamp.timestamp_millis() > (((1i64) << 62) / 1_000_000) {
11391139
builder.append_null()?;
1140+
} else if let Some(nanos) = timestamp.timestamp_nanos_opt() {
1141+
builder.append_value(nanos)?;
11401142
} else {
1141-
builder.append_value(timestamp.timestamp_nanos_opt().unwrap())?;
1143+
log::error!(
1144+
"Unable to cast timestamp value to nanoseconds: {}",
1145+
timestamp.to_string()
1146+
);
1147+
builder.append_null()?;
11421148
}
11431149
},
11441150
},

0 commit comments

Comments
 (0)