Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
-
None
Description
I add two unit test with ReduceExpressionsRule.PROJECT_INSTANCE reduce rule in the commit: https://github.com/wuchong/calcite/commit/e76c3ad3cc3ddc5c0bb0c3e385a71296329a7cb5
The first query is "select sal, current_timestamp as t from emp" and the current_timestamp is not reduced as expected.
But the second query "select sal, sal + 5, t from (select sal, current_timestamp as t from emp)" the optimized plan is as following:
LogicalProject(SAL=[$0], EXPR$1=[+($0, 5)], T=[2011-07-20 00:00:00]) LogicalProject(SAL=[$5], T=[CURRENT_TIMESTAMP]) LogicalTableScan(table=[[CATALOG, SALES, EMP]]
The current_timestamp in the outer Project is reduced as a constant: 2011-07-20 00:00:00 which maybe a bug I think.