You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Jark Wu (JIRA)" <ji...@apache.org> on 2018/01/25 05:58:00 UTC

[jira] [Created] (CALCITE-2150) CurrentTimestamp is reduced in subquery

Jark Wu created CALCITE-2150:
--------------------------------

             Summary: 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


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.}}

 

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)