prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
15.75k stars 5.29k forks source link

Presto logicalRowExpressions creating wrong DNF form #22698

Open jaystarshot opened 1 month ago

jaystarshot commented 1 month ago
 @Test
    public void testWrongDnf()
    {
        RowExpression test = new SpecialFormExpression( SpecialFormExpression.Form.OR, BooleanType.BOOLEAN, Arrays.asList(a, b, c, d));

        assertEquals(
                logicalRowExpressions.convertToDisjunctiveNormalForm(test),
                or(or(a, b), or(c, d)),
                "Failed 1,1");
    }

in test Error

Failed 1,1 expected [OR(OR(a, b), OR(c, d))] but found [OR(a, b)]

This test case fails and logicalRowExpressions is unable to create a proper dnf form. This only happens when the specialFormExpression has > 2 arguments This seems to be one of the root cause of https://github.com/prestodb/presto/issues/22147

Your Environment

Expected Behavior

Current Behavior

Possible Solution

Steps to Reproduce

1. 2. 3. 4.

Screenshots (if appropriate)

Context

jaystarshot commented 1 month ago

cc: @kaikalur