You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Kritsada Limpawatkul (Jira)" <ji...@apache.org> on 2020/07/09 09:21:00 UTC

[jira] [Commented] (SPARK-32240) UDF parse_url with a URL that contains pipe(|) will give incorrect result

    [ https://issues.apache.org/jira/browse/SPARK-32240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17154376#comment-17154376 ] 

Kritsada Limpawatkul commented on SPARK-32240:
----------------------------------------------

[https://stackoverflow.com/questions/57365841/spark-parse-url-does-not-work-with-pipes]
I see this StackOverflow link asked the same problem from last year.

> UDF parse_url with a URL that contains pipe(|) will give incorrect result
> -------------------------------------------------------------------------
>
>                 Key: SPARK-32240
>                 URL: https://issues.apache.org/jira/browse/SPARK-32240
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.4.4, 3.0.0
>            Reporter: Kritsada Limpawatkul
>            Priority: Major
>
> I try to get the host from the URL with the code below.
> {code:java}
> Seq(
>   "https://a.b.c/index.php?params1=a|b&params2=x",
>   "https://a.b.c/index.php?params1=a"
> )
>   .toDF("url")
>   .withColumn("host", callUDF("parse_url", $"url", lit("HOST")))
>   .show(false){code}
> The result of the code is as follows.
> {code:java}
> +---------------------------------------------+-----+
> |url                                          |host |
> +---------------------------------------------+-----+
> |https://a.b.c/index.php?params1=a|b&params2=x|null |
> |https://a.b.c/index.php?params1=a            |a.b.c|
> +---------------------------------------------+-----+
> {code}
> It seems like the host becomes null when the URL contains any pipe(|) character.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org