harshmotw-db commented on code in PR #46141: URL: https://github.com/apache/spark/pull/46141#discussion_r1574119555
########## sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/variant/variantExpressions.scala: ########## @@ -75,6 +75,36 @@ case class ParseJson(child: Expression) copy(child = newChild) } +// scalastyle:off line.size.limit +@ExpressionDescription( + usage = "_FUNC_(jsonStr) - Parse a JSON string as an Variant value. Returns null when the string is not valid JSON value.", + examples = """ + Examples: + > SELECT _FUNC_('{"a":1,"b":0.8}'); + {"a":1,"b":0.8} + """, + since = "4.0.0", + group = "variant_funcs" +) +// scalastyle:on line.size.limit +case class TryParseJson(expr: Expression, replacement: Expression) + extends RuntimeReplaceable with InheritAnalysisRules { + def this(child: Expression) = this(child, TryEval(ParseJson(child))) Review Comment: I understand. I have reimplemented it and made it similar to the implementation of the `try_variant_get` expression. -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org