viirya commented on code in PR #39508:
URL: https://github.com/apache/spark/pull/39508#discussion_r1083695957


##########
sql/core/src/test/resources/sql-tests/inputs/group-by.sql:
##########
@@ -45,6 +45,15 @@ SELECT COUNT(DISTINCT b), COUNT(DISTINCT b, c) FROM (SELECT 
1 AS a, 2 AS b, 3 AS
 SELECT a AS k, COUNT(b) FROM testData GROUP BY k;
 SELECT a AS k, COUNT(b) FROM testData GROUP BY k HAVING k > 1;
 
+-- GROUP BY alias is not triggered if SELECT list has lateral column alias.
+SELECT 1 AS x, x + 1 AS k FROM testData GROUP BY k;
+
+-- GROUP BY alias is not triggered if SELECT list has outer reference.
+SELECT * FROM testData WHERE a = 1 AND EXISTS (SELECT a AS k GROUP BY k);

Review Comment:
   If it is not group by alias but group by outer reference, it works? From 
`ResolveReferencesInAggregate` seems so, just want to confirm.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to