zzzzming95 commented on code in PR #37636:
URL: https://github.com/apache/spark/pull/37636#discussion_r954891685
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/urlExpressions.scala:
##########
@@ -110,7 +110,12 @@ object UrlCodec {
}
def decode(src: UTF8String, enc: UTF8String): UTF8String = {
- UTF8String.fromString(URLDecoder.decode(src.toString, enc.toString))
+ try {
+ UTF8String.fromString(URLDecoder.decode(src.toString, enc.toString))
+ } catch {
+ case e: IllegalArgumentException =>
Review Comment:
`URLDecoder.decode(String s, String enc)` throw
`UnsupportedEncodingException` when the parameter `enc` is illegal, but in
spark, the `enc` parameter is automatically filled by spark and cannot be set
by the user (udf: url_decodez() only accepts one parameter). So I think there
is no need to handle `UnsupportedEncodingException` exception.
https://github.com/apache/spark/blob/7026b3c77cca6926289d7fbe10360f305f54321c/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/urlExpressions.scala#L90
--
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]