Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4349

Support GROUP_CONCAT aggregate function for MySQL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.27.0
    • None

    Description

      Support the GROUP_CONCAT aggregate function for MySQL. Here is the syntax:

      GROUP_CONCAT([DISTINCT] expr [,expr ...]
                   [ORDER BY {unsigned_integer | col_name | expr}
                       [ASC | DESC] [,col_name ...]]
                   [SEPARATOR str_val])
      

       

      GROUP_CONCAT is analogous to LISTAGG (see CALCITE-2754) (and also to BigQuery and PostgreSQL's STRING_AGG, see CALCITE-4335). For example, the query

      SELECT deptno, GROUP_CONCAT(ename ORDER BY empno SEPARATOR ';')
      FROM Emp
      GROUP BY deptno
      

      is equivalent to (and in Calcite's algebra would be desugared to)

      SELECT deptno, LISTAGG(ename, ';') WITHIN GROUP (ORDER BY empno)
      FROM Emp
      GROUP BY deptno
      

      Attachments

        Issue Links

          Activity

            People

              zhenw Zhen Wang
              julianhyde Julian Hyde
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m