Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-27764 Feature Parity between PostgreSQL and Spark
  3. SPARK-29698

Support grouping function with multiple arguments

    XMLWordPrintableJSON

Details

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

    Description

      In PgSQL, grouping() can have multiple arguments, but Spark grouping() must have a single argument (https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/grouping.scala#L100);

      postgres=# select a, b, grouping(a, b), sum(v), count(*), max(v)
      postgres-#   from gstest1 group by rollup (a,b);
       a | b | grouping | sum | count | max 
      ---+---+----------+-----+-------+-----
         |   |        3 |     |     0 |    
      (1 row)
      

      See a doc for the form: https://www.postgresql.org/docs/12/functions-aggregate.html (Table 9.59. Grouping Operations)

      Attachments

        Activity

          People

            Unassigned Unassigned
            maropu Takeshi Yamamuro
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: