public RowExpression rewriteExpression(RowExpression expression, Predicate<VariableReferenceExpression> variableScope)
    {
        checkArgument(determinismEvaluator.isDeterministic(expression), "Only deterministic expressions may be considered for rewrite");
        return rewriteExpression(expression, variableScope, true);
    }
@Test
    public void testExtractInferableEqualities()
    {
        EqualityInference inference = new EqualityInference.Builder(METADATA)
                .extractInferenceCandidates(and(equals("a1", "b1"), equals("b1", "c1"), someExpression("c1", "d1")))
                .build();

        // Able to rewrite to c1 due to equalities
        assertEquals(variable("c1"), inference.rewriteExpression(variable("a1"), matchesVariables("c1")));

        // But not be able to rewrite to d1 which is not connected via equality
        assertNull(inference.rewriteExpression(variable("a1"), matchesVariables("d1")));
    }