cloud-fan commented on code in PR #51190:
URL: https://github.com/apache/spark/pull/51190#discussion_r2155806797
##########
sql/core/src/test/resources/sql-tests/inputs/variant-field-extractions.sql:
##########
@@ -0,0 +1,13 @@
+-- Simple field extraction and type casting.
+select parse_json('{ "price": 5 }'):price;
+select parse_json('{ "price": 30 }'):price::decimal(5, 2);
+select parse_json('{ "price": 30 }'):price::string;
+-- Applying an invalid function.
+select parse_json('{ "price": 12345.678 }'):price::decimal(3, 2);
+-- Access field in an array and feed it into functions.
+select parse_json('{ "item": [ { "model" : "basic", "price" : 6.12 }, {
"model" : "medium", "price" : 9.24 } ] }'):item[0].price::double;
Review Comment:
let's test all the valid syntaxes, e.g. `ASTERISK`, brackets with string,
etc.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]