public RowExpression extract(PlanNode node)
    {
        return node.accept(new Visitor(domainTranslator, functionAndTypeManager), null);
    }
@Test
    public void testInnerJoin()
    {
        ImmutableList.Builder<EquiJoinClause> criteriaBuilder = ImmutableList.builder();
        criteriaBuilder.add(new EquiJoinClause(AV, DV));
        criteriaBuilder.add(new EquiJoinClause(BV, EV));
        List<EquiJoinClause> criteria = criteriaBuilder.build();

        Map<VariableReferenceExpression, ColumnHandle> leftAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(AV, BV, CV)));
        TableScanNode leftScan = tableScanNode(leftAssignments);

        Map<VariableReferenceExpression, ColumnHandle> rightAssignments = Maps.filterKeys(scanAssignments, Predicates.in(ImmutableList.of(DV, EV, FV)));
        TableScanNode rightScan = tableScanNode(rightAssignments);

        FilterNode left = filter(leftScan,
                and(
                        lessThan(BV, AV),
                        lessThan(CV, bigintLiteral(10)),
                        equals(GV, bigintLiteral(10))));
        FilterNode right = filter(rightScan,
                and(
                        equals(DV, EV),
                        lessThan(FV, bigintLiteral(100))));

        PlanNode node = new JoinNode(
                Optional.empty(),
                newId(),
                JoinType.INNER,
                left,
                right,
                criteria,
                ImmutableList.<VariableReferenceExpression>builder()
                        .addAll(left.getOutputVariables())
                        .addAll(right.getOutputVariables())
                        .build(),
                Optional.of(lessThanOrEqual(BV, EV)),
                Optional.empty(),
                Optional.empty(),
                Optional.empty(),
                ImmutableMap.of());

        RowExpression effectivePredicate = effectivePredicateExtractor.extract(node);

        // All predicates having output symbol should be carried through
        assertEquals(normalizeConjuncts(effectivePredicate),
                normalizeConjuncts(lessThan(BV, AV),
                        lessThan(CV, bigintLiteral(10)),
                        equals(DV, EV),
                        lessThan(FV, bigintLiteral(100)),
                        equals(AV, DV),
                        equals(BV, EV),
                        lessThanOrEqual(BV, EV)));
    }