use of org.apache.parquet.filter2.predicate.Operators.BinaryColumn in project parquet-mr by apache.
the class DictionaryFilterTest method testLtMissingColumn.
@Test
public void testLtMissingColumn() throws Exception {
BinaryColumn b = binaryColumn("missing_column");
assertTrue("Should drop block for any non-null query", canDrop(lt(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 testEqMissingColumn.
@Test
public void testEqMissingColumn() throws Exception {
BinaryColumn b = binaryColumn("missing_column");
assertTrue("Should drop block for non-null query", canDrop(eq(b, Binary.fromString("any")), ccmd, dictionaries));
assertFalse("Should not drop block null query", canDrop(eq(b, null), ccmd, dictionaries));
}
use of org.apache.parquet.filter2.predicate.Operators.BinaryColumn in project parquet-mr by apache.
the class DictionaryFilterTest method testNotEqMissingColumn.
@Test
public void testNotEqMissingColumn() throws Exception {
BinaryColumn b = binaryColumn("missing_column");
assertFalse("Should not drop block for non-null query", canDrop(notEq(b, Binary.fromString("any")), ccmd, dictionaries));
assertTrue("Should not drop block null query", canDrop(notEq(b, null), ccmd, dictionaries));
}
use of org.apache.parquet.filter2.predicate.Operators.BinaryColumn in project parquet-mr by apache.
the class DictionaryFilterTest method testEqBinary.
@Test
public void testEqBinary() throws Exception {
BinaryColumn b = binaryColumn("binary_field");
FilterPredicate pred = eq(b, Binary.fromString("c"));
assertFalse("Should not drop block for lower case letters", canDrop(pred, ccmd, dictionaries));
assertTrue("Should drop block for upper case letters", canDrop(eq(b, Binary.fromString("A")), ccmd, dictionaries));
assertFalse("Should not drop block for null", canDrop(eq(b, null), ccmd, dictionaries));
}
use of org.apache.parquet.filter2.predicate.Operators.BinaryColumn in project parquet-mr by apache.
the class TestRecordLevelFilters method testComplex.
@Test
public void testComplex() throws Exception {
BinaryColumn name = binaryColumn("name");
DoubleColumn lon = doubleColumn("location.lon");
DoubleColumn lat = doubleColumn("location.lat");
FilterPredicate pred = or(and(gt(lon, 150.0), notEq(lat, null)), eq(name, Binary.fromString("alice")));
List<Group> found = PhoneBookWriter.readFile(phonebookFile, FilterCompat.get(pred));
assertFilter(found, new UserFilter() {
@Override
public boolean keep(User u) {
String name = u.getName();
Double lat = null;
Double lon = null;
if (u.getLocation() != null) {
lat = u.getLocation().getLat();
lon = u.getLocation().getLon();
}
return (lon != null && lon > 150.0 && lat != null) || "alice".equals(name);
}
});
}
Aggregations