Uploaded image for project: 'Apache Drill'
  1. Apache Drill
  2. DRILL-3255

Queries must fail when invalid-positions are specified in order by clause of a window function

    XMLWordPrintableJSON

    Details

      Description

      Drill fails to validate invalid positions within the ORDER BY clause of a window function:

      >  select s_city, s_store_sk, sum(s_number_employees) over (PARTITION BY s_city ORDER BY 40) from store limit 10;
      +-----------+-------------+---------+
      |  s_city   | s_store_sk  | EXPR$2  |
      +-----------+-------------+---------+
      | Fairview  | 5           | 860     |
      | Fairview  | 8           | 860     |
      | Fairview  | 12          | 860     |
      | Midway    | 1           | 2320    |
      | Midway    | 2           | 2320    |
      | Midway    | 3           | 2320    |
      | Midway    | 4           | 2320    |
      | Midway    | 6           | 2320    |
      | Midway    | 7           | 2320    |
      | Midway    | 9           | 2320    |
      +-----------+-------------+---------+
      10 rows selected (0.224 seconds)
      

      Drill validates the same, when the ORDER BY clause is a part of the main query

      >  select s_city, s_store_sk, sum(s_number_employees)  from store group by s_city, s_store_sk ORDER BY 40 limit 10;
      Error: PARSE ERROR: From line 1, column 101 to line 1, column 102: Ordinal out of range
      [Error Id: 0458fba1-afd6-48cf-89ba-1e4c107d2426 on abhi8.qa.lab:31010] (state=,code=0)
      

        Attachments

          Activity

            People

            • Assignee:
              adeneche Deneche A. Hakim
              Reporter:
              agirish Abhishek Girish
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: