From c74be4601c133a61a53895cf96e400689d185998 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Thu, 15 Aug 2024 03:19:31 -0500 Subject: [PATCH] Bump datafusion to v41 (#34) Co-authored-by: David Hewitt --- Cargo.toml | 14 ++-- tests/main.rs | 202 +++++++++++++++++++++++++------------------------- 2 files changed, 108 insertions(+), 108 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 32c8f0c..a1f5e88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "datafusion-functions-json" -version = "0.40.0" +version = "0.41.0" edition = "2021" description = "JSON functions for DataFusion" readme = "README.md" @@ -11,11 +11,11 @@ repository = "https://github.com/datafusion-contrib/datafusion-functions-json/" rust-version = "1.76.0" [dependencies] -arrow = "52.1.0" -arrow-schema = "52.1.0" -datafusion-common = "40" -datafusion-expr = "40" -datafusion-execution = "40" +arrow = "52.2" +arrow-schema = "52.2" +datafusion-common = "41" +datafusion-expr = "41" +datafusion-execution = "41" jiter = "0.5" paste = "1" log = "0.4" @@ -23,7 +23,7 @@ log = "0.4" [dev-dependencies] codspeed-criterion-compat = "2.3" criterion = "0.5.1" -datafusion = "40" +datafusion = "41" clap = "4" tokio = { version = "1.37", features = ["full"] } diff --git a/tests/main.rs b/tests/main.rs index 1bbd85c..60933d3 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -733,17 +733,17 @@ async fn test_arrow() { let batches = run_query("select name, json_data->'foo' from test").await.unwrap(); let expected = [ - "+------------------+--------------------------+", - "| name | json_data -> Utf8(\"foo\") |", - "+------------------+--------------------------+", - "| object_foo | {str=abc} |", - "| object_foo_array | {array=[1]} |", - "| object_foo_obj | {object={}} |", - "| object_foo_null | {null=} |", - "| object_bar | {null=} |", - "| list_foo | {null=} |", - "| invalid_json | {null=} |", - "+------------------+--------------------------+", + "+------------------+-------------------------------+", + "| name | test.json_data -> Utf8(\"foo\") |", + "+------------------+-------------------------------+", + "| object_foo | {str=abc} |", + "| object_foo_array | {array=[1]} |", + "| object_foo_obj | {object={}} |", + "| object_foo_null | {null=} |", + "| object_bar | {null=} |", + "| list_foo | {null=} |", + "| invalid_json | {null=} |", + "+------------------+-------------------------------+", ]; assert_batches_eq!(expected, &batches); } @@ -753,7 +753,7 @@ async fn test_plan_arrow() { let lines = logical_plan(r#"explain select json_data->'foo' from test"#).await; let expected = [ - "Projection: json_get(test.json_data, Utf8(\"foo\")) AS json_data -> Utf8(\"foo\")", + "Projection: json_get(test.json_data, Utf8(\"foo\")) AS test.json_data -> Utf8(\"foo\")", " TableScan: test projection=[json_data]", ]; @@ -765,17 +765,17 @@ async fn test_long_arrow() { let batches = run_query("select name, json_data->>'foo' from test").await.unwrap(); let expected = [ - "+------------------+---------------------------+", - "| name | json_data ->> Utf8(\"foo\") |", - "+------------------+---------------------------+", - "| object_foo | abc |", - "| object_foo_array | [1] |", - "| object_foo_obj | {} |", - "| object_foo_null | |", - "| object_bar | |", - "| list_foo | |", - "| invalid_json | |", - "+------------------+---------------------------+", + "+------------------+--------------------------------+", + "| name | test.json_data ->> Utf8(\"foo\") |", + "+------------------+--------------------------------+", + "| object_foo | abc |", + "| object_foo_array | [1] |", + "| object_foo_obj | {} |", + "| object_foo_null | |", + "| object_bar | |", + "| list_foo | |", + "| invalid_json | |", + "+------------------+--------------------------------+", ]; assert_batches_eq!(expected, &batches); } @@ -785,7 +785,7 @@ async fn test_plan_long_arrow() { let lines = logical_plan(r#"explain select json_data->>'foo' from test"#).await; let expected = [ - "Projection: json_as_text(test.json_data, Utf8(\"foo\")) AS json_data ->> Utf8(\"foo\")", + "Projection: json_as_text(test.json_data, Utf8(\"foo\")) AS test.json_data ->> Utf8(\"foo\")", " TableScan: test projection=[json_data]", ]; @@ -799,17 +799,17 @@ async fn test_long_arrow_eq_str() { .unwrap(); let expected = [ - "+------------------+-----------------------------------------+", - "| name | json_data ->> Utf8(\"foo\") = Utf8(\"abc\") |", - "+------------------+-----------------------------------------+", - "| object_foo | true |", - "| object_foo_array | false |", - "| object_foo_obj | false |", - "| object_foo_null | |", - "| object_bar | |", - "| list_foo | |", - "| invalid_json | |", - "+------------------+-----------------------------------------+", + "+------------------+----------------------------------------------+", + "| name | test.json_data ->> Utf8(\"foo\") = Utf8(\"abc\") |", + "+------------------+----------------------------------------------+", + "| object_foo | true |", + "| object_foo_array | false |", + "| object_foo_obj | false |", + "| object_foo_null | |", + "| object_bar | |", + "| list_foo | |", + "| invalid_json | |", + "+------------------+----------------------------------------------+", ]; assert_batches_eq!(expected, &batches); } @@ -836,7 +836,7 @@ async fn test_plan_arrow_cast_int() { let lines = logical_plan(r#"explain select (json_data->'foo')::int from test"#).await; let expected = [ - "Projection: json_get_int(test.json_data, Utf8(\"foo\")) AS json_data -> Utf8(\"foo\")", + "Projection: json_get_int(test.json_data, Utf8(\"foo\")) AS test.json_data -> Utf8(\"foo\")", " TableScan: test projection=[json_data]", ]; @@ -848,17 +848,17 @@ async fn test_arrow_double_nested() { let batches = run_query("select name, json_data->'foo'->0 from test").await.unwrap(); let expected = [ - "+------------------+--------------------------------------+", - "| name | json_data -> Utf8(\"foo\") -> Int64(0) |", - "+------------------+--------------------------------------+", - "| object_foo | {null=} |", - "| object_foo_array | {int=1} |", - "| object_foo_obj | {null=} |", - "| object_foo_null | {null=} |", - "| object_bar | {null=} |", - "| list_foo | {null=} |", - "| invalid_json | {null=} |", - "+------------------+--------------------------------------+", + "+------------------+-------------------------------------------+", + "| name | test.json_data -> Utf8(\"foo\") -> Int64(0) |", + "+------------------+-------------------------------------------+", + "| object_foo | {null=} |", + "| object_foo_array | {int=1} |", + "| object_foo_obj | {null=} |", + "| object_foo_null | {null=} |", + "| object_bar | {null=} |", + "| list_foo | {null=} |", + "| invalid_json | {null=} |", + "+------------------+-------------------------------------------+", ]; assert_batches_eq!(expected, &batches); } @@ -868,7 +868,7 @@ async fn test_plan_arrow_double_nested() { let lines = logical_plan(r#"explain select json_data->'foo'->0 from test"#).await; let expected = [ - "Projection: json_get(test.json_data, Utf8(\"foo\"), Int64(0)) AS json_data -> Utf8(\"foo\") -> Int64(0)", + "Projection: json_get(test.json_data, Utf8(\"foo\"), Int64(0)) AS test.json_data -> Utf8(\"foo\") -> Int64(0)", " TableScan: test projection=[json_data]", ]; @@ -882,17 +882,17 @@ async fn test_arrow_double_nested_cast() { .unwrap(); let expected = [ - "+------------------+--------------------------------------+", - "| name | json_data -> Utf8(\"foo\") -> Int64(0) |", - "+------------------+--------------------------------------+", - "| object_foo | |", - "| object_foo_array | 1 |", - "| object_foo_obj | |", - "| object_foo_null | |", - "| object_bar | |", - "| list_foo | |", - "| invalid_json | |", - "+------------------+--------------------------------------+", + "+------------------+-------------------------------------------+", + "| name | test.json_data -> Utf8(\"foo\") -> Int64(0) |", + "+------------------+-------------------------------------------+", + "| object_foo | |", + "| object_foo_array | 1 |", + "| object_foo_obj | |", + "| object_foo_null | |", + "| object_bar | |", + "| list_foo | |", + "| invalid_json | |", + "+------------------+-------------------------------------------+", ]; assert_batches_eq!(expected, &batches); } @@ -902,7 +902,7 @@ async fn test_plan_arrow_double_nested_cast() { let lines = logical_plan(r#"explain select (json_data->'foo'->0)::int from test"#).await; let expected = [ - "Projection: json_get_int(test.json_data, Utf8(\"foo\"), Int64(0)) AS json_data -> Utf8(\"foo\") -> Int64(0)", + "Projection: json_get_int(test.json_data, Utf8(\"foo\"), Int64(0)) AS test.json_data -> Utf8(\"foo\") -> Int64(0)", " TableScan: test projection=[json_data]", ]; @@ -953,17 +953,17 @@ async fn test_lexical_precedence_wrong() { #[tokio::test] async fn test_question_mark_contains() { let expected = [ - "+------------------+-------------------------+", - "| name | json_data ? Utf8(\"foo\") |", - "+------------------+-------------------------+", - "| object_foo | true |", - "| object_foo_array | true |", - "| object_foo_obj | true |", - "| object_foo_null | true |", - "| object_bar | false |", - "| list_foo | false |", - "| invalid_json | false |", - "+------------------+-------------------------+", + "+------------------+------------------------------+", + "| name | test.json_data ? Utf8(\"foo\") |", + "+------------------+------------------------------+", + "| object_foo | true |", + "| object_foo_array | true |", + "| object_foo_obj | true |", + "| object_foo_null | true |", + "| object_bar | false |", + "| list_foo | false |", + "| invalid_json | false |", + "+------------------+------------------------------+", ]; let batches = run_query("select name, json_data ? 'foo' from test").await.unwrap(); @@ -1056,17 +1056,17 @@ async fn test_arrow_union_is_null() { .unwrap(); let expected = [ - "+------------------+----------------------------------+", - "| name | json_data -> Utf8(\"foo\") IS NULL |", - "+------------------+----------------------------------+", - "| object_foo | false |", - "| object_foo_array | false |", - "| object_foo_obj | false |", - "| object_foo_null | true |", - "| object_bar | true |", - "| list_foo | true |", - "| invalid_json | true |", - "+------------------+----------------------------------+", + "+------------------+---------------------------------------+", + "| name | test.json_data -> Utf8(\"foo\") IS NULL |", + "+------------------+---------------------------------------+", + "| object_foo | false |", + "| object_foo_array | false |", + "| object_foo_obj | false |", + "| object_foo_null | true |", + "| object_bar | true |", + "| list_foo | true |", + "| invalid_json | true |", + "+------------------+---------------------------------------+", ]; assert_batches_eq!(expected, &batches); } @@ -1078,17 +1078,17 @@ async fn test_arrow_union_is_not_null() { .unwrap(); let expected = [ - "+------------------+--------------------------------------+", - "| name | json_data -> Utf8(\"foo\") IS NOT NULL |", - "+------------------+--------------------------------------+", - "| object_foo | true |", - "| object_foo_array | true |", - "| object_foo_obj | true |", - "| object_foo_null | false |", - "| object_bar | false |", - "| list_foo | false |", - "| invalid_json | false |", - "+------------------+--------------------------------------+", + "+------------------+-------------------------------------------+", + "| name | test.json_data -> Utf8(\"foo\") IS NOT NULL |", + "+------------------+-------------------------------------------+", + "| object_foo | true |", + "| object_foo_array | true |", + "| object_foo_obj | true |", + "| object_foo_null | false |", + "| object_bar | false |", + "| list_foo | false |", + "| invalid_json | false |", + "+------------------+-------------------------------------------+", ]; assert_batches_eq!(expected, &batches); } @@ -1119,14 +1119,14 @@ async fn test_long_arrow_cast() { let batches = run_query("select (json_data->>'foo')::int from other").await.unwrap(); let expected = [ - "+---------------------------+", - "| json_data ->> Utf8(\"foo\") |", - "+---------------------------+", - "| 42 |", - "| 42 |", - "| |", - "| |", - "+---------------------------+", + "+---------------------------------+", + "| other.json_data ->> Utf8(\"foo\") |", + "+---------------------------------+", + "| 42 |", + "| 42 |", + "| |", + "| |", + "+---------------------------------+", ]; assert_batches_eq!(expected, &batches); }