Skip to content

Commit 44bd455

Browse files
authored
fix(native): Don't fail deserializing JS numbers above u64/i64 range (#11034)
A JS number like 5.18e44 is integer-valued (fract() is always 0.0 for |value| >= 2^52, since an f64 has no fractional bits at that magnitude), so it skipped the float path, then failed to fit in any u64/i64 branch and hit "Unsupported number type for deserialization". Fall back to visit_f64 for such values instead of erroring. The value already arrived as an f64, so nothing is lost beyond JS's own precision.
1 parent 107e63f commit 44bd455

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/cubejs-backend-native/src/node_obj_deserializer.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ impl<'de> Deserializer<'de> for JsValueDeserializer<'_, '_> {
109109
return visitor.visit_i64(value as i64);
110110
}
111111

112-
Err(JsDeserializationError(
113-
"Unsupported number type for deserialization".to_string(),
114-
))
112+
// Integer-valued, but too large to fit in any i64/u64 (e.g. 5.18e44).
113+
// It originated as an f64 anyway, so keep it as one instead of failing.
114+
visitor.visit_f64(value)
115115
} else if self.value.is_a::<JsBoolean, _>(self.cx) {
116116
let value = self
117117
.value

0 commit comments

Comments
 (0)