Examples of InPredicate


Examples of com.facebook.presto.sql.tree.InPredicate

    @Test
    public void testFromUnprocessableInPredicate()
            throws Exception
    {
        Expression originalExpression = new InPredicate(unprocessableExpression1(A), new InListExpression(ImmutableList.<Expression>of(TRUE_LITERAL)));
        ExtractionResult result = fromPredicate(MANAGER, TEST_SESSION, originalExpression, TYPES, COLUMN_HANDLES);
        Assert.assertEquals(result.getRemainingExpression(), originalExpression);
        Assert.assertTrue(result.getTupleDomain().isAll());

        originalExpression = new InPredicate(reference(D), new InListExpression(ImmutableList.<Expression>of(unprocessableExpression1(D))));
        result = fromPredicate(MANAGER, TEST_SESSION, originalExpression, TYPES, COLUMN_HANDLES);
        Assert.assertEquals(result.getRemainingExpression(), equal(D, unprocessableExpression1(D)));
        Assert.assertTrue(result.getTupleDomain().isAll());

        originalExpression = new InPredicate(reference(D), new InListExpression(ImmutableList.<Expression>of(TRUE_LITERAL, unprocessableExpression1(D))));
        result = fromPredicate(MANAGER, TEST_SESSION, originalExpression, TYPES, COLUMN_HANDLES);
        Assert.assertEquals(result.getRemainingExpression(), or(equal(D, TRUE_LITERAL), equal(D, unprocessableExpression1(D))));
        Assert.assertTrue(result.getTupleDomain().isAll());

        // Test complement
        originalExpression = not(new InPredicate(reference(D), new InListExpression(ImmutableList.<Expression>of(unprocessableExpression1(D)))));
        result = fromPredicate(MANAGER, TEST_SESSION, originalExpression, TYPES, COLUMN_HANDLES);
        Assert.assertEquals(result.getRemainingExpression(), not(equal(D, unprocessableExpression1(D))));
        Assert.assertTrue(result.getTupleDomain().isAll());
    }
View Full Code Here

Examples of com.facebook.presto.sql.tree.InPredicate

    }

    private static InPredicate in(Symbol symbol, List<?> values)
    {
        Type type = TYPES.get(symbol);
        return new InPredicate(reference(symbol), new InListExpression(LiteralInterpreter.toExpressions(values, Collections.nCopies(values.size(), type))));
    }
View Full Code Here

Examples of com.facebook.presto.sql.tree.InPredicate

        // Add back all of the possible single values either as an equality or an IN predicate
        if (singleValues.size() == 1) {
            disjuncts.add(new ComparisonExpression(EQUAL, reference, getOnlyElement(singleValues)));
        }
        else if (singleValues.size() > 1) {
            disjuncts.add(new InPredicate(reference, new InListExpression(singleValues)));
        }

        // Add nullability disjuncts
        checkState(!disjuncts.isEmpty());
        if (domain.isNullAllowed()) {
View Full Code Here

Examples of com.facebook.presto.sql.tree.InPredicate

            if (found) {
                return true;
            }

            if (hasUnresolvedValue) {
                return new InPredicate(toExpression(value), new InListExpression(toExpressions(values)));
            }
            if (hasNullValue) {
                return null;
            }
            return false;
View Full Code Here

Examples of com.facebook.presto.sql.tree.InPredicate

            if (found) {
                return true;
            }

            if (hasUnresolvedValue) {
                return new InPredicate(toExpression(value), new InListExpression(toExpressions(values)));
            }
            if (hasNullValue) {
                return null;
            }
            return false;
View Full Code Here

Examples of com.facebook.presto.sql.tree.InPredicate

                return true;
            }

            if (hasUnresolvedValue) {
                Type type = expressionTypes.get(node.getValue());
                return new InPredicate(toExpression(value, type), new InListExpression(toExpressions(values, types)));
            }
            if (hasNullValue) {
                return null;
            }
            return false;
View Full Code Here

Examples of com.facebook.presto.sql.tree.InPredicate

            if (found) {
                return true;
            }

            if (hasUnresolvedValue) {
                return new InPredicate(toExpression(value), new InListExpression(toExpressions(values)));
            }
            if (hasNullValue) {
                return null;
            }
            return false;
View Full Code Here

Examples of com.facebook.presto.sql.tree.InPredicate

        // Add back all of the possible single values either as an equality or an IN predicate
        if (singleValues.size() == 1) {
            disjuncts.add(new ComparisonExpression(EQUAL, reference, getOnlyElement(singleValues)));
        }
        else if (singleValues.size() > 1) {
            disjuncts.add(new InPredicate(reference, new InListExpression(singleValues)));
        }

        // Add nullability disjuncts
        checkState(!disjuncts.isEmpty());
        if (domain.isNullAllowed()) {
View Full Code Here

Examples of com.facebook.presto.sql.tree.InPredicate

                return true;
            }

            if (hasUnresolvedValue) {
                Type type = expressionTypes.get(node.getValue());
                return new InPredicate(toExpression(value, type), new InListExpression(toExpressions(values, types)));
            }
            if (hasNullValue) {
                return null;
            }
            return false;
View Full Code Here

Examples of com.facebook.presto.sql.tree.InPredicate

                return true;
            }

            if (hasUnresolvedValue) {
                Type type = expressionTypes.get(node.getValue());
                return new InPredicate(toExpression(value, type), new InListExpression(toExpressions(values, types)));
            }
            if (hasNullValue) {
                return null;
            }
            return false;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.