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


##########
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 there are two valid cases
   
   In group by clause
   1. `group by a having a = 1`;
   
   Part of an aggregate function
   2. `select max(a) from t having max(a) = 1`;
   
   I think we just need to check group by expressions and both select + having 
expressions. 
   If we got wildcard, I think we could ignore it, it doesn't matter 🤔 



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