Allison Wang created SPARK-35554: ------------------------------------ Summary: Support outer references in Aggregate Key: SPARK-35554 URL: https://issues.apache.org/jira/browse/SPARK-35554 Project: Spark Issue Type: Sub-task Components: SQL Affects Versions: 3.2.0 Reporter: Allison Wang
Support Aggregate to host outer query references. For example: {code:sql} CREATE VIEW t(c1, c2) AS VALUES (0, 1), (1, 2) -- scalar subquery example SELECT (SELECT SUM(c1)) FROM t -- lateral join example SELECT * FROM t, LATERAL (SELECT SUM(c1)) {code} Currently Spark throws thisĀ error: {code} org.apache.spark.sql.AnalysisException: Expressions referencing the outer query are not supported outside of WHERE/HAVING clauses: Aggregate [sum(outer(c1#23)) AS sum(outer(spark_catalog.default.t.c1))#28L] +- OneRowRelation {code} Postgres SQL test example (groupingsets.sql) {code} select * from (values (1),(2)) v(a) left join lateral (select v.a, four, ten, count(*) from onek group by cube(four,ten)) s on true order by v.a,four,ten org.apache.spark.sql.AnalysisException Expressions referencing the outer query are not supported outside of WHERE/HAVING clauses: Aggregate [four#x, ten#x, spark_grouping_id#xL], [outer(a#x), four#x, ten#x, count(1) AS count(1)#xL] {code} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org