You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dongjoon Hyun (JIRA)" <ji...@apache.org> on 2016/08/08 10:19:20 UTC

[jira] [Commented] (SPARK-14666) Using DISTINCT on a UDF (like CONCAT) is not supported

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

Dongjoon Hyun commented on SPARK-14666:
---------------------------------------

Hi, [~dricard].

The feature you requested is available in Spark 2.0 now. Could you try 2.0?
{code}
scala> spark.range(10).createOrReplaceTempView("t1")
scala> sql("select distinct concat(id, ' : ', id) from t1 order by concat(id, ' : ', id)").show()
+---------------------------------------------------+
|concat(CAST(id AS STRING),  : , CAST(id AS STRING))|
+---------------------------------------------------+
|                                              0 : 0|
|                                              1 : 1|
|                                              2 : 2|
|                                              3 : 3|
|                                              4 : 4|
|                                              5 : 5|
|                                              6 : 6|
|                                              7 : 7|
|                                              8 : 8|
|                                              9 : 9|
+---------------------------------------------------+
{code}

> Using DISTINCT on a UDF (like CONCAT) is not supported
> ------------------------------------------------------
>
>                 Key: SPARK-14666
>                 URL: https://issues.apache.org/jira/browse/SPARK-14666
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.6.1
>            Reporter: Dominic Ricard
>            Priority: Minor
>
> The following query fails with:
> {noformat}
> Java::JavaSql::SQLException: org.apache.spark.sql.AnalysisException: cannot resolve 'column_1' given input columns: [_c0]; line # pos ##
> {noformat}
> Query:
> {noformat}
> select
>   distinct concat(column_1, ' : ', column_2)
> from
>   table
> order by
>   concat(column_1, ' : ', column_2);
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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