Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2867 JSON support
  3. CALCITE-2786

Add order by clause support for JSON_ARRAYAGG

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.19.0
    • core

    Description

      Both Oracle[1] and SQL:2016[2] supports or introduces an optional order by clause in JSON_ARRAYAGG, the feature can be implemented since Calcite already supports sorted aggregation.

      AFAICS, JSON_ARRAYAGG's order by clause has no difference with the definition of WITHIN GROUP's, so I think it might be feasible to do sort by expanding JSON_ARRAYAGG(... ORDER BY ...) to JSON_ARRAYAGG(...) WITHIN GROUP (ORDER BY...) during SQL parsing.

      [1] https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/JSON_ARRAYAGG.html#GUID-6D56077D-78DE-4CC0-9498-225DDC42E054
      [2] http://standards.iso.org/ittf/PubliclyAvailableStandards/c065143_ISO_IEC_TR_19075-5_2016.zip

      Attachments

        Issue Links

          Activity

            People

              zhztheplayer Hongze Zhang
              zhztheplayer Hongze Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              4 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 - 50m
                  50m