Skip to content

Commit 310d63b

Browse files
committed
fix(native): Handle null correctly as JsNull, not as JsString
1 parent 40b3708 commit 310d63b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use crate::node_obj_deserializer::JsValueDeserializer;
22
use crate::transport::MapCubeErrExt;
33
use cubeorchestrator::query_message_parser::QueryResult;
4-
use cubeorchestrator::query_result_transform::{
5-
DBResponsePrimitive, RequestResultData, RequestResultDataMulti, TransformedData,
6-
};
4+
use cubeorchestrator::query_result_transform::{DBResponsePrimitive, DBResponseValue, RequestResultData, RequestResultDataMulti, TransformedData};
75
use cubeorchestrator::transport::{JsRawData, TransformDataRequest};
86
use cubesql::compile::engine::df::scan::{FieldValue, ValueObject};
97
use cubesql::CubeError;
@@ -258,7 +256,12 @@ pub fn get_cubestore_result(mut cx: FunctionContext) -> JsResult<JsValue> {
258256
let js_row = JsObject::new(&mut cx);
259257
for (key, value) in result.columns.iter().zip(row.iter()) {
260258
let js_key = cx.string(key);
261-
let js_value = cx.string(value.to_string());
259+
let js_value: Handle<'_, JsValue> = match value {
260+
DBResponseValue::Primitive(DBResponsePrimitive::Null) => cx.null().upcast(),
261+
// For compatibility, we convert all primitives to strings
262+
other => cx.string(other.to_string()).upcast(),
263+
};
264+
262265
js_row.set(&mut cx, js_key, js_value)?;
263266
}
264267
Ok(js_row)

0 commit comments

Comments
 (0)