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

Xiening Dai commented on CALCITE-3972:
--------------------------------------

We discover that with this change there are a few rules (SortProjectTranspose, 
SortJoinTranspose, SortJoinCopy, etc) which choose to match LogicalSort won't 
fire on the EnumerableSort enforcer. Although all the UTs are passed, 
potentially there are missing opportunities for better plans. And it cannot be 
fixed by simply adding an enumerable instance of the rule (to match Enumerable 
join and sort instead) because the rule implementation today doesn't consider 
join input trait requirement, and would generate a wrong alternative. So it 
feels to me that to solve this problem completely, we should use the trait 
propagation framework instead (CALCITE-3896) and deprecate these rules in long 
run. 

So part of this change - generating EnumerableSort during trait convert, would 
have to be removed. But I still see other usage scenarios of RelBuilder with 
conventions. I would like to still commit this change, so I can work on 
subsequent issues (such as CALCITE-3455).

> Allow RelBuilder to create RelNode with convention and use it for trait 
> convert
> -------------------------------------------------------------------------------
>
>                 Key: CALCITE-3972
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3972
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Xiening Dai
>            Assignee: Xiening Dai
>            Priority: Major
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> 1. Provide Convention.transformRelBuilder() to transform an existing 
> RelBuilder into one with specific convention.
> 2. RelBuilder provides withRelFactories() method to allow caller swap the 
> underlying RelFactories and create a new builder. 
> 3. Use the new interface in RelCollationTraitDef for converting into 
> RelCollation traits
> We can avoid ~1/3 of total rule firings in a N way join case with this change.



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

Reply via email to