use of com.facebook.presto.sql.tree.InListExpression in project presto by prestodb.
the class TestDomainTranslator method testFromUnprocessableInPredicate.
@Test
public void testFromUnprocessableInPredicate() throws Exception {
Expression originalExpression = new InPredicate(unprocessableExpression1(C_BIGINT), new InListExpression(ImmutableList.of(TRUE_LITERAL)));
ExtractionResult result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), originalExpression);
assertTrue(result.getTupleDomain().isAll());
originalExpression = new InPredicate(C_BOOLEAN.toSymbolReference(), new InListExpression(ImmutableList.of(unprocessableExpression1(C_BOOLEAN))));
result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), equal(C_BOOLEAN, unprocessableExpression1(C_BOOLEAN)));
assertTrue(result.getTupleDomain().isAll());
originalExpression = new InPredicate(C_BOOLEAN.toSymbolReference(), new InListExpression(ImmutableList.of(TRUE_LITERAL, unprocessableExpression1(C_BOOLEAN))));
result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), or(equal(C_BOOLEAN, TRUE_LITERAL), equal(C_BOOLEAN, unprocessableExpression1(C_BOOLEAN))));
assertTrue(result.getTupleDomain().isAll());
// Test complement
originalExpression = not(new InPredicate(C_BOOLEAN.toSymbolReference(), new InListExpression(ImmutableList.of(unprocessableExpression1(C_BOOLEAN)))));
result = fromPredicate(originalExpression);
assertEquals(result.getRemainingExpression(), not(equal(C_BOOLEAN, unprocessableExpression1(C_BOOLEAN))));
assertTrue(result.getTupleDomain().isAll());
}
Aggregations