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

Group by ordinal number of an output column results in parse error

    XMLWordPrintableJSON

Details

    Description

      Group by number results in parse error.

      0: jdbc:drill:schema=dfs.tmp> select sub_q.col1 from (select col1 from FEWRWSPQQ_101) sub_q group by 1;
      Error: PARSE ERROR: At line 1, column 8: Expression 'q.col1' is not being grouped
      
      
      [Error Id: 0eedafd9-372e-4610-b7a8-d97e26458d58 on centos-02.qa.lab:31010] (state=,code=0)
      

      When we use the column name instead of the number, the query compiles and returns results.

      0: jdbc:drill:schema=dfs.tmp> select col1 from (select col1 from FEWRWSPQQ_101) group by col1;
      +----------------------+
      |         col1         |
      +----------------------+
      | 65534                |
      | 10000000             |
      | -1                   |
      | 0                    |
      | 1                    |
      | 13                   |
      | 17                   |
      | 23                   |
      | 1000                 |
      | 9999999              |
      | 30                   |
      | 25                   |
      | 1001                 |
      | -65535               |
      | 5000                 |
      | 3000                 |
      | 200                  |
      | 197                  |
      | 4611686018427387903  |
      | 9223372036854775806  |
      | 9223372036854775807  |
      | 92233720385475807    |
      +----------------------+
      22 rows selected (0.218 seconds)
      
      0: jdbc:drill:schema=dfs.tmp> select sub_query.col1 from (select col1 from FEWRWSPQQ_101) sub_query group by sub_query.col1;
      +----------------------+
      |         col1         |
      +----------------------+
      | 65534                |
      | 10000000             |
      | -1                   |
      | 0                    |
      | 1                    |
      | 13                   |
      | 17                   |
      | 23                   |
      | 1000                 |
      | 9999999              |
      | 30                   |
      | 25                   |
      | 1001                 |
      | -65535               |
      | 5000                 |
      | 3000                 |
      | 200                  |
      | 197                  |
      | 4611686018427387903  |
      | 9223372036854775806  |
      | 9223372036854775807  |
      | 92233720385475807    |
      +----------------------+
      22 rows selected (0.177 seconds)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            khfaraaz Khurram Faraaz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: