Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2150

CurrentTimestamp is reduced in subquery

    XMLWordPrintableJSON

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.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            jark Jark Wu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: