maropu commented on a change in pull request #28167: [SPARK-31106][SQL] Support is_json function URL: https://github.com/apache/spark/pull/28167#discussion_r406651670
########## File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/jsonExpressions.scala ########## @@ -933,3 +933,58 @@ case class JsonObjectKeys(child: Expression) extends UnaryExpression with Codege new GenericArrayData(arrayBufferOfKeys.toArray) } } + +/** + * A function which checks whether the given JSON string is valid JSON string or not. + */ +@ExpressionDescription( + usage = """ + _FUNC_(json_string) - Returns `true` if `json_string` is valid JSON, `false` if `json_string` is + invalid. `NULL` is returned in case of `NULL`. + """, + examples = """ + Examples: + > Select _FUNC_(null); + NULL + > Select _FUNC_('{"key" : "valid JSON"}'); + true + > Select _FUNC_('{"invalid JSON"}'); Review comment: Could you add nested cases in the examples? ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org