spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cheng Lian (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SPARK-6319) DISTINCT doesn't work for binary type
Date Mon, 16 Mar 2015 10:06:38 GMT

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

Cheng Lian commented on SPARK-6319:
-----------------------------------

SPARK-5553 is somewhat related to this one. By reimplement the binary type with some more
efficient representation with a proper {{equalsTo}} method can fix this issue in a clean way.
Though we might not try to resolve SPARK-5553 right away.

> DISTINCT doesn't work for binary type
> -------------------------------------
>
>                 Key: SPARK-6319
>                 URL: https://issues.apache.org/jira/browse/SPARK-6319
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.0.2, 1.1.1, 1.3.0, 1.2.1
>            Reporter: Cheng Lian
>            Priority: Blocker
>
> Spark shell session for reproduction:
> {noformat}
> scala> import sqlContext.implicits._
> scala> import org.apache.spark.sql.types._
> scala> Seq(1, 1, 2, 2).map(i => Tuple1(i.toString)).toDF("c").select($"c" cast
BinaryType).distinct.show()
> ...
> CAST(c, BinaryType)
> [B@43f13160
> [B@5018b648
> [B@3be22500
> [B@476fc8a1
> {noformat}
> Spark SQL uses plain byte arrays to represent binary values. However, arrays are compared
by reference rather than by value. On the other hand, the DISTINCT operator uses a {{HashSet}}
and its {{.contains}} method to check for duplicated values. These two facts together cause
the problem.



--
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


Mime
View raw message