You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "anjali shrishrimal (Jira)" <ji...@apache.org> on 2020/02/19 09:57:00 UTC

[jira] [Created] (CALCITE-3806) How to optimize repeated RelNode Structures ?

anjali shrishrimal created CALCITE-3806:
-------------------------------------------

             Summary: How to optimize repeated RelNode Structures ?
                 Key: CALCITE-3806
                 URL: https://issues.apache.org/jira/browse/CALCITE-3806
             Project: Calcite
          Issue Type: Wish
          Components: core
            Reporter: anjali shrishrimal


Let's say input structure looks like this :
{noformat}
LogicalUnion(all=[true])
  LogicalProject(EMPNO=[$0])
    LogicalFilter(condition=[>=($0, 7369)])
      LogicalTableScan(table=[[scott, EMP]])
  LogicalProject(EMPNO=[$0])
    LogicalFilter(condition=[>=($0, 7369)])
      LogicalTableScan(table=[[scott, EMP]]){noformat}
 

In this case,
{noformat}
  LogicalProject(EMPNO=[$0])
    LogicalFilter(condition=[>=($0, 7369)])
      LogicalTableScan(table=[[scott, EMP]]){noformat}
is repeated. It is going to fetch same data twice.

Can we save one fetch? Can we somehow tell 2nd input of union to make use of union's 1st input. Is there any way to express that in plan?

 

Also,
If the structure was like this :
{noformat}
LogicalUnion(all=[true])
  LogicalProject(EMPNO=[$0])
    LogicalFilter(condition=[>=($0, 7369)])
      LogicalTableScan(table=[[scott, EMP]])
  LogicalProject(EMPNO=[$0])
    LogicalFilter(condition=[>=($0, 8000)])
      LogicalTableScan(table=[[scott, EMP]]){noformat}

Second part of union can perform filtering on fetched data of 1st part. (As second's output is subset of first's output)

 

Does calcite provide such kind of optimizations ?

If not, what are the challenges to do so?

 

 

I would appreciate some comments on this. Thank you.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)