public static RowExpression rewriteExpressionWithCSE(RowExpression expression, Map<RowExpression, VariableReferenceExpression> rewriteWith)
    {
        ExpressionRewriter rewriter = new ExpressionRewriter(rewriteWith);
        return expression.accept(rewriter, null);
    }
@Test
    void testRewriteExpressionWithCSE()
    {
        assertEquals(
                rewriteExpressionWithCSE(
                        rowExpression("(x * y + z) * (y + z) + (x * y)"),
                        ImmutableMap.of(
                                rowExpression("x * y"), variable("multiply$cse"),
                                rowExpression("y + z"), variable("add$cse"),
                                rowExpression("\"multiply$cse\" + z"), variable("add$cse_0"))),
                rowExpression("\"add$cse_0\" * \"add$cse\" + \"multiply$cse\""));
    }