MaxGekk commented on a change in pull request #28167: [SPARK-31106][SQL]
Support is_json function
URL: https://github.com/apache/spark/pull/28167#discussion_r406307986
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/JsonExpressionsSuite.scala
##########
@@ -853,4 +853,26 @@ class JsonExpressionsSuite extends SparkFunSuite with
ExpressionEvalHelper with
checkEvaluation(JsonObjectKeys(Literal(input)), expected)
}
}
+
+ test("is_json") {
+ Seq(
+ // valid JSON strings
+ ("", true),
+ ("{}", true),
+ ("[]", true),
+ ("[1, 2, 3]", true),
+ ("""{"key": 1}""", true),
+ ("""[1, 2, {"key" : "valid JSON array"}]""", true),
+ ("""{"k1": [1, 2, {"key": 5}], "k2": {"key2": [1, 2]}}""", true),
+ // invalid JSON strings
Review comment:
Can you check nested invalid JSON objects?
----------------------------------------------------------------
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]