@@ -72,6 +72,32 @@ fn read_dict_buffer_optional<T, A, F>(
72
72
}
73
73
}
74
74
75
+ fn read_dict_buffer_required < T , A , F > (
76
+ indices_buffer : & [ u8 ] ,
77
+ additional : usize ,
78
+ dict : & PrimitivePageDict < T > ,
79
+ values : & mut MutableBuffer < A > ,
80
+ validity : & mut MutableBitmap ,
81
+ op : F ,
82
+ ) where
83
+ T : NativeType ,
84
+ A : ArrowNativeType ,
85
+ F : Fn ( T ) -> A ,
86
+ {
87
+ let dict_values = dict. values ( ) ;
88
+
89
+ // SPEC: Data page format: the bit width used to encode the entry ids stored as 1 byte (max bit width = 32),
90
+ // SPEC: followed by the values encoded using RLE/Bit packed described above (with the given bit width).
91
+ let bit_width = indices_buffer[ 0 ] ;
92
+ let indices_buffer = & indices_buffer[ 1 ..] ;
93
+
94
+ let indices = hybrid_rle:: HybridRleDecoder :: new ( indices_buffer, bit_width as u32 , additional) ;
95
+
96
+ values. extend ( indices. map ( |index| op ( dict_values[ index as usize ] ) ) ) ;
97
+
98
+ validity. extend_constant ( additional, true ) ;
99
+ }
100
+
75
101
fn read_nullable < T , A , F > (
76
102
validity_buffer : & [ u8 ] ,
77
103
values_buffer : & [ u8 ] ,
@@ -170,6 +196,16 @@ where
170
196
op,
171
197
)
172
198
}
199
+ ( Encoding :: PlainDictionary | Encoding :: RleDictionary , Some ( dict) , false ) => {
200
+ read_dict_buffer_required (
201
+ values_buffer,
202
+ additional,
203
+ dict. as_any ( ) . downcast_ref ( ) . unwrap ( ) ,
204
+ values,
205
+ validity,
206
+ op,
207
+ )
208
+ }
173
209
// it can happen that there is a dictionary but the encoding is plain because
174
210
// it falled back.
175
211
( Encoding :: Plain , _, true ) => read_nullable (
0 commit comments