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

System functions in GROUP BY clause

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.5.0
    • Component/s: None
    • Labels:
      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

            • Assignee:
              julianhyde Julian Hyde
              Reporter:
              jni Jinfeng Ni
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: