zhztheplayer commented on code in PR #7582:
URL: https://github.com/apache/incubator-gluten/pull/7582#discussion_r1805930734


##########
gluten-core/src/main/scala/org/apache/gluten/extension/GlutenColumnarRule.scala:
##########
@@ -109,16 +77,31 @@ case class GlutenColumnarRule(
    */
   final override def preColumnarTransitions: Rule[SparkPlan] = plan => {
     // To infer caller's property: 
ApplyColumnarRulesAndInsertTransitions#outputsColumnar.
-    OutputsColumnarTester.wrap(plan)
+    if (plan.supportsColumnar) {
+      DummyColumnarOutputExec(plan)
+    } else {
+      DummyRowOutputExec(plan)
+    }
   }
 
   override def postColumnarTransitions: Rule[SparkPlan] = plan => {
-    val outputsColumnar = OutputsColumnarTester.inferOutputsColumnar(plan)
-    val unwrapped = OutputsColumnarTester.unwrap(plan)
-    val vanillaPlan = Transitions.insertTransitions(unwrapped, outputsColumnar)
+    val (childPlan, outputsColumnar) = plan match {
+      case DummyRowOutputExec(child) =>
+        (child, false)
+      case RowToColumnarExec(DummyRowOutputExec(child)) =>
+        (child, true)
+      case DummyColumnarOutputExec(child) =>
+        (child, true)
+      case ColumnarToRowExec(DummyColumnarOutputExec(child)) =>
+        (child, false)
+      case _ =>
+        throw new IllegalStateException(
+          "This should not happen. Please leave a issue at" +
+            " https://github.com/apache/incubator-gluten.";)
+    }
+    val vanillaPlan = Transitions.insertTransitions(childPlan, outputsColumnar)
     val applier = applierBuilder.apply(session)
-    val out = applier.apply(vanillaPlan, outputsColumnar)
-    out
+    applier.apply(vanillaPlan, outputsColumnar)

Review Comment:
   Let's do the simplification. Just found there is an [alternative 
way](https://stackoverflow.com/questions/5010362/can-i-find-out-the-return-value-before-returning-while-debugging-in-intellij)
 while using Intellij IDE. Thanks.



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