dongjoon-hyun 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_r403770169
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/JsonExpressionsSuite.scala
##########
@@ -790,4 +790,27 @@ class JsonExpressionsSuite extends SparkFunSuite with
ExpressionEvalHelper with
checkDecimalInfer(_, """struct<d:decimal(7,3)>""")
}
}
+
+ test("Length of JSON array") {
+ Seq(
+ ("""""", null),
+ ("""[1,2,3]""", 3),
+ ("""[]""", 0),
+ ("""[[1],[2,3],[]]""", 3),
+ ("""[{"a":123},{"b":"hello"}]""", 2),
+ ("""[1,2,3,[33,44],{"key":[2,3,4]}]""", 5),
+ ("""[1,2,3,4,5""", null),
+ ("""Random String""", null)
+ ).foreach{
Review comment:
nit. `).foreach{` -> `).foreach {`
----------------------------------------------------------------
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]