@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());
}