use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testLessThan.
@Test
public void testLessThan() {
FilterClause clause = getFieldFilter("timestamp", LESS_THAN, "3");
// "NULL" is not > 3
Assert.assertFalse(FilterOperations.perform(RecordBox.get().getRecord(), clause));
Assert.assertTrue(FilterOperations.perform(RecordBox.get().add("timestamp", "2").getRecord(), clause));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().add("timestamp", "3").getRecord(), clause));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().add("timestamp", "4").getRecord(), clause));
}
use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testFilterMissingFields.
@Test
public void testFilterMissingFields() {
FilterClause clause = new FilterClause();
clause.setOperation(EQUALS);
Assert.assertTrue(FilterOperations.perform(RecordBox.get().getRecord(), clause));
clause.setField("field");
Assert.assertTrue(FilterOperations.perform(RecordBox.get().add("field", "foo").getRecord(), clause));
clause.setValues(singletonList("bar"));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().add("field", "foo").getRecord(), clause));
}
use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testNullInValues.
@Test
public void testNullInValues() {
FilterClause clause = getFieldFilter(EQUALS, null, "foo", null);
Assert.assertFalse(FilterOperations.perform(RecordBox.get().getRecord(), clause));
Assert.assertTrue(FilterOperations.perform(RecordBox.get().add("field", "foo").getRecord(), clause));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().add("field", "bar").getRecord(), clause));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().addNull("field").getRecord(), clause));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().add("field", Type.NULL_EXPRESSION).getRecord(), clause));
}
use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testFilterDefaultsWithOperation.
@Test
public void testFilterDefaultsWithOperation() {
FilterClause clause = new FilterClause();
// With non-empty values, filter always returns true
clause.setOperation(EQUALS);
clause.setValues(emptyList());
Assert.assertTrue(FilterOperations.perform(RecordBox.get().getRecord(), clause));
}
use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testGreaterThanEquals.
@Test
public void testGreaterThanEquals() {
FilterClause clause = getFieldFilter("timestamp", GREATER_EQUALS, "3");
// "NULL" is not >= 3
Assert.assertFalse(FilterOperations.perform(RecordBox.get().getRecord(), clause));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().add("timestamp", "2").getRecord(), clause));
Assert.assertTrue(FilterOperations.perform(RecordBox.get().add("timestamp", "3").getRecord(), clause));
Assert.assertTrue(FilterOperations.perform(RecordBox.get().add("timestamp", "4").getRecord(), clause));
}
Aggregations