iRakson commented on a change in pull request #27759: [SPARK-31008][SQL]Support
json_array_length function
URL: https://github.com/apache/spark/pull/27759#discussion_r388082157
##########
File path: sql/core/src/test/resources/sql-tests/inputs/json-functions.sql
##########
@@ -58,5 +58,16 @@ select schema_of_json('{"c1":01, "c2":0.1}',
map('allowNumericLeadingZeros', 'tr
select schema_of_json(null);
CREATE TEMPORARY VIEW jsonTable(jsonField, a) AS SELECT * FROM VALUES ('{"a":
1, "b": 2}', 'a');
SELECT schema_of_json(jsonField) FROM jsonTable;
+
+-- json_array_length
+select json_array_length('');
+select json_array_length('[]');
+select json_array_length('[1,2,3]');
+select json_array_length('[[1,2],[5,6,7]]');
+select json_array_length('[{"a":123},{"b":"hello"}]');
+select json_array_length('[1,2,3,[33,44],{"key":[2,3,4]}]');
+select json_array_length('{"key":"not a json array"}');
Review comment:
I agree on the fact that `json_length` is generic. I defined it
array-specific because most of the DBs support array-specific function only.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]