adriangb commented on code in PR #16589:
URL: https://github.com/apache/datafusion/pull/16589#discussion_r2265353201


##########
datafusion/physical-expr-adapter/src/schema_rewriter.rs:
##########
@@ -220,13 +223,111 @@ impl<'a> DefaultPhysicalExprAdapterRewriter<'a> {
         &self,
         expr: Arc<dyn PhysicalExpr>,
     ) -> Result<Transformed<Arc<dyn PhysicalExpr>>> {
+        if let Some(transformed) = 
self.try_rewrite_struct_field_access(&expr)? {
+            return Ok(Transformed::yes(transformed));
+        }
+
         if let Some(column) = expr.as_any().downcast_ref::<Column>() {
             return self.rewrite_column(Arc::clone(&expr), column);
         }
 
         Ok(Transformed::no(expr))
     }
 
+    fn try_rewrite_struct_field_access(
+        &self,
+        expr: &Arc<dyn PhysicalExpr>,
+    ) -> Result<Option<Arc<dyn PhysicalExpr>>> {
+        let get_field_expr = match 
expr.as_any().downcast_ref::<ScalarFunctionExpr>() {
+            Some(expr) => expr,
+            None => return Ok(None),
+        };
+
+        if get_field_expr.name() != "get_field" {

Review Comment:
   I've seen / used this pattern a lot. I added 50b1e91  which should simplify 
it not just for this PR but any other use of matching a specific function from 
a PhysicalExpr as well.



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