Uploaded image for project: 'IMPALA'
  1. IMPALA
  2. IMPALA-1898

Substituting the agg output in analysis has issues with explicit select-list aliases.

    XMLWordPrintableJSON

Details

    Description

      In the query below, it appears we incorrectly substitute the "timestamp_col" SlotRef within the extract() function with the expr that has the select-list alias "timestamp_col" (i.e., the extract() function itself).
      extract() returns an INT.

      select extract(timestamp_col, 'hour') AS timestamp_col, string_col,
      sum(double_col) AS double_total
      FROM functional.alltypes
      GROUP BY 1, 2
      ERROR: AnalysisException: No matching function with signature: extract(INT, STRING).
      

      Another manifestation of this same bug:

      create database wes;
      create table wes.airlines_parquet (cancelled tinyint) stored as parquet;
      insert into wes.airlines_parquet values(1), (2), (3), (NULL), (0), (-1);
      select cast(cancelled as boolean) as `cancelled`, count(*) as `count`
      from wes.`airlines_parquet`
      group by 1;
      ERROR: AnalysisException: select list expression not produced by aggregation output (missing from GROUP BY clause?): CAST(cancelled AS BOOLEAN)
      

      Attachments

        Activity

          People

            tarmstrong Tim Armstrong
            alex.behm Alexander Behm
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: