zml1206 commented on code in PR #12506:
URL: https://github.com/apache/gluten/pull/12506#discussion_r3584262022


##########
gluten-ut/spark41/src/test/scala/org/apache/spark/sql/execution/GlutenRemoveRedundantProjectsSuite.scala:
##########
@@ -16,8 +16,192 @@
  */
 package org.apache.spark.sql.execution
 
-import org.apache.spark.sql.GlutenSQLTestsTrait
+import org.apache.spark.sql.{GlutenSQLTestsTrait, Row}
+import org.apache.spark.sql.internal.SQLConf
+import org.apache.spark.sql.types.StructType
 
 class GlutenRemoveRedundantProjectsSuite
   extends RemoveRedundantProjectsSuite
-  with GlutenSQLTestsTrait {}
+  with GlutenSQLTestsTrait {
+
+  // The original tests count Spark ProjectExec nodes, while Gluten converts 
offloaded projects to
+  // ProjectExecTransformer. PullOutPreProject and PullOutPostProject may also 
insert additional
+  // projects while rewriting the Spark physical plan, so project counts are 
not directly
+  // comparable. Therefore, these tests only verify that query results are 
identical with redundant
+  // project removal enabled and disabled.
+  private def assertProjectExec(query: String, enabled: Int, disabled: Int): 
Unit = {
+    val df = sql(query)
+    // When enabling AQE, the DPP subquery filters is replaced in runtime.
+    df.collect()
+    // assertProjectExecCount(df, enabled)
+    val result = df.collect()
+    withSQLConf(SQLConf.REMOVE_REDUNDANT_PROJECTS_ENABLED.key -> "false") {
+      val df2 = sql(query)
+      df2.collect()
+      // assertProjectExecCount(df2, disabled)
+      checkAnswer(df2, result)
+    }
+  }

Review Comment:
   fixed



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

Reply via email to