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

Haisheng Yuan commented on CALCITE-2970:
----------------------------------------

{{changeTraitsUsingConverters()}} doesn't know what physical operator to 
create. But {{Convention.enforce()}} knows exactly that it just needs to create 
a physical enforcer operator of its own convention. In 
{{changeTraitsUsingConverters}}, we just need to change

{code:java}
rel = traitDef.convert(this, converted, toTrait, allowInfiniteCostConverters);
{code}

to 
{code:java}
rel = toConvention.enforce(converted, toTrait);
{code}

In EnumerableConvention, we just need
{code:java}
public enum EnumerableConvention implements Convention {
  public RelNode enforce(RelNode input, RelTrait trait) {
    if (trait.getTraitDef() == RelCollationTraitDef.INSTANCE) {
      return EnumerableSort.create(input, (RelCollation) trait, null, null);
    }
    return null;
  }
}
{code}



> Performance issue when enabling abstract converter for EnumerableConvention
> ---------------------------------------------------------------------------
>
>                 Key: CALCITE-2970
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2970
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Haisheng Yuan
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 11h 20m
>  Remaining Estimate: 0h
>
> If we enable the use of abstract converter for {{EnumerableConvention}}, by 
> making {{useAbstractConvertersForConversion}} return true, 
> {{JDBCTest.testJoinManyWay}} will not complete.



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

Reply via email to