smiklos commented on code in PR #7277:
URL: https://github.com/apache/arrow-datafusion/pull/7277#discussion_r1293315678


##########
datafusion/optimizer/src/optimizer.rs:
##########
@@ -288,11 +288,17 @@ impl Optimizer {
             log_plan(&format!("Optimizer input (pass {i})"), &new_plan);
 
             for rule in &self.rules {
-                let result = self.optimize_recursively(rule, &new_plan, 
config);
-
+                let result =
+                    self.optimize_recursively(rule, &new_plan, config)
+                        .and_then(|plan| {
+                            plan.map(|p| {
+                                assert_schema_is_the_same(rule.name(), 
&new_plan, &p)
+                                    .map(|_| Some(p))
+                            })
+                            .unwrap_or(Ok(None))
+                        });

Review Comment:
   Thanks @alamb , I've added your suggestion. Defy looks much better this way 
🥇 



##########
datafusion/optimizer/src/optimizer.rs:
##########
@@ -288,11 +288,17 @@ impl Optimizer {
             log_plan(&format!("Optimizer input (pass {i})"), &new_plan);
 
             for rule in &self.rules {
-                let result = self.optimize_recursively(rule, &new_plan, 
config);
-
+                let result =
+                    self.optimize_recursively(rule, &new_plan, config)
+                        .and_then(|plan| {
+                            plan.map(|p| {
+                                assert_schema_is_the_same(rule.name(), 
&new_plan, &p)
+                                    .map(|_| Some(p))
+                            })
+                            .unwrap_or(Ok(None))
+                        });

Review Comment:
   Thanks @alamb , I've added your suggestion. Defy looks much better this way 
🥇 



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

Reply via email to