use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperationsTest method testLessThanEquals.
@Test
public void testLessThanEquals() {
FilterClause clause = getFieldFilter("timestamp", LESS_EQUALS, "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.assertTrue(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 testRegexLikeNull.
@Test
public void testRegexLikeNull() {
FilterClause clause = getFieldFilter("id", REGEX_LIKE, "nu.*");
Assert.assertFalse(FilterOperations.perform(RecordBox.get().getRecord(), clause));
Assert.assertTrue(FilterOperations.perform(RecordBox.get().add("id", "nu").getRecord(), clause));
}
use of com.yahoo.bullet.parsing.FilterClause in project bullet-core by yahoo.
the class FilterOperations method performRelational.
private static boolean performRelational(BulletRecord record, FilterClause clause) {
Clause.Operation operator = clause.getOperation();
if (isEmpty(clause.getValues())) {
return true;
}
TypedObject object = extractTypedObject(clause.getField(), record);
if (operator == Clause.Operation.REGEX_LIKE) {
return REGEX_LIKE.compare(object, clause.getPatterns().stream());
}
return COMPARATORS.get(operator).compare(object, cast(object, clause.getValues()));
}
Aggregations