jayzhan211 commented on code in PR #12046:
URL: https://github.com/apache/datafusion/pull/12046#discussion_r1724140529


##########
datafusion/sql/src/utils.rs:
##########
@@ -119,9 +121,34 @@ pub(crate) fn check_columns_satisfy_exprs(
             _ => check_column_satisfies_expr(columns, e, message_prefix)?,
         }
     }
+    let column_names = columns
+        .iter()
+        .map(|c| format!("{}", c.schema_name()))
+        .collect::<Vec<_>>();
+
+    wildcard_fields.into_iter().try_for_each(|(table, field)| {
+        let column_name = qualified_name(table, field.name());
+        if !column_names.iter().any(|c| c == &column_name) {

Review Comment:
   I think we need to ensure the column is either in group by and select 
statement. I'm confused why we check against wildcard_fields



##########
datafusion/sql/src/utils.rs:
##########
@@ -119,9 +121,34 @@ pub(crate) fn check_columns_satisfy_exprs(
             _ => check_column_satisfies_expr(columns, e, message_prefix)?,
         }
     }
+    let column_names = columns
+        .iter()
+        .map(|c| format!("{}", c.schema_name()))
+        .collect::<Vec<_>>();
+
+    wildcard_fields.into_iter().try_for_each(|(table, field)| {
+        let column_name = qualified_name(table, field.name());
+        if !column_names.iter().any(|c| c == &column_name) {

Review Comment:
   I think we need to ensure the column is either in group by or select 
statement. I'm confused why we check against wildcard_fields



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