[ 
https://issues.apache.org/jira/browse/CALCITE-1440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17948015#comment-17948015
 ] 

TJ Banghart commented on CALCITE-1440:
--------------------------------------

I'd like to start working on this.

I see this ticket as the planner foundation for some of the broader multi-query 
optimization (MQO) efforts proposed in 
[CALCITE-6188|https://issues.apache.org/jira/browse/CALCITE-6188]. 
Specifically, enabling the VolcanoPlanner to handle a DAG of queries rather 
than a single tree.

The {{Combine}} operator looks like a good place to start: it avoids changing 
signatures and fits naturally into the existing planner. The {{Combine}} node 
could act as a binder for multiple logical outputs (queries and/or DML as 
discussed in CALCITE-6188), while enabling internal reuse of shared paths 
through Spool operators (CALCITE-481).

I am curious to learn how Flink is handling this with 
[{{CommonSubGraphBasedOptimizer}}|https://github.com/apache/flink/blob/master/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/optimize/CommonSubGraphBasedOptimizer.scala]
 and related classes.

> Implement planner for converting multiple SQL statements to unified RelNode 
> Tree
> --------------------------------------------------------------------------------
>
>                 Key: CALCITE-1440
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1440
>             Project: Calcite
>          Issue Type: New Feature
>            Reporter: Chinmay Kolhatkar
>            Assignee: TJ Banghart
>            Priority: Major
>
> This can be implemented as a separate planner or in {{VolcanoPlanner}} 
> itself. The planner should take multiple SQL statements as input and return a 
> unified {{RelNode}} tree.
> Example of above is as follows:
> {{SELECT COL1, COL2 FROM TABLE WHERE COL3 > 10;}}
> {{SELECT COL1, COL2 FROM TABLE WHERE COL4  = 'abc';}}
> The above 2 statements have a common path and hence can provide a unified 
> {{RelNode}} tree as follows:
> {noformat}
>  [Scan] -> [Project (COL1, COL2)] -> [Filter (COL4 = 'abc')] -> [Delta]
>                     |
>                     V
>             [Filter (COL3 > 10)]
>                     |
>                     v
>                  [Delta]
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to