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

Stamatis Zampetakis commented on CALCITE-2970:
----------------------------------------------

Before talking about code that is not there yet let's see the difference for 
our actual need:

+Version A+
{code:java}
// Create a sort operator based on given convention
    Convention toConvention = rel.getConvention();
    RelBuilder builder =
        RelFactories.LOGICAL_BUILDER.create(rel.getCluster(), null);
    builder = toConvention.transformRelBuilder(builder);
    RelNode sort = builder.push(rel)
                          .sort(toCollation)
                          .build();
{code}
vs.

+Version B+
{code:java}
// Create a sort operator based on given convention
    Convention toConvention = rel.getConvention();
    RelBuilder builder = toConvention.getRelFactory().create(rel.getCluster(), 
null);
    RelNode sort = builder.push(rel)
                          .sort(toCollation)
                          .build();
{code}
 I think that code in Version B is more readable. Plus there is no need to add 
more methods in RelBuilder which also remains immutable as before.

The example outlined by [~xndai] previously demonstrates that we may need to 
obtain a builder from a call and switch it to generate Enumerable operators but 
which rules need this kind of transformation?

In terms of rules and calls, I was thinking that it may be useful at some 
points to obtain a builder like below:

{code:java}
RelNode node = call.rel(0);
RelBuilder builder = 
node.getConvention().getRelFactory().create(node.getCluster(),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: 18h 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