You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/08/16 17:21:43 UTC

[GitHub] [spark] peter-toth commented on a change in pull request #25479: [SPARK-28356][SHUFFLE][FOLLOWUP] Fix case with different pre-shuffle partition numbers

peter-toth commented on a change in pull request #25479: [SPARK-28356][SHUFFLE][FOLLOWUP] Fix case with different pre-shuffle partition numbers
URL: https://github.com/apache/spark/pull/25479#discussion_r314814514
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/execution/ReduceNumShufflePartitionsSuite.scala
 ##########
 @@ -587,4 +587,22 @@ class ReduceNumShufflePartitionsSuite extends SparkFunSuite with BeforeAndAfterA
     }
     withSparkSession(test, 200, None)
   }
+
+  test("Union two datasets with different pre-shuffle partition number") {
+    val test: SparkSession => Unit = { spark: SparkSession =>
+      val df1 = spark.range(3).join(spark.range(3), "id").toDF()
+      val df2 = spark.range(3).groupBy().sum()
+
+      val resultDf = df1.union(df2)
+
+      checkAnswer(resultDf, Seq((0), (1), (2), (3)).map(i => Row(i)))
 
 Review comment:
   It does. The plan is:
   ```
   AdaptiveSparkPlan(isFinalPlan=false)
   +- Union
      :- Project [id#0L]
      :  +- SortMergeJoin [id#0L], [id#2L], Inner
      :     :- Sort [id#0L ASC NULLS FIRST], false, 0
      :     :  +- Exchange hashpartitioning(id#0L, 5), true
      :     :     +- Range (0, 3, step=1, splits=12)
      :     +- Sort [id#2L ASC NULLS FIRST], false, 0
      :        +- Exchange hashpartitioning(id#2L, 5), true
      :           +- Range (0, 3, step=1, splits=12)
      +- HashAggregate(keys=[], functions=[sum(id#6L)], output=[sum(id)#10L])
         +- Exchange SinglePartition, true
            +- HashAggregate(keys=[], functions=[partial_sum(id#6L)], output=[sum#14L])
               +- Range (0, 3, step=1, splits=12)
   ```
   and the error comes from this assert: https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/execution/adaptive/ReduceNumShufflePartitions.scala#L136

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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