wForget commented on code in PR #47294:
URL: https://github.com/apache/spark/pull/47294#discussion_r1681177341
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/urlExpressions.scala:
##########
@@ -106,6 +106,37 @@ case class UrlDecode(child: Expression)
override def prettyName: String = "url_decode"
}
+// scalastyle:off line.size.limit
+@ExpressionDescription(
+ usage = """
+ _FUNC_(str) - This is a special version of `url_decode` that performs the
same operation, but returns a NULL value instead of raising an error if the
decoding cannot be performed.
+ """,
+ arguments = """
+ Arguments:
+ * str - a string expression to decode
+ """,
+ examples = """
+ Examples:
+ > SELECT _FUNC_('https%3A%2F%2Fspark.apache.org');
+ https://spark.apache.org
+ """,
+ since = "4.0.0",
+ group = "url_funcs")
+// scalastyle:on line.size.limit
+case class TryUrlDecode(expr: Expression, replacement: Expression)
+ extends RuntimeReplaceable with InheritAnalysisRules {
+
+ def this(expr: Expression) = this(expr, TryEval(UrlDecode(expr)))
Review Comment:
@cloud-fan Thanks for your suggestion, I will make a follow up PR to improve
it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]