andygrove commented on code in PR #2149:
URL: https://github.com/apache/datafusion-comet/pull/2149#discussion_r2276996517


##########
native/core/src/execution/planner.rs:
##########
@@ -2611,9 +2611,16 @@ impl From<ExpressionError> for DataFusionError {
 /// data corruption from reusing the input batch.
 fn can_reuse_input_batch(op: &Arc<dyn ExecutionPlan>) -> bool {
     if op.as_any().is::<ScanExec>() {
-        // JVM side can return arrow buffers to the pool
-        // Also, native_comet scan reuses mutable buffers
-        true
+        let scan = op.as_any().downcast_ref::<ScanExec>().unwrap();
+        if scan.has_buffer_reuse {
+            // native_comet and native_iceberg_compat scans reuse mutable 
Parquet buffers
+            true
+        } else {
+            // scans other than native_comet and native_iceberg_compat, such as
+            // reading broadcast and shuffle exchanges should not be able to 
reuse their
+            // input batches
+            false
+        }

Review Comment:
   This is the main change in this PR



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