core/src/main/java/org/apache/calcite/rel/rules/FilterJoinRule.java
private List<RexNode> constructConditionFromEqualSets(Join join, List<Set<Integer>> equalSets) {
    final RexBuilder rexBuilder = join.getCluster().getRexBuilder();
    final List<RexNode> result = new ArrayList<>();
    final int leftRowCount = join.getLeft().getRowType().getFieldCount();
    for (Set<Integer> set : equalSets) {
      final List<Integer> leftSet = new ArrayList<>();
      final List<Integer> rightSet = new ArrayList<>();
      for (int i : set) {
        if (i < leftRowCount) {
          leftSet.add(i);
        } else {
          rightSet.add(i);
        }
      }
      // Add left side conditions.
      if (leftSet.size() > 1) {
        for (int i = 1; i < leftSet.size(); ++i) {
          result.add(
              rexBuilder.makeCall(SqlStdOperatorTable.EQUALS,
                  rexBuilder.makeInputRef(join, leftSet.get(0)),
                  rexBuilder.makeInputRef(join, leftSet.get(i))));
        }
      }
      // Add right side conditions.
      if (rightSet.size() > 1) {
        for (int i = 1; i < rightSet.size(); ++i) {
          result.add(
              rexBuilder.makeCall(SqlStdOperatorTable.EQUALS,
                  rexBuilder.makeInputRef(join, rightSet.get(0)),
                  rexBuilder.makeInputRef(join, rightSet.get(i))));
        }
      }
      // Only need one equal condition for each equal set.
      if (leftSet.size() > 0 && rightSet.size() > 0) {
        result.add(
            rexBuilder.makeCall(SqlStdOperatorTable.EQUALS,
                rexBuilder.makeInputRef(join, leftSet.get(0)),
                rexBuilder.makeInputRef(join, rightSet.get(0))));
      }
    }

    return result;
  }
/**
   * Constructs new equal conditions from the equal sets.
   *
   * @param join the original {@link Join} node
   * @param equalSets the equal sets
   * @return the newly constructed conditions from equal sets
   */
Constructs new equal conditions from the equal sets.
@param join the original  Join node
@param equalSets the equal sets
@return the newly constructed conditions from equal sets
Constructs new equal conditions from the equal sets . @param join the original Join node @param equalSets the equal sets @return the newly constructed conditions from equal sets
private List<RexNode> constructConditionFromEqualSets(Join join, List<Set<Integer>> equalSets) {
    final RexBuilder rexBuilder = join.getCluster().getRexBuilder();
    final List<RexNode> result = new ArrayList<>();
    final int leftRowCount = join.getLeft().getRowType().getFieldCount();
    for (Set<Integer> set : equalSets) {
      final List<Integer> leftSet = new ArrayList<>();
      final List<Integer> rightSet = new ArrayList<>();
      for (int i : set) {
        if (i < leftRowCount) {
          leftSet.add(i);
        } else {
          rightSet.add(i);
        }
      }
      if (leftSet.size() > 1) {
        for (int i = 1; i < leftSet.size(); ++i) {
          result.add(
              rexBuilder.makeCall(SqlStdOperatorTable.EQUALS,
                  rexBuilder.makeInputRef(join, leftSet.get(0)),
                  rexBuilder.makeInputRef(join, leftSet.get(i))));
        }
      }
      if (rightSet.size() > 1) {
        for (int i = 1; i < rightSet.size(); ++i) {
          result.add(
              rexBuilder.makeCall(SqlStdOperatorTable.EQUALS,
                  rexBuilder.makeInputRef(join, rightSet.get(0)),
                  rexBuilder.makeInputRef(join, rightSet.get(i))));
        }
      }
      if (leftSet.size() > 0 && rightSet.size() > 0) {
        result.add(
            rexBuilder.makeCall(SqlStdOperatorTable.EQUALS,
                rexBuilder.makeInputRef(join, leftSet.get(0)),
                rexBuilder.makeInputRef(join, rightSet.get(0))));
      }
    }
    return result;
  }
private List < RexNode > constructConditionFromEqualSets ( Join join , List < Set < Integer > > equalSets ) { final RexBuilder rexBuilder = join . getCluster ( ) . getRexBuilder ( ) ; final List < RexNode > result = new ArrayList < > ( ) ; final int leftRowCount = join . getLeft ( ) . getRowType ( ) . getFieldCount ( ) ; for ( Set < Integer > set : equalSets ) { final List < Integer > leftSet = new ArrayList < > ( ) ; final List < Integer > rightSet = new ArrayList < > ( ) ; for ( int i : set ) { if ( i < leftRowCount ) { leftSet . add ( i ) ; } else { rightSet . add ( i ) ; } } if ( leftSet . size ( ) > 1 ) { for ( int i = 1 ; i < leftSet . size ( ) ; ++ i ) { result . add ( rexBuilder . makeCall ( SqlStdOperatorTable . EQUALS , rexBuilder . makeInputRef ( join , leftSet . get ( 0 ) ) , rexBuilder . makeInputRef ( join , leftSet . get ( i ) ) ) ) ; } } if ( rightSet . size ( ) > 1 ) { for ( int i = 1 ; i < rightSet . size ( ) ; ++ i ) { result . add ( rexBuilder . makeCall ( SqlStdOperatorTable . EQUALS , rexBuilder . makeInputRef ( join , rightSet . get ( 0 ) ) , rexBuilder . makeInputRef ( join , rightSet . get ( i ) ) ) ) ; } } if ( leftSet . size ( ) > 0 && rightSet . size ( ) > 0 ) { result . add ( rexBuilder . makeCall ( SqlStdOperatorTable . EQUALS , rexBuilder . makeInputRef ( join , leftSet . get ( 0 ) ) , rexBuilder . makeInputRef ( join , rightSet . get ( 0 ) ) ) ) ; } } return result ; }
Constructs new equal conditions from the equal sets.
Constructs new equal conditions from the equal sets .
// Add left side conditions. // Add right side conditions. // Only need one equal condition for each equal set.