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

Julian Hyde commented on CALCITE-2970:
--------------------------------------

Can we have a new JIRA case focused just on PR 1884? The purpose seems to be to 
switch RelBuilder to create rels of a different convention.

Reviewing the latest 1884:
 * Struct's constructor should remain private (otherwise it will break every 
time we add a new type of RelNode);
 * RelBuilder's struct field should remain final;
 * Change {{setRelFactoriesStruct}} to {{withFactories}} and make it create a 
new {{RelBuilder}} with different config and factories but sharing the same 
stack of RelNodes;
 * need to document the new method in {{algebra.md}}.

(I acknowledge that having a new RelBuilder that shares state with a previous 
RelBuilder is a bit fishy, but less fishy, I think, than mutating the config of 
a RelBuilder. Because people expect that the only thing that mutates in a 
RelBuilder is the stack of rels.)

This makes possible option C:
{code:java}
    // Create a sort operator based on given convention
    Convention toConvention = rel.getConvention();
    RelBuilder builder = ...;
    RelNode sort = builder.push(rel)
        .adopt(toConvention)
        .sort(toCollation)
        .build();
{code}
where the {{RelBuilder.adopt}} method is as follows:
{code:java}
  public final RelBuilder adopt(Convention convention) {
    return convention.transformRelBuilder(this);
  }
{code}
and a typical sub-class of {{Convention}} would implement the 
{{transformRelBuilder}} method like this:
{code:java}
  public RelBuilder transformRelBuilder(RelBuilder builder) {
    return builder.withFactories(FOO_STRUCT);
  }
{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