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.

        Activity

        Show
        jni Jinfeng Ni added a comment - Pull request: https://github.com/apache/incubator-calcite/pull/133
        Hide
        jni Jinfeng Ni added a comment -

        The fix is to call validateExpr() for SqlIdentifier, since SqlIdentifier could represent a regular SqlIdentifier, or a system function.

        Add two unit testcases to cover this case.

        Show
        jni Jinfeng Ni added a comment - The fix is to call validateExpr() for SqlIdentifier, since SqlIdentifier could represent a regular SqlIdentifier, or a system function. Add two unit testcases to cover this case.
        Hide
        jni Jinfeng Ni added a comment -

        Julian Hyde, could you please review this small patch ?

        Show
        jni Jinfeng Ni added a comment - Julian Hyde , could you please review this small patch ?
        Show
        julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/96cdda29 .
        Hide
        jcamachorodriguez Jesus Camacho Rodriguez added a comment -

        Resolved in release 1.5.0 (2015-11-10)

        Show
        jcamachorodriguez Jesus Camacho Rodriguez added a comment - Resolved in release 1.5.0 (2015-11-10)

          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:

              Development