cloud-fan commented on a change in pull request #29797:
URL: https://github.com/apache/spark/pull/29797#discussion_r503140497



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala
##########
@@ -1258,4 +1263,57 @@ class AdaptiveQueryExecSuite
       }
     }
   }
+
+  test("SPARK-32932: Do not use local shuffle reader at final stage on write 
command") {
+    withSQLConf(SQLConf.PARTITION_OVERWRITE_MODE.key -> 
PartitionOverwriteMode.DYNAMIC.toString,
+      SQLConf.SHUFFLE_PARTITIONS.key -> "5",
+      SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true") {
+      val data = for (
+        i <- 1L to 10L;
+        j <- 1L to 3L
+      ) yield (i, j)
+
+      val df = data.toDF("i", "j")
+        .repartition($"j")
+
+      withTable("t") {
+        df.write
+          .partitionBy("j")
+          .saveAsTable("t")
+        assert(spark.read.table("t").inputFiles.length == 3)

Review comment:
       it's a bit tricky to check the number of files. 3 distinct values don't 
always mean 3 files.
   
   Can we use `QueryExecutionListener` to catch the query plan, and check there 
is no local shuffle reader?




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to