@@ -106,6 +106,7 @@ public class DictionaryFilterTest {
106106 + "required binary binary_field; "
107107 + "required binary single_value_field; "
108108 + "optional binary optional_single_value_field; "
109+ + "optional int32 optional_single_value_int32_field;"
109110 + "required fixed_len_byte_array(17) fixed_field (DECIMAL(40,4)); "
110111 + "required int32 int32_field; "
111112 + "required int64 int64_field; "
@@ -194,6 +195,7 @@ private static void writeData(SimpleGroupFactory f, ParquetWriter<Group> writer)
194195 // 10% of the time, leave the field null
195196 if (index % 10 > 0 ) {
196197 group .append ("optional_single_value_field" , "sharp" );
198+ group .append ("optional_single_value_int32_field" , 42 );
197199 }
198200
199201 writer .write (group );
@@ -290,6 +292,7 @@ private void testDictionaryEncodedColumnsV1() throws Exception {
290292 "binary_field" ,
291293 "single_value_field" ,
292294 "optional_single_value_field" ,
295+ "optional_single_value_int32_field" ,
293296 "int32_field" ,
294297 "int64_field" ,
295298 "double_field" ,
@@ -327,6 +330,7 @@ private void testDictionaryEncodedColumnsV2() throws Exception {
327330 "binary_field" ,
328331 "single_value_field" ,
329332 "optional_single_value_field" ,
333+ "optional_single_value_int32_field" ,
330334 "fixed_field" ,
331335 "int32_field" ,
332336 "int64_field" ,
@@ -670,6 +674,20 @@ public void testUdp() throws Exception {
670674 canDrop (userDefined (intColumn ("int32_field" ), undroppable ), ccmd , dictionaries ));
671675 }
672676
677+ @ Test
678+ public void testNullAcceptingUdp () throws Exception {
679+ InInt32UDP drop42DenyNulls = new InInt32UDP (Sets .newHashSet (205 ));
680+ InInt32UDP drop42AcceptNulls = new InInt32UDP (Sets .newHashSet (null , 205 ));
681+
682+ // A column with value 42 and 10% nulls
683+ IntColumn intColumnWithNulls = intColumn ("optional_single_value_int32_field" );
684+
685+ assertTrue ("Should drop block" , canDrop (userDefined (intColumnWithNulls , drop42DenyNulls ), ccmd , dictionaries ));
686+ assertFalse (
687+ "Should not drop block for null accepting udp" ,
688+ canDrop (userDefined (intColumnWithNulls , drop42AcceptNulls ), ccmd , dictionaries ));
689+ }
690+
673691 @ Test
674692 public void testInverseUdp () throws Exception {
675693 InInt32UDP droppable = new InInt32UDP (ImmutableSet .of (42 ));
0 commit comments