You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yin Huai (JIRA)" <ji...@apache.org> on 2015/09/21 23:52:04 UTC

[jira] [Created] (SPARK-10737) When using UnsafeRow, SortMergeJoin may return wrong results

Yin Huai created SPARK-10737:
--------------------------------

             Summary: When using UnsafeRow, SortMergeJoin may return wrong results
                 Key: SPARK-10737
                 URL: https://issues.apache.org/jira/browse/SPARK-10737
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 1.5.0
            Reporter: Yin Huai
            Assignee: Yin Huai
            Priority: Blocker


{code}
val df1 = (1 to 10).map(i => (s"str_$i", i)).toDF("i", "j")
val df2 =
  df1
  .join(df1.select(df1("i")), "i")
  .select(df1("i"), df1("j"))

val df3 = df2.withColumnRenamed("i", "i1").withColumnRenamed("j", "j1")
val df4 =
  df2
  .join(df3, df2("i") === df3("i1"))
  .withColumn("diff", $"j" - $"j1")

df4.show(100, false)

+------+---+------+---+----+
|i     |j  |i1    |j1 |diff|
+------+---+------+---+----+
|str_2 |2  |str_2 |2  |0   |
|str_7 |7  |str_2 |2  |5   |
|str_10|10 |str_10|10 |0   |
|str_3 |3  |str_3 |3  |0   |
|str_8 |8  |str_3 |3  |5   |
|str_4 |4  |str_4 |4  |0   |
|str_9 |9  |str_4 |4  |5   |
|str_5 |5  |str_5 |5  |0   |
|str_1 |1  |str_1 |1  |0   |
|str_6 |6  |str_1 |1  |5   |
+------+---+------+---+----+

{code}



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