public ScalarOperator rewrite(ScalarOperator origin) {
        if (origin == null) {
            return null;
        }
        return origin.clone().accept(rewriter, null);
    }
@Test
    public void testRecursiveWithChildren() {
        Map<ColumnRefOperator, ScalarOperator> operatorMap = Maps.newHashMap();
        ColumnRefOperator columnRef1 = createColumnRef(1);
        ColumnRefOperator columnRef2 = createColumnRef(2);
        ColumnRefOperator columnRef3 = createColumnRef(3);

        BinaryPredicateOperator binary = new BinaryPredicateOperator(BinaryType.EQ, columnRef2,
                ConstantOperator.createInt(1));

        operatorMap.put(columnRef1, binary);
        operatorMap.put(columnRef2, columnRef3);

        ReplaceColumnRefRewriter rewriter = new ReplaceColumnRefRewriter(operatorMap, true);
        ColumnRefOperator source = createColumnRef(1);
        ScalarOperator target = rewriter.rewrite(source);
        Assert.assertTrue(target instanceof BinaryPredicateOperator);
        BinaryPredicateOperator rewritten = (BinaryPredicateOperator) target;

        BinaryPredicateOperator result = new BinaryPredicateOperator(BinaryType.EQ, columnRef3,
                ConstantOperator.createInt(1));
        Assert.assertEquals(result, rewritten);

        Map<ColumnRefOperator, ScalarOperator> operatorMap2 = Maps.newHashMap();
        operatorMap.put(columnRef1, columnRef1);
        ReplaceColumnRefRewriter rewriter2 = new ReplaceColumnRefRewriter(operatorMap2, true);
        ScalarOperator result2 = rewriter2.rewrite(columnRef1);
        Assert.assertEquals(columnRef1, result2);
    }