[
https://issues.apache.org/jira/browse/SPARK-29969?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17047970#comment-17047970
]
YoungGyu Chun commented on SPARK-29969:
---------------------------------------
[~xiaoxigua] [~srowen] [~hyukjin.kwon] [~dongjoon]
I don't think it's a bug so we can close this ticket. I tried to decode the URL
provided but it shows errors:
{code:java}
String testURL =
"http://uzzf.down.gsxzq.com/download/%E5%B8%B8%E7%94%A8%E9%98%80%E9%97%A8CAD%E5%9B%BE%E7%BA%B8%E5%A4%";
System.out.println("decode: " + URLDecoder.decode(testURL));
{code}
Errors:
{code:java}
Exception in thread "main" java.lang.IllegalArgumentException: URLDecoder:
Incomplete trailing escape (%) pattern
at java.net.URLDecoder.decode(URLDecoder.java:187)
at java.net.URLDecoder.decode(URLDecoder.java:100)
at Main.main(Main.java:45)
{code}
I think the URL is incomplete as it has an extra "%" at the end and ran it
without an extra "%". It works without an issue:
{code:java}
String testURL =
"http://uzzf.down.gsxzq.com/download/%E5%B8%B8%E7%94%A8%E9%98%80%E9%97%A8CAD%E5%9B%BE%E7%BA%B8%E5%A4";
System.out.println("decode: " + URLDecoder.decode(testURL));
URI uriBase = new URI(testURL);
System.out.println("host = " + uriBase.getHost());
{code}
Result:
{code:java}
decode: http://uzzf.down.gsxzq.com/download/常用阀门CAD图纸�
host = uzzf.down.gsxzq.com
{code}
> parse_url function result in incorrect result
> ---------------------------------------------
>
> Key: SPARK-29969
> URL: https://issues.apache.org/jira/browse/SPARK-29969
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 2.3.1, 2.4.4
> Reporter: Victor Zhang
> Priority: Major
> Attachments: hive-result.jpg, spark-result.jpg
>
>
> In this Jira using java.net.URI instead of java.net.URL for performance
> reason.
> https://issues.apache.org/jira/browse/SPARK-16826
> However, in the case of some unconventional parameters, it can lead to
> incorrect results.
> For example, when the URL is encoded, the function cannot resolve the correct
> result.
>
> {code}
> 0: jdbc:hive2://localhost:10000> SELECT
> parse_url('http://uzzf.down.gsxzq.com/download/%E5%B8%B8%E7%94%A8%E9%98%80%E9%97%A8CAD%E5%9B%BE%E7%BA%B8%E5%A4%',
> 'HOST');
> +------------------------------------------------------------------------------------------------------------------------+--+
> |
> parse_url(http://uzzf.down.gsxzq.com/download/%E5%B8%B8%E7%94%A8%E9%98%80%E9%97%A8CAD%E5%9B%BE%E7%BA%B8%E5%A4%,
> HOST) |
> +------------------------------------------------------------------------------------------------------------------------+--+
> | NULL |
> +------------------------------------------------------------------------------------------------------------------------+--+
> 1 row selected (0.094 seconds)
>
> hive> SELECT
> parse_url('http://uzzf.down.gsxzq.com/download/%E5%B8%B8%E7%94%A8%E9%98%80%E9%97%A8CAD%E5%9B%BE%E7%BA%B8%E5%A4%',
> 'HOST');
> OK
> HEADER: _c0
> uzzf.down.gsxzq.com
> Time taken: 4.423 seconds, Fetched: 1 row(s)
> {code}
>
> Here's a similar problem.
> https://issues.apache.org/jira/browse/SPARK-23056
> Our team used the spark function to run data for months, but now we have to
> run it again.
> It's just too painful.:(:(:(
>
>
>
>
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]