|
1 | 1 | use crate::node_obj_deserializer::JsValueDeserializer; |
2 | 2 | use crate::transport::MapCubeErrExt; |
3 | 3 | 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}; |
7 | 5 | use cubeorchestrator::transport::{JsRawData, TransformDataRequest}; |
8 | 6 | use cubesql::compile::engine::df::scan::{FieldValue, ValueObject}; |
9 | 7 | use cubesql::CubeError; |
@@ -258,7 +256,12 @@ pub fn get_cubestore_result(mut cx: FunctionContext) -> JsResult<JsValue> { |
258 | 256 | let js_row = JsObject::new(&mut cx); |
259 | 257 | for (key, value) in result.columns.iter().zip(row.iter()) { |
260 | 258 | 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 | + |
262 | 265 | js_row.set(&mut cx, js_key, js_value)?; |
263 | 266 | } |
264 | 267 | Ok(js_row) |
|
0 commit comments