use of org.apache.iceberg.expressions.Not in project iceberg by apache.
the class TestHiveIcebergFilterFactory method testNotEqualsOperand.
@Test
public void testNotEqualsOperand() {
SearchArgument.Builder builder = SearchArgumentFactory.newBuilder();
SearchArgument arg = builder.startNot().equals("salary", PredicateLeaf.Type.LONG, 3000L).end().build();
Not expected = (Not) Expressions.not(Expressions.equal("salary", 3000L));
Not actual = (Not) HiveIcebergFilterFactory.generateFilterExpression(arg);
UnboundPredicate childExpressionActual = (UnboundPredicate) actual.child();
UnboundPredicate childExpressionExpected = Expressions.equal("salary", 3000L);
assertEquals(actual.op(), expected.op());
assertEquals(actual.child().op(), expected.child().op());
assertEquals(childExpressionActual.ref().name(), childExpressionExpected.ref().name());
assertEquals(childExpressionActual.literal(), childExpressionExpected.literal());
}
use of org.apache.iceberg.expressions.Not in project hive by apache.
the class TestHiveIcebergFilterFactory method testNotEqualsOperand.
@Test
public void testNotEqualsOperand() {
SearchArgument.Builder builder = SearchArgumentFactory.newBuilder();
SearchArgument arg = builder.startNot().equals("salary", PredicateLeaf.Type.LONG, 3000L).end().build();
Not expected = (Not) Expressions.not(Expressions.equal("salary", 3000L));
Not actual = (Not) HiveIcebergFilterFactory.generateFilterExpression(arg);
UnboundPredicate childExpressionActual = (UnboundPredicate) actual.child();
UnboundPredicate childExpressionExpected = Expressions.equal("salary", 3000L);
assertEquals(actual.op(), expected.op());
assertEquals(actual.child().op(), expected.child().op());
assertEquals(childExpressionActual.ref().name(), childExpressionExpected.ref().name());
assertEquals(childExpressionActual.literal(), childExpressionExpected.literal());
}
use of org.apache.iceberg.expressions.Not in project iceberg by apache.
the class TestFlinkFilters method testNot.
@Test
public void testNot() {
Expression expr = resolve(ApiExpressionUtils.unresolvedCall(BuiltInFunctionDefinitions.NOT, Expressions.$("field1").isEqual(Expressions.lit(1))));
Optional<org.apache.iceberg.expressions.Expression> actual = FlinkFilters.convert(expr);
Assert.assertTrue("Conversion should succeed", actual.isPresent());
Not not = (Not) actual.get();
Not expected = (Not) org.apache.iceberg.expressions.Expressions.not(org.apache.iceberg.expressions.Expressions.equal("field1", 1));
Assert.assertEquals("Predicate operation should match", expected.op(), not.op());
assertPredicatesMatch(expected.child(), not.child());
}
Aggregations