Source:
public void testInnerJoin() { ImmutableList.Builder<JoinNode.EquiJoinClause> criteriaBuilder = ImmutableList.builder(); criteriaBuilder.add(new JoinNode.EquiJoinClause(A, D)); criteriaBuilder.add(new JoinNode.EquiJoinClause(B, E)); List<JoinNode.EquiJoinClause> criteria = criteriaBuilder.build(); Map<Symbol, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C))); TableScanNode leftScan = new TableScanNode( newId(), DUAL_TABLE_HANDLE, ImmutableList.copyOf(leftAssignments.keySet()), leftAssignments, Optional.empty(), TupleDomain.all(), TupleDomain.all()); Map<Symbol, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(D, E, F))); TableScanNode rightScan = new TableScanNode( newId(), DUAL_TABLE_HANDLE, ImmutableList.copyOf(rightAssignments.keySet()), rightAssignments, Optional.empty(), TupleDomain.all(), TupleDomain.all()); FilterNode left = filter(leftScan, and( lessThan(BE, AE), lessThan(CE, bigintLiteral(10)), equals(GE, bigintLiteral(10)))); FilterNode right = filter(rightScan, and( equals(DE, EE), lessThan(FE, bigintLiteral(100)))); PlanNode node = new JoinNode(newId(), JoinNode.Type.INNER, left, right, criteria, ImmutableList.<Symbol>builder() .addAll(left.getOutputSymbols()) .addAll(right.getOutputSymbols()) .build(), Optional.of(lessThan(BE, EE)), Optional.empty(), Optional.empty(), Optional.empty()); Expression effectivePredicate = effectivePredicateExtractor.extract(node); assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(lessThan(BE, AE), lessThan(CE, bigintLiteral(10)), equals(DE, EE), lessThan(FE, bigintLiteral(100)), equals(AE, DE), equals(BE, EE), lessThan(BE, EE))); }

Target:
public void testInnerJoin() { ImmutableList.Builder<JoinNode.EquiJoinClause> criteriaBuilder = ImmutableList.builder(); criteriaBuilder.add(new JoinNode.EquiJoinClause(A, D)); criteriaBuilder.add(new JoinNode.EquiJoinClause(B, E)); List<JoinNode.EquiJoinClause> criteria = criteriaBuilder.build(); Map<Symbol, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(A, B, C))); TableScanNode leftScan = tableScanNode(leftAssignments); Map<Symbol, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(D, E, F))); TableScanNode rightScan = tableScanNode(rightAssignments); FilterNode left = filter(leftScan, and( lessThan(BE, AE), lessThan(CE, bigintLiteral(10)), equals(GE, bigintLiteral(10)))); FilterNode right = filter(rightScan, and( equals(DE, EE), lessThan(FE, bigintLiteral(100)))); PlanNode node = new JoinNode(newId(), JoinNode.Type.INNER, left, right, criteria, ImmutableList.<Symbol>builder() .addAll(left.getOutputSymbols()) .addAll(right.getOutputSymbols()) .build(), Optional.of(lessThanOrEqual(BE, EE)), Optional.empty(), Optional.empty(), Optional.empty()); Expression effectivePredicate = effectivePredicateExtractor.extract(node); assertEquals(normalizeConjuncts(effectivePredicate), normalizeConjuncts(lessThan(BE, AE), lessThan(CE, bigintLiteral(10)), equals(DE, EE), lessThan(FE, bigintLiteral(100)), equals(AE, DE), equals(BE, EE), lessThanOrEqual(BE, EE))); }