@@ -106,6 +106,7 @@ public class DictionaryFilterTest {
106
106
+ "required binary binary_field; "
107
107
+ "required binary single_value_field; "
108
108
+ "optional binary optional_single_value_field; "
109
+ + "optional int32 optional_single_value_int32_field;"
109
110
+ "required fixed_len_byte_array(17) fixed_field (DECIMAL(40,4)); "
110
111
+ "required int32 int32_field; "
111
112
+ "required int64 int64_field; "
@@ -194,6 +195,7 @@ private static void writeData(SimpleGroupFactory f, ParquetWriter<Group> writer)
194
195
// 10% of the time, leave the field null
195
196
if (index % 10 > 0 ) {
196
197
group .append ("optional_single_value_field" , "sharp" );
198
+ group .append ("optional_single_value_int32_field" , 42 );
197
199
}
198
200
199
201
writer .write (group );
@@ -290,6 +292,7 @@ private void testDictionaryEncodedColumnsV1() throws Exception {
290
292
"binary_field" ,
291
293
"single_value_field" ,
292
294
"optional_single_value_field" ,
295
+ "optional_single_value_int32_field" ,
293
296
"int32_field" ,
294
297
"int64_field" ,
295
298
"double_field" ,
@@ -327,6 +330,7 @@ private void testDictionaryEncodedColumnsV2() throws Exception {
327
330
"binary_field" ,
328
331
"single_value_field" ,
329
332
"optional_single_value_field" ,
333
+ "optional_single_value_int32_field" ,
330
334
"fixed_field" ,
331
335
"int32_field" ,
332
336
"int64_field" ,
@@ -670,6 +674,20 @@ public void testUdp() throws Exception {
670
674
canDrop (userDefined (intColumn ("int32_field" ), undroppable ), ccmd , dictionaries ));
671
675
}
672
676
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
+
673
691
@ Test
674
692
public void testInverseUdp () throws Exception {
675
693
InInt32UDP droppable = new InInt32UDP (ImmutableSet .of (42 ));
0 commit comments