use of org.apache.parquet.filter2.predicate.Operators.BinaryColumn in project parquet-mr by apache.
the class TestRecordLevelFilters method testNameNotStartWithP.
@Test
public void testNameNotStartWithP() throws Exception {
BinaryColumn name = binaryColumn("name");
FilterPredicate pred = not(userDefined(name, StartWithP.class));
List<Group> found = PhoneBookWriter.readFile(phonebookFile, FilterCompat.get(pred));
assertFilter(found, new UserFilter() {
@Override
public boolean keep(User u) {
return u.getName() == null || !u.getName().startsWith("p");
}
});
}
use of org.apache.parquet.filter2.predicate.Operators.BinaryColumn in project parquet-mr by apache.
the class TestRecordLevelFilters method testNameNotNull.
@Test
public void testNameNotNull() throws Exception {
BinaryColumn name = binaryColumn("name");
FilterPredicate pred = notEq(name, null);
List<Group> found = PhoneBookWriter.readFile(phonebookFile, FilterCompat.get(pred));
assertFilter(found, new UserFilter() {
@Override
public boolean keep(User u) {
return u.getName() != null;
}
});
}
use of org.apache.parquet.filter2.predicate.Operators.BinaryColumn in project parquet-mr by apache.
the class DictionaryFilterTest method testGtEqMissingColumn.
@Test
public void testGtEqMissingColumn() throws Exception {
BinaryColumn b = binaryColumn("missing_column");
assertTrue("Should drop block for any non-null query", canDrop(gtEq(b, Binary.fromString("any")), ccmd, dictionaries));
}
use of org.apache.parquet.filter2.predicate.Operators.BinaryColumn in project parquet-mr by apache.
the class DictionaryFilterTest method testAnd.
@Test
public void testAnd() throws Exception {
BinaryColumn col = binaryColumn("binary_field");
// both evaluate to false (no upper-case letters are in the dictionary)
FilterPredicate B = eq(col, Binary.fromString("B"));
FilterPredicate C = eq(col, Binary.fromString("C"));
// both evaluate to true (all lower-case letters are in the dictionary)
FilterPredicate x = eq(col, Binary.fromString("x"));
FilterPredicate y = eq(col, Binary.fromString("y"));
assertTrue("Should drop when either predicate must be false", canDrop(and(B, y), ccmd, dictionaries));
assertTrue("Should drop when either predicate must be false", canDrop(and(x, C), ccmd, dictionaries));
assertTrue("Should drop when either predicate must be false", canDrop(and(B, C), ccmd, dictionaries));
assertFalse("Should not drop when either predicate could be true", canDrop(and(x, y), ccmd, dictionaries));
}
use of org.apache.parquet.filter2.predicate.Operators.BinaryColumn in project parquet-mr by apache.
the class DictionaryFilterTest method testLtEqMissingColumn.
@Test
public void testLtEqMissingColumn() throws Exception {
BinaryColumn b = binaryColumn("missing_column");
assertTrue("Should drop block for any non-null query", canDrop(ltEq(b, Binary.fromString("any")), ccmd, dictionaries));
}
Aggregations