[ https://issues.apache.org/jira/browse/CALCITE-2150?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jark Wu updated CALCITE-2150: ----------------------------- 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: {code} 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]] {code} The current_timestamp in the outer Project is reduced as a constant: 2011-07-20 00:00:00 which maybe a bug I think. was: I add two unit test with ReduceExpressionsRule.PROJECT_INSTANCE reduce rule in the commit: [https://github.com/wuchong/calcite/commit/e76c3ad3cc3ddc5c0bb0c3e385a71296329a7cb5] The first 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:}} {{// code placeholder}} {{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.}} > CurrentTimestamp is reduced in subquery > --------------------------------------- > > Key: CALCITE-2150 > URL: https://issues.apache.org/jira/browse/CALCITE-2150 > Project: Calcite > Issue Type: Bug > Reporter: Jark Wu > Assignee: Julian Hyde > Priority: Major > > 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: > > {code} > 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]] > {code} > > The current_timestamp in the outer Project is reduced as a constant: > 2011-07-20 00:00:00 which maybe a bug I think. > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)