jayshrivastava commented on code in PR #24018:
URL: https://github.com/apache/datafusion/pull/24018#discussion_r3687020759


##########
datafusion-examples/examples/relation_planner/table_sample.rs:
##########
@@ -749,6 +749,22 @@ impl ExecutionPlan for SampleExec {
 
         Ok(Arc::new(stats))
     }
+
+    fn apply_expressions(
+        &self,
+        f: &mut dyn FnMut(
+            &Arc<dyn datafusion::physical_plan::PhysicalExpr>,
+        ) -> Result<TreeNodeRecursion>,
+    ) -> Result<TreeNodeRecursion> {
+        datafusion::physical_plan::apply_expression_roots(
+            self.cache
+                .output_ordering()
+                .into_iter()
+                .flatten()
+                .map(|sort_expr| &sort_expr.expr),
+            f,
+        )

Review Comment:
   Question for reviewers - this pattern repeats a lot. Is it worth adding a 
helper? 
   ```rust
   apply_expression_roots(
       properties
           .output_ordering()
           .into_iter()
           .flatten()
           .map(|sort_expr| &sort_expr.expr),
       f
   )
   ```
   The projection pattern also repeats a bit
   ```rust
         crate::apply_expression_roots(
             self.projector
                 .projection()
                 .as_ref()
                 .iter()
                 .map(|proj_expr| &proj_expr.expr),
             f,
         )
   ```



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