rluvaton commented on code in PR #1793:
URL: https://github.com/apache/datafusion-comet/pull/1793#discussion_r2111820738


##########
spark/src/main/scala/org/apache/comet/serde/QueryPlanSerde.scala:
##########
@@ -2406,19 +2406,19 @@ object QueryPlanSerde extends Logging with 
CometExprShim {
 
           // TODO this could be optimized more to stop walking the tree on 
hitting
           //  certain operators such as join or aggregate which will copy 
batches
-          def containsNativeCometScan(plan: SparkPlan): Boolean = {
+          def containsNonDataFusionScan(plan: SparkPlan): Boolean = {
             plan match {
-              case w: CometScanWrapper => 
containsNativeCometScan(w.originalPlan)
-              case scan: CometScanExec => scan.scanImpl == 
CometConf.SCAN_NATIVE_COMET
+              case _: CometScanWrapper => true
+              case scan: CometScanExec => scan.scanImpl != 
CometConf.SCAN_NATIVE_DATAFUSION
               case _: CometNativeScanExec => false
-              case _ => plan.children.exists(containsNativeCometScan)
+              case _ => plan.children.isEmpty || 
plan.children.exists(containsNonDataFusionScan)

Review Comment:
   we must start from a scan, right? either 
[`ScanExec`](https://github.com/apache/datafusion-comet/blob/dbf2fb77b76e3f0683ab5a9cf612d20f5f67a53a/native/core/src/execution/operators/scan.rs)
 or DataFusion 
[`DataSourceExec`](https://github.com/apache/datafusion-comet/blob/bc92f6e50bf1e088992e92481504c0de25e506a5/native/core/src/execution/planner.rs#L1188)
 so if no  children this means that we are at the root, for example 
`ExistingRDD` and therefore we must use `ScanExec` as otherwise we would have 
converted to `CometNativeScanExec`



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to