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

LEAD function used without OVER clause should not plan

    Details

      Description

      When using LEAD window function without OVER clause, query should fail. Yet it generates a StreamingAgg operator and then fails trying to compile it's generated code.

      0: jdbc:drill:schema=dfs.tmp> select lead(col0) from `fewRowsAllData.parquet`;
      java.lang.RuntimeException: java.sql.SQLException: SYSTEM ERROR: CompileException: Line 95, Column 62: Unknown variable or type "index"
      
      Fragment 0:0
      
      [Error Id: 0d967bd7-36f6-4c8d-a574-9d67d7b22f7e on centos-01.qa.lab:31010]
      	at sqlline.IncrementalRows.hasNext(IncrementalRows.java:73)
      	at sqlline.TableOutputFormat$ResizingRowsProvider.next(TableOutputFormat.java:87)
      	at sqlline.TableOutputFormat.print(TableOutputFormat.java:118)
      	at sqlline.SqlLine.print(SqlLine.java:1583)
      	at sqlline.Commands.execute(Commands.java:852)
      	at sqlline.Commands.sql(Commands.java:751)
      	at sqlline.SqlLine.dispatch(SqlLine.java:738)
      	at sqlline.SqlLine.begin(SqlLine.java:612)
      	at sqlline.SqlLine.start(SqlLine.java:366)
      	at sqlline.SqlLine.main(SqlLine.java:259)
      

      Here is the plan for such query:

      0: jdbc:drill:> explain plan for select lead(col0) from `fewRowsAllData.parquet`;
      +------+------+
      | text | json |
      +------+------+
      | 00-00    Screen
      00-01      Project(EXPR$0=[$0])
      00-02        StreamAgg(group=[{}], EXPR$0=[LEAD($0)])
      00-03          Scan(groupscan=[ParquetGroupScan [entries=[ReadEntryWithPath [path=file:/Users/hakim/MapR/data/3601.parquet]], selectionRoot=file:/Users/hakim/MapR/data/fewRowsAllData.parquet, numFiles=1, columns=[`col0`]]])
      

        Attachments

        1. drillbit.log
          38 kB
          Khurram Faraaz
        2. fewRowsAllData.parquet
          4 kB
          Khurram Faraaz

          Issue Links

            Activity

              People

              • Assignee:
                seanhychu Sean Hsuan-Yi Chu
                Reporter:
                khfaraaz Khurram Faraaz
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: