XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.0
    • None
    • SQL
    • None

    Description

      Support Aggregate to host outer query references. For example:

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

      Currently Spark throws thisĀ error:

      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
      

      Postgres SQL test example (groupingsets.sql)

      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]
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            allisonwang-db Allison Wang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: