eliaperantoni commented on code in PR #14521:
URL: https://github.com/apache/datafusion/pull/14521#discussion_r1946138498


##########
datafusion/common/src/column.rs:
##########
@@ -299,6 +301,23 @@ impl Column {
                 .flat_map(|s| s.columns())
                 .collect(),
         })
+        .map_err(|e| match &e {
+            DataFusionError::SchemaError(
+                SchemaError::FieldNotFound {
+                    field,
+                    valid_fields,
+                },
+                _,
+            ) => {
+                let mut diagnostic = Diagnostic::new_error(
+                    format!("column '{}' not found", &field.name()),
+                    field.spans().first(),
+                );
+                add_possible_columns_to_diag(&mut diagnostic, field, 
valid_fields);
+                e.with_diagnostic(diagnostic)
+            }
+            _ => e,
+        })

Review Comment:
   I wonder if we actually want point 2 actually 🤔 I mean, if the user's 
problem is that they have too many columns matching a name, do they need to be 
suggested  similar matches? I would say not.
   
   Maybe just remove the extra `Diagnostic` for field not found and this PR is 
good to go for me.



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