sandugood commented on code in PR #1649:
URL: 
https://github.com/apache/datafusion-ballista/pull/1649#discussion_r3199766659


##########
ballista/scheduler/src/state/aqe/optimizer_rule/propagate_empty.rs:
##########
@@ -90,6 +91,14 @@ impl PropagateEmptyExecRule {
             && (is_empty_exec!(hash_join.left) || 
is_empty_exec!(hash_join.right))
         {
             empty_exec!(hash_join)
+        } else if let Some(exchange) = 
plan.as_any().downcast_ref::<ExchangeExec>() {
+            let stats = exchange.partition_statistics(None)?;
+            match stats.num_rows {
+                Precision::Exact(0) => 
Ok(Transformed::yes(Arc::new(EmptyExec::new(
+                    plan.schema().clone(),
+                )))),

Review Comment:
   I think we can use this macro
   
   ```suggestion
                   Precision::Exact(0) => empty_exec!(exchange),
   ```



##########
ballista/scheduler/src/state/aqe/planner.rs:
##########
@@ -441,20 +420,15 @@ impl AdaptivePlanner {
     /// # Returns
     /// A vector of default physical optimizer rules.
     fn default_optimizers() -> Vec<PhysicalOptimizerRuleRef> {
-        let mut physical_optimizers: Vec<PhysicalOptimizerRuleRef> = vec![
-            // TODO: do we keep it here or make it last
-            Arc::new(DistributedExchangeRule::default()),
-            Arc::new(EliminateEmptyExchangeRule::default()),
-        ];
-
-        let default_optimizers = PhysicalOptimizer::new();
-        physical_optimizers.extend(default_optimizers.rules.iter().cloned());
+        let mut physical_optimizers = PhysicalOptimizer::new().rules;
+        
//physical_optimizers.push(Arc::new(EliminateEmptyExchangeRule::default()));

Review Comment:
   ```suggestion
           // 
physical_optimizers.push(Arc::new(EliminateEmptyExchangeRule::default()));
   ```



##########
ballista/scheduler/src/state/aqe/optimizer_rule/propagate_empty.rs:
##########


Review Comment:
   Do we need this block after adding the matching on `stats.num_rows` on later 
`if` branching? (where we also downcasting to `ExchangeExec`



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