Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adriangb committed Aug 9, 2024
1 parent 8716fe5 commit ad14c2b
Showing 1 changed file with 101 additions and 101 deletions.
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 ad14c2b

Please sign in to comment.