Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
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.