use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testFilterDefaults.
// ***************************************** Filter Clause *********************************************************
@Test(expectedExceptions = NullPointerException.class)
public void testFilterDefaults() {
FilterClause clause = new FilterClause();
clause.setValues(asList("foo", "bar"));
// Without an operation, it is an error
FilterOperations.perform(RecordBox.get().getRecord(), clause);
}
use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testEquals.
@Test
public void testEquals() {
FilterClause clause = getFieldFilter(EQUALS, "foo", "bar");
Assert.assertFalse(FilterOperations.perform(RecordBox.get().getRecord(), clause));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().add("field", "baz").getRecord(), clause));
Assert.assertTrue(FilterOperations.perform(RecordBox.get().add("field", "foo").getRecord(), clause));
Assert.assertTrue(FilterOperations.perform(RecordBox.get().add("field", "bar").getRecord(), clause));
}
use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testComparisonBooleanMap.
@Test
public void testComparisonBooleanMap() {
FilterClause clause = getFieldFilter("filter_map.is_fake_event", EQUALS, "true");
// "null" is not true
Assert.assertFalse(FilterOperations.perform(RecordBox.get().getRecord(), clause));
RecordBox box = RecordBox.get();
Assert.assertFalse(FilterOperations.perform(box.getRecord(), clause));
box.addMap("filter_map", Pair.of("is_fake_event", true));
Assert.assertTrue(FilterOperations.perform(box.getRecord(), clause));
box.addMap("filter_map", Pair.of("is_fake_event", false));
Assert.assertFalse(FilterOperations.perform(box.getRecord(), clause));
}
use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testNotEquals.
@Test
public void testNotEquals() {
FilterClause clause = getFieldFilter(NOT_EQUALS, "foo", "bar", "null");
Assert.assertFalse(FilterOperations.perform(RecordBox.get().getRecord(), clause));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().add("field", "foo").getRecord(), clause));
Assert.assertFalse(FilterOperations.perform(RecordBox.get().add("field", "bar").getRecord(), clause));
Assert.assertTrue(FilterOperations.perform(RecordBox.get().add("field", "baz").getRecord(), clause));
}
use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testComparisonUncastable.
@Test
public void testComparisonUncastable() {
FilterClause clause = getFieldFilter("unreal", EQUALS, "1.23", "4.56");
RecordBox box = RecordBox.get().add("unreal", 123L);
// Trying to cast
Assert.assertFalse(FilterOperations.perform(box.getRecord(), clause));
}
Aggregations