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

Function ARRAY_INSERT produces an incorrect result for negative indices

    XMLWordPrintableJSON

Details

    Description

      Here is a test taken from the Spark documentation page:
      https://spark.apache.org/docs/latest/api/sql/index.html#array_insert

      SELECT array_insert(array(5, 3, 2, 1), -4, 4);
      [5,4,3,2,1]
      

      The result produced by Calcite is:

      [4,5,3,2,1]

      The strange thing is that there are tests for negative indices. I wonder if the original tests are wrong, or the behavior of this function in Spark was changed since the tests were written.

      Attachments

        Issue Links

          Activity

            People

              mbudiu Mihai Budiu
              mbudiu Mihai Budiu
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: