use of org.apache.iceberg.expressions.UnboundPredicate in project hive by apache.
the class TestHiveIcebergFilterFactory method testBooleanType.
@Test
public void testBooleanType() {
SearchArgument.Builder builder = SearchArgumentFactory.newBuilder();
SearchArgument arg = builder.startAnd().equals("boolean", PredicateLeaf.Type.BOOLEAN, true).end().build();
UnboundPredicate expected = Expressions.equal("boolean", true);
UnboundPredicate actual = (UnboundPredicate) HiveIcebergFilterFactory.generateFilterExpression(arg);
assertPredicatesMatch(expected, actual);
}
use of org.apache.iceberg.expressions.UnboundPredicate in project hive by apache.
the class TestHiveIcebergFilterFactory method testLessThanOperand.
@Test
public void testLessThanOperand() {
SearchArgument.Builder builder = SearchArgumentFactory.newBuilder();
SearchArgument arg = builder.startAnd().lessThan("salary", PredicateLeaf.Type.LONG, 3000L).end().build();
UnboundPredicate expected = Expressions.lessThan("salary", 3000L);
UnboundPredicate actual = (UnboundPredicate) HiveIcebergFilterFactory.generateFilterExpression(arg);
assertEquals(actual.op(), expected.op());
assertEquals(actual.literal(), expected.literal());
assertEquals(actual.ref().name(), expected.ref().name());
}
use of org.apache.iceberg.expressions.UnboundPredicate in project hive by apache.
the class TestHiveIcebergFilterFactory method testIsNullOperand.
@Test
public void testIsNullOperand() {
SearchArgument.Builder builder = SearchArgumentFactory.newBuilder();
SearchArgument arg = builder.startAnd().isNull("salary", PredicateLeaf.Type.LONG).end().build();
UnboundPredicate expected = Expressions.isNull("salary");
UnboundPredicate actual = (UnboundPredicate) HiveIcebergFilterFactory.generateFilterExpression(arg);
assertEquals(actual.op(), expected.op());
assertEquals(actual.ref().name(), expected.ref().name());
}
use of org.apache.iceberg.expressions.UnboundPredicate 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.UnboundPredicate in project hive by apache.
the class TestHiveIcebergFilterFactory method testLessThanEqualsOperand.
@Test
public void testLessThanEqualsOperand() {
SearchArgument.Builder builder = SearchArgumentFactory.newBuilder();
SearchArgument arg = builder.startAnd().lessThanEquals("salary", PredicateLeaf.Type.LONG, 3000L).end().build();
UnboundPredicate expected = Expressions.lessThanOrEqual("salary", 3000L);
UnboundPredicate actual = (UnboundPredicate) HiveIcebergFilterFactory.generateFilterExpression(arg);
assertPredicatesMatch(expected, actual);
}
Aggregations