You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2017/11/21 05:35:01 UTC

[jira] [Created] (CALCITE-2064) Allow a Convention to declare which sub-classes of RelNode it handles

Julian Hyde created CALCITE-2064:
------------------------------------

             Summary: Allow a Convention to declare which sub-classes of RelNode it handles
                 Key: CALCITE-2064
                 URL: https://issues.apache.org/jira/browse/CALCITE-2064
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde
            Assignee: Julian Hyde


Extend {{interface Convention}} so that a convention can declare which sub-classes of RelNode it uses. The method is as follows:

{code}
interface Convention {
  <R extends RelNode>
 Pair<Class<? extends R>, RelFactory<R>> getRelClass(Class<R> clazz);
}

interface RelFactory<R extends RelNode> {
  RelNode copy(R r);
}

interface FilterFactory extends RelFactory<Filter> {
   RelNode createFilter(RelNode input, RexNode condition);
}
{code}

For example, {{FooConvention}} might have classes {{FooFilter}} and {{FooProject}}.
So, {{fooConvention.getRelClass(Filter.class)}} would return a pair, {{(FooFilter.class, new FooFilterFactory())}}.

This is a step towards self-describing conventions. A convention could, for example, walk over a tree of logical RelNodes and transcribe them all to its own sub-class of RelNode. And we could have a RelBuilder produce RelNodes to match a particular convention (emulating what is currently done using RelNode.copy).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)