goldmedal commented on code in PR #12046: URL: https://github.com/apache/datafusion/pull/12046#discussion_r1720908340
########## datafusion/sqllogictest/test_files/aggregate.slt: ########## @@ -5643,3 +5643,24 @@ query I??III?T select count(null), min(null), max(null), bit_and(NULL), bit_or(NULL), bit_xor(NULL), nth_value(NULL, 1), string_agg(NULL, ','); ---- 0 NULL NULL NULL NULL NULL NULL NULL + +statement ok +create table having_test(v1 int, v2 int) + +statement ok +insert into having_test values (1, 2), (2, 3), (3, 4) + +query II +select * from having_test group by v1, v2 having max(v1) = 3 +---- +3 4 + +query error DataFusion error: Error during planning: Projection references non-aggregate values: Expression having_test\.v1 could not be resolved from available columns: max\(having_test\.v1\) +select * from having_test having max(v1) = 3 + +# because v2 is not in the group by clause, the sql is invalid +query error +select * from having_test group by v1 having max(v1) = 3 Review Comment: This error won't be detected when planning the aggregation because we won't expand the wildcard there. This error will be thrown when `ExpandWildcardRule`. -- 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