use of com.yahoo.bullet.parsing.LogicalClause in project bullet-core by yahoo.
the class FilterOperationsTest method testNot.
@Test
public void testNot() {
// NOT(id IN [1, 3, 5] OR field NOT IN ["foo"])
LogicalClause clause = clause(NOT, clause(OR, clause("id", EQUALS, "1", "3", "5"), clause("field", NOT_EQUALS, "foo")));
BulletRecord recordA = RecordBox.get().add("id", 5).add("field", "foo").getRecord();
BulletRecord recordB = RecordBox.get().add("id", 3).add("field", "bar").getRecord();
BulletRecord recordC = RecordBox.get().add("id", 3).getRecord();
BulletRecord recordD = RecordBox.get().add("field", "baz").getRecord();
BulletRecord recordE = RecordBox.get().add("id", 2).add("field", "foo").getRecord();
BulletRecord recordF = RecordBox.get().getRecord();
// Everything is the negation of the testOr checks
Assert.assertFalse(FilterOperations.perform(recordA, clause));
Assert.assertFalse(FilterOperations.perform(recordB, clause));
Assert.assertFalse(FilterOperations.perform(recordC, clause));
Assert.assertFalse(FilterOperations.perform(recordD, clause));
Assert.assertTrue(FilterOperations.perform(recordE, clause));
Assert.assertFalse(FilterOperations.perform(recordF, clause));
}
use of com.yahoo.bullet.parsing.LogicalClause in project bullet-core by yahoo.
the class FilterOperationsTest method testLogicalNoClauses.
@Test
public void testLogicalNoClauses() {
LogicalClause clause = new LogicalClause();
// With empty values, logical always returns true
clause.setOperation(AND);
clause.setClauses(emptyList());
Assert.assertTrue(FilterOperations.perform(RecordBox.get().getRecord(), clause));
}
Aggregations