Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2064

Allow a Convention to declare which sub-classes of RelNode it handles

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

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

      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);
      }
      

      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).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                julianhyde Julian Hyde
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated: