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

False "Hash aggregate does not support schema changes" error message in a query with merge join and hash aggregation

    XMLWordPrintableJSON

Details

    Description

      This error seems to be happening only when you have both window and regular aggregate function in a query. You will need to disable hash join to reproduce this error: "alter session set `planner.enable_hashjoin` = false"
      Columns in table j6 are all of 'optional' type, columns in j7 are all "required" type. (attached sample for each)

      Here are two queries that are failing for me:

      Query 1 (aggregate function in the having clause):

      0: jdbc:drill:schema=dfs> select
      . . . . . . . . . . . . >         j6.c_integer,
      . . . . . . . . . . . . >         sum(j6.c_integer) over(partition by j6.c_date order by j6.c_time)
      . . . . . . . . . . . . > from
      . . . . . . . . . . . . >         j6, j7
      . . . . . . . . . . . . > where   j6.c_integer = j7.c_integer
      . . . . . . . . . . . . > group by
      . . . . . . . . . . . . >         j6.c_date, j6.c_time, j6.c_integer
      . . . . . . . . . . . . > having
      . . . . . . . . . . . . >         avg(j7.c_integer) > 0;
      java.lang.RuntimeException: java.sql.SQLException: UNSUPPORTED_OPERATION ERROR: Hash aggregate does not support schema changes
      
      Fragment 0:0
      
      [Error Id: ed0140d4-244c-4895-bf65-6ea1d085382e on atsqa4-133.qa.lab:31010]
      	at sqlline.IncrementalRows.hasNext(IncrementalRows.java:73)
      	at sqlline.TableOutputFormat$ResizingRowsProvider.next(TableOutputFormat.java:85)
      	at sqlline.TableOutputFormat.print(TableOutputFormat.java:116)
      	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)
      

      Query 2: (window function and aggregate function in projection list):

      0: jdbc:drill:schema=dfs> select
      . . . . . . . . . . . . >         j6.c_integer,
      . . . . . . . . . . . . >         avg(j7.c_integer),
      . . . . . . . . . . . . >         sum(j6.c_integer) over(partition by j6.c_date order by j6.c_time)
      . . . . . . . . . . . . > from    
      . . . . . . . . . . . . >         j6, j7 
      . . . . . . . . . . . . > where   j6.c_integer = j7.c_integer
      . . . . . . . . . . . . > group by 
      . . . . . . . . . . . . >         j6.c_date, j6.c_time, j6.c_integer;
      java.lang.RuntimeException: java.sql.SQLException: UNSUPPORTED_OPERATION ERROR: Hash aggregate does not support schema changes
      
      Fragment 0:0
      
      [Error Id: 370188bd-012d-4fc2-a365-fe9e482aaa0f on atsqa4-133.qa.lab:31010]
      	at sqlline.IncrementalRows.hasNext(IncrementalRows.java:73)
      	at sqlline.TableOutputFormat$ResizingRowsProvider.next(TableOutputFormat.java:85)
      	at sqlline.TableOutputFormat.print(TableOutputFormat.java:116)
      	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)
      

      Attachments

        1. j7.parquet
          4 kB
          Victoria Markman
        2. j6.parquet
          4 kB
          Victoria Markman

        Activity

          People

            Unassigned Unassigned
            vicky Victoria Markman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: