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

Josh Rosen commented on SPARK-17618:
------------------------------------

It looks like this affects 1.6.2 as well, but I was unable to reproduce in 2.x.

Comparing the two physical plans, I wonder if the issue has to do with Tungsten 
vs. regular internal row formats.

For {{t1.except(t3).explain(true)}}:

{code}
== Physical Plan ==
Except
:- Scan ExistingRDD[test#35] 
+- ConvertToSafe
   +- LeftSemiJoinHash [test#35], [test#36], None
      :- TungstenExchange hashpartitioning(test#35,200), None
      :  +- ConvertToUnsafe
      :     +- Scan ExistingRDD[test#35] 
      +- TungstenExchange hashpartitioning(test#36,200), None
         +- ConvertToUnsafe
            +- Scan ExistingRDD[test#36]
{code}

whereas {{t1.coalesce(8).except(t3.coalesce(8)).explain(true)}} produces

{code}
Except
:- Coalesce 8
:  +- Scan ExistingRDD[test#35] 
+- Coalesce 8
   +- LeftSemiJoinHash [test#35], [test#36], None
      :- TungstenExchange hashpartitioning(test#35,200), None
      :  +- ConvertToUnsafe
      :     +- Scan ExistingRDD[test#35] 
      +- TungstenExchange hashpartitioning(test#36,200), None
         +- ConvertToUnsafe
            +- Scan ExistingRDD[test#36]
{code}

My hunch is that Except is inappropriately mixing Tungsten and non-Tungsten row 
formats due to a bug in the row format conversion rules.

> Dataframe except returns incorrect results when combined with coalesce
> ----------------------------------------------------------------------
>
>                 Key: SPARK-17618
>                 URL: https://issues.apache.org/jira/browse/SPARK-17618
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.6.1, 1.6.2
>            Reporter: Graeme Edwards
>            Priority: Minor
>              Labels: correctness
>
> We were getting incorrect results from the DataFrame except method - all rows 
> were being returned instead of the ones that intersected. Calling subtract on 
> the underlying RDD returned the correct result.
> We tracked it down to the use of coalesce - the following is the simplest 
> example case we created that reproduces the issue:
> {code}
> val schema = new StructType().add("test", types.IntegerType )
> val t1 = sql.createDataFrame(sql.sparkContext.parallelize(1 to 100).map(i=> 
> Row(i)), schema)
> val t2 = sql.createDataFrame(sql.sparkContext.parallelize(5 to 10).map(i=> 
> Row(i)), schema)
> val t3 = t1.join(t2, t1.col("test").equalTo(t2.col("test")), "leftsemi")
> println("Count using normal except = " + t1.except(t3).count())
> println("Count using coalesce = " + 
> t1.coalesce(8).except(t3.coalesce(8)).count())
> {code}
> We should get the same result from both uses of except, but the one using 
> coalesce returns 100 instead of 94.



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

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

Reply via email to