public static OptExpression bind(Pattern pattern, GroupExpression groupExpression) {
        Binder binder = new Binder(pattern, groupExpression);
        return binder.next();
    }
@Test
    public void testBinderDepth3() {
        OptExpression expr = OptExpression.create(new MockOperator(OperatorType.LOGICAL_PROJECT),
                OptExpression.create(new MockOperator(OperatorType.LOGICAL_JOIN),
                        OptExpression.create(new MockOperator(OperatorType.LOGICAL_OLAP_SCAN, 1)),
                        OptExpression.create(new MockOperator(OperatorType.LOGICAL_PROJECT))),
                OptExpression.create(new MockOperator(OperatorType.LOGICAL_JOIN),
                        OptExpression.create(new MockOperator(OperatorType.LOGICAL_OLAP_SCAN, 2)),
                        OptExpression.create(new MockOperator(OperatorType.LOGICAL_OLAP_SCAN, 3))));

        Pattern pattern1 = Pattern.create(OperatorType.PATTERN_LEAF)
                .addChildren(Pattern.create(OperatorType.LOGICAL_JOIN))
                .addChildren(Pattern.create(OperatorType.PATTERN_LEAF));

        Memo memo = new Memo();
        OptExpression result = Binder.bind(pattern1, memo.init(expr));

        assertEquals(OperatorType.LOGICAL_PROJECT, result.getOp().getOpType());
        assertEquals(OperatorType.LOGICAL_JOIN, result.inputAt(0).getOp().getOpType());
        assertEquals(OperatorType.LOGICAL_JOIN, result.inputAt(1).getOp().getOpType());

        Pattern pattern2 = Pattern.create(OperatorType.LOGICAL_JOIN)
                .addChildren(Pattern.create(OperatorType.LOGICAL_JOIN))
                .addChildren(Pattern.create(OperatorType.PATTERN_LEAF));

        memo = new Memo();
        assertNull(Binder.bind(pattern2, memo.init(expr)));

        Pattern pattern3 = Pattern.create(OperatorType.LOGICAL_PROJECT)
                .addChildren(Pattern.create(OperatorType.LOGICAL_JOIN).addChildren(
                        Pattern.create(OperatorType.PATTERN_LEAF),
                        Pattern.create(OperatorType.PATTERN_LEAF)))
                .addChildren(Pattern.create(OperatorType.LOGICAL_JOIN));

        memo = new Memo();
        result = Binder.bind(pattern3, memo.init(expr));

        assertEquals(OperatorType.LOGICAL_PROJECT, result.getOp().getOpType());
        assertEquals(OperatorType.LOGICAL_JOIN, result.inputAt(0).getOp().getOpType());
        assertEquals(OperatorType.LOGICAL_JOIN, result.inputAt(1).getOp().getOpType());
    }