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

If ARRAY subquery has ORDER BY (without LIMIT), rows are not sorted

    XMLWordPrintableJSON

Details

    Description

      calcite support array query constructor.

      but If we run sub-query with orderby:

      select array(select x from unnest(array[1,2,3]) as t(x) order by x desc); 
      select array(select x from unnest(array[1,2,3]) as t(x) order by x asc); 

      they both return

      +-----------+
      |  EXPR$0   |
      +-----------+
      | [1, 2, 3] |
      +-----------+
       

      however, we expect return [3, 2, 1] when use order by x desc.

      It seems that the order by not works properly in array sub-query.

      This issue is introduced by the issue https://issues.apache.org/jira/browse/CALCITE-2978

      However the ARRAY is not applicable in this scenario.
       

      Attachments

        Issue Links

          Activity

            People

              taoran Ran Tao
              taoran Ran Tao
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: