Uploaded image for project: 'Apache AsterixDB'
  1. Apache AsterixDB
  2. ASTERIXDB-2595

Positional vars and array indexes are inconsistent in SQL++

    XMLWordPrintableJSON

Details

    Description

      Positional variables in SQL++ seem to start at 1 – while array indexes start at 0 – this is pretty annoying in a use case like:

      CREATE FUNCTION grade(score)

      { LET stdcutoffs = [96.5, 93.5, 90.0, 86.5, 83.5, 80.0, 76.5, 73.5, 70.0, 66.5, 63.5, 60.0, 0.0], grades = [“A+“, “A”, “A-“, “B+“, “B”, “B-“, “C+“, “C”, “C-“, “D+“, “D”, “D-“, “F”] FROM grades AS g AT i WHERE score >= stdcutoffs[i-1] SELECT VALUE g ORDER BY i ASC LIMIT 1 }

      ;

      Attachments

        Activity

          People

            dlychagin-cb Dmitry Lychagin
            dtabass Michael J. Carey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: