Skip to content

Commit

Permalink
Bump datafusion to v41 (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: David Hewitt <[email protected]>
  • Loading branch information
adriangb and davidhewitt authored Aug 15, 2024
1 parent 4ad1e9b commit c74be46
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 108 deletions.
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -11,19 +11,19 @@ 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"

[dev-dependencies]
codspeed-criterion-compat = "2.3"
criterion = "0.5.1"
datafusion = "40"
datafusion = "41"
clap = "4"
tokio = { version = "1.37", features = ["full"] }

Expand Down
202 changes: 101 additions & 101 deletions tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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]",
];

Expand All @@ -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);
}
Expand All @@ -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]",
];

Expand All @@ -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);
}
Expand All @@ -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]",
];

Expand All @@ -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);
}
Expand All @@ -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]",
];

Expand All @@ -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);
}
Expand All @@ -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]",
];

Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit c74be46

Please sign in to comment.