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

Jinpeng Wu commented on CALCITE-3896:
-------------------------------------

Hi,[~hyuan] 。
 # Got it
 # For example, some rule may decide that a logical agg will fire the one phase 
agg candidate only when input is small enough or by looking in its input, its 
input has already been distributed by the group keys. Well, this case is not 
very good. I am just thinking if there may be some exceptions
 # An actual case that i have come across,the case  AC<-Project(With RexCall), 
could generate 
 ## candidate 1:NONE. It is better when calls are generating data with smaller 
size (like extract a small part of the data from a big json)
 ## candidate 2: Project(With RexCall)<-AC. Better when AC is perfectly match 
children's delivering traits
 ## candidate 3: Project(With RexCalls)<-AC<-Project(Column Pruning Only), 
better column pruning is available
 ## candidate 4: Project(Other RexCalls)<-AC<-Project(Containing part of the 
rexCalls that may shrink data size), we don' t have the exact cost model here. 
So this candidate may produce multiple result that could possibly be the best

> Pass through parent trait requests to child operators
> -----------------------------------------------------
>
>                 Key: CALCITE-3896
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3896
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>            Reporter: Haisheng Yuan
>            Priority: Major
>
> This is not on-demand trait requests as described in [mailing 
> list|http://mail-archives.apache.org/mod_mbox/calcite-dev/201910.mbox/%3cd75b20f4-542a-4a73-897e-66ab426494c1.h.y...@alibaba-inc.com%3e],
>  which requires the overhaul of the core planner. This ticket tries to enable 
> VolcanoPlanner with basic and minimal ability to pass through parent trait 
> request to child operators without rules, though may not be flexible or 
> powerful, but should be able to work with current Calcite application with 
> minimal changes.
> The method for physical operators to implement would be:
> {code:java}
> interface RelNode {
>   RelNode passThrough(RelTraitSet required);
> }
> {code}
> Given that Calcite's physical operators decides its child operators' traits 
> when the physical operator is created in physical implementation rule, there 
> are some drawback that can't be avoided. e.g., given the following plan:
> {code:java}
> StreamAgg on [a]
>    +-- MergeJoin on [a, b, c]
>                |--- TableScan foo
>                +--- TableScan bar
> {code}
> Suppose the MergeJoin implementation rule generates several mergejoins that 
> distributes by [a], [a,b], [a,b,c] separately. Then we pass parent operator 
> StreamAgg's trait request to MergeJoin. Since MergeJoin[a] satisfies parent's 
> request, nothing to do. Next pass request to MergeJoin[a,b], we get 
> MergeJoin[a], then pass request to MergeJoin[a,b,c], we get MergeJoin[a] 
> again. We know they are redundant and there is no need to pass through parent 
> operator's trait request, but these MergeJoin operators are independent and 
> agnostic of each other's existence.
> The ideal way is that in physical implementation rule, during the creation of 
> physical operator, it should not care about itself and its child operators' 
> physical traits. But this is another different topic.
> Anyway, better than nothing, once it is done, we can provide the option to 
> obsolete or disable  {{AbstractConverter}}, but still be able to do property 
> enforcement. 



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

Reply via email to