Skip to content

Commit

Permalink
fix: e2e tests for json
Browse files Browse the repository at this point in the history
  • Loading branch information
chloeminkyung committed Sep 20, 2023
1 parent 124d9c2 commit fe23da5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions dozer-sql/expression/src/json_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ impl JsonFunctionType {

if let Ok(json_value) = self.evaluate_json(json_input, path) {
match json_value {
JsonValue::Object(_) => Ok(Field::Null),
JsonValue::Array(_) => Ok(Field::Null),
JsonValue::Object(_) => Ok(Field::Json(JsonValue::Null)),
JsonValue::Array(_) => Ok(Field::Json(JsonValue::Null)),
JsonValue::String(val) => Ok(Field::Json(JsonValue::String(val))),
JsonValue::Bool(val) => Ok(Field::Json(JsonValue::Bool(val))),
JsonValue::Number(val) => Ok(Field::Json(JsonValue::Number(val))),
JsonValue::Null => Ok(Field::Null),
JsonValue::Null => Ok(Field::Json(JsonValue::Null)),
}
} else {
Ok(Field::Null)
Expand All @@ -89,10 +89,10 @@ impl JsonFunctionType {
match json_value {
JsonValue::Object(val) => Ok(Field::Json(JsonValue::Object(val))),
JsonValue::Array(val) => Ok(Field::Json(JsonValue::Array(val))),
JsonValue::String(_) => Ok(Field::Null),
JsonValue::Bool(_) => Ok(Field::Null),
JsonValue::Number(_) => Ok(Field::Null),
JsonValue::Null => Ok(Field::Null),
JsonValue::String(_) => Ok(Field::Json(JsonValue::Null)),
JsonValue::Bool(_) => Ok(Field::Json(JsonValue::Null)),
JsonValue::Number(_) => Ok(Field::Json(JsonValue::Null)),
JsonValue::Null => Ok(Field::Json(JsonValue::Null)),
}
} else {
Ok(Field::Null)
Expand Down
14 changes: 7 additions & 7 deletions dozer-sql/src/expression/tests/json_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn test_json_value_null() {
vec![Field::Json(json_val)],
);

assert_eq!(f, Field::Null);
assert_eq!(f, Field::Json(JsonValue::Null));
}

#[test]
Expand Down Expand Up @@ -165,7 +165,7 @@ fn test_json_query_null() {
.clone(),
vec![Field::Json(json_val)],
);
assert_eq!(f, Field::Null);
assert_eq!(f, Field::Json(JsonValue::Null));
}

#[test]
Expand Down Expand Up @@ -687,7 +687,7 @@ fn test_json_value_diff_1() {
vec![Field::Json(json_val)],
);

assert_eq!(f, Field::Null);
assert_eq!(f, Field::Json(JsonValue::Null));
}

#[test]
Expand Down Expand Up @@ -737,7 +737,7 @@ fn test_json_value_diff_2() {
vec![Field::Json(json_val)],
);

assert_eq!(f, Field::Null);
assert_eq!(f, Field::Json(JsonValue::Null));
}

#[test]
Expand All @@ -763,7 +763,7 @@ fn test_json_value_diff_3() {
vec![Field::Json(json_val.clone())],
);

assert_eq!(f, Field::Null);
assert_eq!(f, Field::Json(JsonValue::Null));

f = run_fct(
"SELECT JSON_VALUE(jsonInfo,'$.y') FROM users",
Expand Down Expand Up @@ -807,7 +807,7 @@ fn test_json_value_diff_4() {
vec![Field::Json(json_val.clone())],
);

assert_eq!(f, Field::Null);
assert_eq!(f, Field::Json(JsonValue::Null));

f = run_fct(
"SELECT JSON_VALUE(jsonInfo,'$.z') FROM users",
Expand Down Expand Up @@ -851,7 +851,7 @@ fn test_json_value_diff_5() {
vec![Field::Json(json_val.clone())],
);

assert_eq!(f, Field::Null);
assert_eq!(f, Field::Json(JsonValue::Null));

f = run_fct(
"SELECT JSON_VALUE(jsonInfo,'$.x[0]') FROM users",
Expand Down

0 comments on commit fe23da5

Please sign in to comment.