berkaysynnada commented on code in PR #14279:
URL: https://github.com/apache/datafusion/pull/14279#discussion_r1931666755


##########
datafusion/physical-expr/src/analysis.rs:
##########
@@ -171,18 +172,20 @@ pub fn analyze(
         .collect::<Vec<_>>();
 
     let target_expr_and_indices = 
graph.gather_node_indices(columns.as_slice());
-
-    let mut target_indices_and_boundaries = target_expr_and_indices
-        .iter()
-        .filter_map(|(expr, i)| {
-            target_boundaries.iter().find_map(|bound| {
-                expr.as_any()
-                    .downcast_ref::<Column>()
-                    .filter(|expr_column| bound.column.eq(*expr_column))
-                    .map(|_| (*i, bound.interval.clone()))
-            })
-        })
-        .collect::<Vec<_>>();
+    let mut target_indices_and_boundaries = Vec::new();
+    for (expr, index) in &target_expr_and_indices {
+        if let Some(column) = expr.as_any().downcast_ref::<Column>() {
+            if let Some(bound) = target_boundaries.iter().find(|b| b.column == 
*column) {
+                if let Some(interval) = &bound.interval {
+                    target_indices_and_boundaries.push((*index, 
interval.clone()));
+                } else {
+                    return Err(internal_datafusion_err!(

Review Comment:
   IIUC, if someone calls analyze() with infeasible (empty) columns, then we 
are returning error here. I think that's not people expect. We should continue 
with the None's instead. I'm doing a fix for that now.



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