lsm1 commented on code in PR #37014:
URL: https://github.com/apache/spark/pull/37014#discussion_r916414485
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/adaptive/AdaptiveQueryExecSuite.scala:
##########
@@ -2602,6 +2602,59 @@ class AdaptiveQueryExecSuite
assert(findTopLevelBroadcastNestedLoopJoin(adaptivePlan).size == 1)
}
}
+
+ test("SPARK-39624 Support coalesce partition through CartesianProduct") {
+ def checkResultPartition(
+ df: Dataset[Row],
+ numShuffleReader: Int,
+ numPartition: Int): Unit = {
+ df.collect()
+ assert(collect(df.queryExecution.executedPlan) {
+ case r: AQEShuffleReadExec => r
+ }.size === numShuffleReader)
+ assert(df.rdd.partitions.length === numPartition)
+ }
+ withSQLConf(SQLConf.ADAPTIVE_EXECUTION_ENABLED.key -> "true",
+ SQLConf.COALESCE_PARTITIONS_ENABLED.key -> "true",
+ SQLConf.ADVISORY_PARTITION_SIZE_IN_BYTES.key -> "1048576",
+ SQLConf.COALESCE_PARTITIONS_MIN_PARTITION_NUM.key -> "1",
+ SQLConf.SHUFFLE_PARTITIONS.key -> "10") {
+ withTempView("t1", "t2", "t3") {
+ spark.sparkContext.parallelize((1 to 10).map(i => TestData(i,
i.toString)), 2)
+ .toDF().createOrReplaceTempView("t1")
+ spark.sparkContext.parallelize((1 to 10).map(i => TestData(i,
i.toString)), 4)
+ .toDF().createOrReplaceTempView("t2")
+ spark.sparkContext.parallelize((1 to 10).map(i => TestData(i,
i.toString)), 4)
+ .toDF().createOrReplaceTempView("t3")
+ // positive test that could be coalesced
Review Comment:
Like Union operation, if children of CartesianProduct can be coalesce
partition, the rule will effect, otherwrise not effect
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]