Jefffrey commented on code in PR #18540:
URL: https://github.com/apache/datafusion/pull/18540#discussion_r2508467339


##########
datafusion/physical-optimizer/src/coalesce_batches.rs:
##########
@@ -72,11 +72,26 @@ impl PhysicalOptimizerRule for CoalesceBatches {
                         )
                     })
                     .unwrap_or(false);
+
             if wrap_in_coalesce {
                 Ok(Transformed::yes(Arc::new(CoalesceBatchesExec::new(
                     plan,
                     target_batch_size,
                 ))))
+            } else if let Some(async_exec) = 
plan_any.downcast_ref::<AsyncFuncExec>() {

Review Comment:
   I believe the idea is that for async functions, we are specifically 
interested in batching together inputs to the function so ideally it is not 
called as often (which can be expensive for async function). Whereas for 
coalesce batches in general, it looks like it considers the output of a node 
and if it is too small it wraps that note in a coalesce.
   
   So for async, we consider input to aync node for coalesce logic; for other 
node types we look at their output for coalesce logic
   
   We should copy the comment from `coalesce_async_exec_input.rs` here to not 
lose that context, e.g.
   
   > Coalesce inputs to async functions to reduce number of async function 
invocations



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