core/src/main/java/org/apache/calcite/rel/rules/FilterJoinRule.java
private List<Set<Integer>> splitEqualSets(List<RexNode> rexNodes, List<RexNode> leftNodes) {
    final List<Set<Integer>> equalSets = new ArrayList<>();
    for (RexNode rexNode : rexNodes) {
      if (rexNode.isA(SqlKind.EQUALS)) {
        final RexNode op1 = ((RexCall) rexNode).getOperands().get(0);
        final RexNode op2 = ((RexCall) rexNode).getOperands().get(1);
        if (op1 instanceof RexInputRef && op2 instanceof RexInputRef) {
          final RexInputRef in1 = (RexInputRef) op1;
          final RexInputRef in2 = (RexInputRef) op2;
          Set<Integer> set = null;
          for (Set<Integer> s : equalSets) {
            if (s.contains(in1.getIndex()) || s.contains(in2.getIndex())) {
              set = s;
              break;
            }
          }
          if (set == null) {
            // To make the result deterministic.
            set = new LinkedHashSet<>();
            equalSets.add(set);
          }
          set.add(in1.getIndex());
          set.add(in2.getIndex());
        } else {
          leftNodes.add(rexNode);
        }
      } else {
        leftNodes.add(rexNode);
      }
    }

    return equalSets;
  }
/**
   * Splits out the equal sets.
   *
   * @param rexNodes the original conditions
   * @param leftNodes where the conditions not feasible for equal sets are put
   * @return the equal sets
   */
Splits out the equal sets.
@param rexNodes the original conditions
@param leftNodes where the conditions not feasible for equal sets are put
@return the equal sets
Splits out the equal sets . @param rexNodes the original conditions @param leftNodes where the conditions not feasible for equal sets are put @return the equal sets
private List<Set<Integer>> splitEqualSets(List<RexNode> rexNodes, List<RexNode> leftNodes) {
    final List<Set<Integer>> equalSets = new ArrayList<>();
    for (RexNode rexNode : rexNodes) {
      if (rexNode.isA(SqlKind.EQUALS)) {
        final RexNode op1 = ((RexCall) rexNode).getOperands().get(0);
        final RexNode op2 = ((RexCall) rexNode).getOperands().get(1);
        if (op1 instanceof RexInputRef && op2 instanceof RexInputRef) {
          final RexInputRef in1 = (RexInputRef) op1;
          final RexInputRef in2 = (RexInputRef) op2;
          Set<Integer> set = null;
          for (Set<Integer> s : equalSets) {
            if (s.contains(in1.getIndex()) || s.contains(in2.getIndex())) {
              set = s;
              break;
            }
          }
          if (set == null) {
            set = new LinkedHashSet<>();
            equalSets.add(set);
          }
          set.add(in1.getIndex());
          set.add(in2.getIndex());
        } else {
          leftNodes.add(rexNode);
        }
      } else {
        leftNodes.add(rexNode);
      }
    }
    return equalSets;
  }
private List < Set < Integer > > splitEqualSets ( List < RexNode > rexNodes , List < RexNode > leftNodes ) { final List < Set < Integer > > equalSets = new ArrayList < > ( ) ; for ( RexNode rexNode : rexNodes ) { if ( rexNode . isA ( SqlKind . EQUALS ) ) { final RexNode op1 = ( ( RexCall ) rexNode ) . getOperands ( ) . get ( 0 ) ; final RexNode op2 = ( ( RexCall ) rexNode ) . getOperands ( ) . get ( 1 ) ; if ( op1 instanceof RexInputRef && op2 instanceof RexInputRef ) { final RexInputRef in1 = ( RexInputRef ) op1 ; final RexInputRef in2 = ( RexInputRef ) op2 ; Set < Integer > set = null ; for ( Set < Integer > s : equalSets ) { if ( s . contains ( in1 . getIndex ( ) ) || s . contains ( in2 . getIndex ( ) ) ) { set = s ; break ; } } if ( set == null ) { set = new LinkedHashSet < > ( ) ; equalSets . add ( set ) ; } set . add ( in1 . getIndex ( ) ) ; set . add ( in2 . getIndex ( ) ) ; } else { leftNodes . add ( rexNode ) ; } } else { leftNodes . add ( rexNode ) ; } } return equalSets ; }
Splits out the equal sets.
Splits out the equal sets .
// To make the result deterministic.