Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-886

System functions in GROUP BY clause

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.5.0
    • None
    • None

    Description

      The system functions are the ones that do not have parentheses, like CURRENT_DATE, CURRENT_TIME, CURRENT_USER, etc.

      When such functions appear in the group by clause, Calcite will hit SqlValidatorException, complaining the column with the function name could not be found in any table.

      For instance,

      select CURRENT_USER from SCOTT.EMP GROUP BY CURRENT_USER;
      
      org.apache.calcite.sql.validate.SqlValidatorException <init>
      SEVERE: org.apache.calcite.sql.validate.SqlValidatorException: Column 'CURRENT_USER' not found in any table
      

      This query runs perfectly fine.

      select CURRENT_USER from SCOTT.EMP limit 1;
      

      Looks like the sql validation logic for group by clause could not recognize SqlIdentifier which may represent a function w/o parentheses.

      Attachments

        Activity

          People

            julianhyde Julian Hyde
            jni Jinfeng Ni
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: