rkrishn7 commented on code in PR #17703:
URL: https://github.com/apache/datafusion/pull/17703#discussion_r2384274536


##########
datafusion/physical-expr/src/utils/mod.rs:
##########
@@ -238,22 +238,26 @@ pub fn collect_columns(expr: &Arc<dyn PhysicalExpr>) -> 
HashSet<Column> {
     columns
 }
 
-/// Re-assign column indices referenced in predicate according to given schema.
-/// This may be helpful when dealing with projections.
-pub fn reassign_predicate_columns(
-    pred: Arc<dyn PhysicalExpr>,
+/// Re-assign indices of [`Column`]s within the given [`PhysicalExpr`] 
according to
+/// the provided [`Schema`].
+///
+/// This can be useful when attempting to map an expression onto a different 
schema.
+///
+/// # Errors
+///
+/// This function will return an error if any column in the expression cannot 
be found
+/// in the provided schema.
+pub fn reassign_expr_columns(
+    expr: Arc<dyn PhysicalExpr>,
     schema: &Schema,
-    ignore_not_found: bool,
 ) -> Result<Arc<dyn PhysicalExpr>> {
-    pred.transform_down(|expr| {
-        let expr_any = expr.as_any();
-
-        if let Some(column) = expr_any.downcast_ref::<Column>() {
+    expr.transform_down(|expr| {
+        if let Some(column) = expr.as_any().downcast_ref::<Column>() {
             let index = match schema.index_of(column.name()) {
                 Ok(idx) => idx,
-                Err(_) if ignore_not_found => usize::MAX,
                 Err(e) => return Err(e.into()),
             };

Review Comment:
   Yes good catch!



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