Skip to content

Commit fcb5711

Browse files
authored
fix(cubeorchestrator): Fix incorrect null-values parsing from CubeStore Result (#9443)
1 parent 7172065 commit fcb5711

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

rust/cubeorchestrator/src/query_message_parser.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@ impl QueryResult {
8888
let values = row.values().ok_or(ParseError::NullRow)?;
8989
let row_obj: Vec<_> = values
9090
.iter()
91-
.map(|val| {
92-
DBResponseValue::Primitive(DBResponsePrimitive::String(
93-
val.string_value().unwrap_or("").to_owned(),
94-
))
91+
.map(|val| match val.string_value() {
92+
Some(s) => DBResponseValue::Primitive(DBResponsePrimitive::String(
93+
s.to_owned(),
94+
)),
95+
None => DBResponseValue::Primitive(DBResponsePrimitive::Null),
9596
})
9697
.collect();
9798

rust/cubeorchestrator/src/query_result_transform.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -905,8 +905,8 @@ mod tests {
905905
"e_commerce_records_us2021__count": "10"
906906
},
907907
{
908-
"e_commerce_records_us2021__order_date_day": "2020-01-02T00:00:00.000",
909-
"e_commerce_records_us2021__count": "8"
908+
"e_commerce_records_us2021__order_date_day": null,
909+
"e_commerce_records_us2021__count": null
910910
}
911911
],
912912
"finalResultDefault": [
@@ -917,10 +917,10 @@ mod tests {
917917
"compareDateRange": "2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999"
918918
},
919919
{
920-
"ECommerceRecordsUs2021.orderDate.day": "2020-01-02T00:00:00.000",
921-
"ECommerceRecordsUs2021.orderDate": "2020-01-02T00:00:00.000",
922-
"ECommerceRecordsUs2021.count": "8",
923-
"compareDateRange": "2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999"
920+
"ECommerceRecordsUs2021.orderDate.day": null,
921+
"ECommerceRecordsUs2021.orderDate": null,
922+
"ECommerceRecordsUs2021.count": null,
923+
"compareDateRange": null
924924
}
925925
],
926926
"finalResultCompact": {
@@ -938,9 +938,9 @@ mod tests {
938938
"2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999"
939939
],
940940
[
941-
"2020-01-02T00:00:00.000",
942-
"2020-01-02T00:00:00.000",
943-
"8",
941+
null,
942+
null,
943+
null,
944944
"2020-01-01T00:00:00.000 - 2020-01-31T23:59:59.999"
945945
]
946946
]
@@ -2319,15 +2319,15 @@ mod tests {
23192319
let members_map_expected = HashMap::from([
23202320
(
23212321
"ECommerceRecordsUs2021.orderDate.day".to_string(),
2322-
DBResponsePrimitive::String("2020-01-02T00:00:00.000".to_string()),
2322+
DBResponsePrimitive::Null,
23232323
),
23242324
(
23252325
"ECommerceRecordsUs2021.orderDate".to_string(),
2326-
DBResponsePrimitive::String("2020-01-02T00:00:00.000".to_string()),
2326+
DBResponsePrimitive::Null,
23272327
),
23282328
(
23292329
"ECommerceRecordsUs2021.count".to_string(),
2330-
DBResponsePrimitive::String("8".to_string()),
2330+
DBResponsePrimitive::Null,
23312331
),
23322332
(
23332333
"compareDateRange".to_string(),

0 commit comments

Comments
 (0)