Skip to content

Commit 09b42e3

Browse files
committed
[SPARK-52268] Add variant SQL test and answer file
### What changes were proposed in this pull request? This PR aims to add `variant` (SPARK-45891) SQL test and answer file with `parse_json` and `variant_get` methods. ### Why are the changes needed? To add a test coverage for Spark 4 feature. Note that this PR doesn't aim to cover `collect` with the serialization. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #167 from dongjoon-hyun/SPARK-52268. Authored-by: Dongjoon Hyun <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent c34744b commit 09b42e3

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM VALUES parse_json('{"a": true, "b": 1, "c": "swift"}') T(v)
2+
|> SELECT v,
3+
variant_get(v, '$.a', 'boolean') as a,
4+
variant_get(v, '$.b', 'int') as b,
5+
variant_get(v, '$.c', 'string') as c
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
+----------------------------+----+---+-----+
2+
| v| a| b| c|
3+
+----------------------------+----+---+-----+
4+
|{"a":true,"b":1,"c":"swift"}|true| 1|swift|
5+
+----------------------------+----+---+-----+

Tests/SparkConnectTests/SQLTests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ struct SQLTests {
8585
"create_table_function.sql",
8686
"pipesyntax.sql",
8787
"explain.sql",
88+
"variant.sql",
8889
]
8990

9091
#if !os(Linux)

0 commit comments

Comments
 (0)