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

RelOptPlannerRule should be able to match one child and ignore another

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      If a relational expression has more than one input, for example a join, then one should be able to write a `RelOptPlannerRule` that matches one child and ignores another.

      Currently one writes a rule that matches both children, but if the input is uninteresting, the operand specifies just 'RelNode'. This means that the operand, will match, hence the rule will fire, for each RelNode in that subset.

      Example:

        public static final PushJoinThroughUnionRule LEFT_UNION =
            new PushJoinThroughUnionRule(
                operand(JoinRel.class,
                    operand(UnionRel.class, any()),
                    operand(RelNode.class, any())),
                "union on left");
      
        public static final PushJoinThroughUnionRule RIGHT_UNION =
            new PushJoinThroughUnionRule(
                operand(JoinRel.class,
                    operand(RelNode.class, any()),
                    operand(UnionRel.class, any())),
                "union on right");
      

      One should be able to write:

        public static final PushJoinThroughUnionRule LEFT_UNION =
            new PushJoinThroughUnionRule(
                operand(JoinRel.class,
                    childOperand(0, UnionRel.class, any())),
                "union on left");
      
        public static final PushJoinThroughUnionRule RIGHT_UNION =
            new PushJoinThroughUnionRule(
                operand(JoinRel.class,
                    childOperand(1, UnionRel.class, any())),
                "union on right");
      

      In addition to being terser to write, these rules will fire significantly less often.

      ---------------- Imported from GitHub ----------------
      Url: https://github.com/julianhyde/optiq/issues/260
      Created by: [julianhyde|https://github.com/julianhyde]
      Labels: 
      Created at: Fri Apr 25 08:06:44 CEST 2014
      State: open
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              github-import GitHub Import
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: