-
Notifications
You must be signed in to change notification settings - Fork 304
Feat: to_json Infinity/-Infinity Nan values support #3875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 40 commits
768b3e9
c68c342
d887555
231aa90
9500bbb
9577481
3791557
7c2f082
609a605
a151b2c
ad3e7f5
ea92e4b
8dfeca3
559741e
ebda14e
408152e
d7857b2
aef41be
5ac1c58
9ae8e23
5ca3888
160a817
88fc313
e14c180
610a885
f8acb2c
ec94897
43405e4
47b4915
26e2682
6cb5f07
ec194fb
e0a02bf
c322014
256fccb
2dce727
c7bf49f
912c8f9
561a664
931b5d4
14a92f7
d926ef4
671412c
49424d1
57f2ccf
c9f52d1
67f72d9
84e50fa
5284b2a
314e594
3c6a3dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,14 +16,22 @@ | |
| -- under the License. | ||
|
|
||
| statement | ||
| CREATE TABLE test_to_json(a int, b string) USING parquet | ||
| CREATE TABLE test_to_json(a int, b string, f float, d double) USING parquet | ||
|
|
||
| statement | ||
| INSERT INTO test_to_json VALUES (1, 'hello'), (NULL, NULL), (0, '') | ||
| INSERT INTO test_to_json VALUES (1, 'hello', cast('NaN' as float), cast('Infinity' as double)), (NULL, NULL, NULL, NULL), (0, '', 0.0, 0.0) | ||
|
|
||
| query spark_answer_only | ||
| SELECT to_json(named_struct('a', a, 'b', b)) FROM test_to_json | ||
| SELECT to_json(named_struct('a', a, 'b', b, 'f', f, 'd', d)) FROM test_to_json | ||
|
|
||
| -- literal arguments | ||
| query spark_answer_only | ||
| SELECT to_json(named_struct('a', 1, 'b', 'hello')) | ||
|
|
||
| -- query expect_fallback(StructsToJson with options is not supported) | ||
| query ignore("Need support Spark 4.0.0") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm does this include +/- Inf and Nan cases?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, added. |
||
| SELECT to_json(named_struct('a', a, 'b', b), map('timestampFormat', 'dd/MM/yyyy')) | ||
|
|
||
| -- query expect_fallback(Struct type: StructType(StructField(a,ArrayType(IntegerType,false),false)) contains unsupported types) | ||
| query ignore("Need support Spark 4.0.0") | ||
| SELECT to_json(named_struct(a, array(b))) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you create a separate
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the branch from master and updated the tests. |
||
Uh oh!
There was an error while loading. Please reload this page.