/**
   * Creates a <code>VolcanoRuleMatch</code>.
   *
   * @param operand0 Primary operand
   * @param rels List of targets; copied by the constructor, so the client can modify it later
   * @pre rels[i] != null
   */
  VolcanoRuleMatch(VolcanoPlanner volcanoPlanner, RelOptRuleOperand operand0, RelNode[] rels) {
    super(volcanoPlanner, operand0, rels.clone());
    this.volcanoPlanner = volcanoPlanner;
    for (int i = 0; i < rels.length; i++) {
      assert rels[i] != null;
    }

    // Try to deduce which subset the result will belong to. Assume --
    // for now -- that the set is the same as the root relexp.
    targetSet = volcanoPlanner.getSet(rels[0]);
    assert targetSet != null : rels[0].toString() + " isn't in a set";
    digest = computeDigest();
  }