diff --git a/Cargo.toml b/Cargo.toml index 249d5e5..304872e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafusion-functions-json" -version = "0.54.2" +version = "0.55.0" edition = "2021" description = "JSON functions for DataFusion" readme = "README.md" @@ -8,10 +8,10 @@ license = "Apache-2.0" keywords = ["datafusion", "JSON", "SQL"] categories = ["database-implementations", "parsing"] repository = "https://github.com/datafusion-contrib/datafusion-functions-json/" -rust-version = "1.88.0" +rust-version = "1.94.0" [dependencies] -datafusion = { version = "54", default-features = false, features = [ +datafusion = { version = "55", default-features = false, features = [ "sql", ] } jiter = "0.15.0" @@ -21,7 +21,7 @@ serde_json = "1" [dev-dependencies] codspeed-criterion-compat = "2.6" -datafusion = { version = "54", default-features = false, features = [ +datafusion = { version = "55", default-features = false, features = [ "nested_expressions", "sql", ] } diff --git a/tests/main.rs b/tests/main.rs index d6711a6..7ee4bda 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -194,14 +194,26 @@ fn assert_json_field_metadata(metadata: &HashMap) { #[tokio::test] async fn test_json_get_equals() { - let e = run_query(r"select name, json_get(json_data, 'foo')='abc' from test") + // DataFusion 55 coerces the JSON union against the literal, so this plans and runs without an + // explicit cast, see https://github.com/apache/datafusion/issues/10180 + let batches = run_query(r"select name, json_get(json_data, 'foo')='abc' from test") .await - .unwrap_err(); + .unwrap(); - // see https://github.com/apache/datafusion/issues/10180 - assert!(e - .to_string() - .starts_with("Error during planning: Cannot infer common argument type for comparison operation Union")); + let expected = [ + "+------------------+----------------------------------------------------+", + "| name | json_get(test.json_data,Utf8(\"foo\")) = Utf8(\"abc\") |", + "+------------------+----------------------------------------------------+", + "| object_foo | true |", + "| object_foo_array | |", + "| object_foo_obj | |", + "| object_foo_null | |", + "| object_bar | |", + "| list_foo | |", + "| invalid_json | |", + "+------------------+----------------------------------------------------+", + ]; + assert_batches_eq!(expected, &batches); } #[tokio::test]