viirya commented on a change in pull request #31595:
URL: https://github.com/apache/spark/pull/31595#discussion_r581304260



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/DataFrameSetOperationsSuite.scala
##########
@@ -387,100 +388,104 @@ class DataFrameSetOperationsSuite extends QueryTest 
with SharedSparkSession {
 
   test("SPARK-34283: SQL-style union using Dataset, " +
     "remove unnecessary deduplicate in multiple unions") {
-    val unionDF = 
testData.union(testData).distinct().union(testData).distinct()
-      .union(testData).distinct().union(testData).distinct()
-
-    // Before optimizer, there are three 'union.deduplicate' operations should 
be combined.
-    assert(unionDF.queryExecution.analyzed.collect {
-      case u: Union if u.children.size == 4 => u
-    }.size === 1)
-
-    // After optimizer, four 'union.deduplicate' operations should be combined.
-    assert(unionDF.queryExecution.optimizedPlan.collect {
-      case u: Union if u.children.size == 5 => u
-    }.size === 1)
-
-    checkAnswer(
-      unionDF.agg(avg("key"), max("key"), min("key"),
-        sum("key")), Row(50.5, 100, 1, 5050) :: Nil
-    )
+    withSQLConf(SQLConf.OPTIMIZER_EXCLUDED_RULES.key -> 
RemoveNoopUnion.ruleName) {

Review comment:
       The test checks a Union with certain children. But the new rule will 
remove unnecessary Union.
   
   So the check
   
   ```
   // After optimizer, four 'union.deduplicate' operations should be 
assert(unionDF.queryExecution.optimizedPlan.collect {
     case u: Union if u.children.size == 5 => u
   }.size === 1)
   ```
   
   will fail.




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