@@ -261,8 +261,9 @@ void UnpackFixedSizeBinaryDictionary(FunctionContext* ctx, const Array& indices,
261261 const FixedSizeBinaryArray& dictionary,
262262 ArrayData* output) {
263263 using index_c_type = typename IndexType::c_type;
264- const uint8_t * valid_bits = indices.null_bitmap_data ();
265- INIT_BITSET (valid_bits, indices.offset ());
264+
265+ internal::BitmapReader valid_bits_reader (indices.null_bitmap_data (), indices.offset (),
266+ indices.length ());
266267
267268 const index_c_type* in =
268269 reinterpret_cast <const index_c_type*>(indices.data ()->buffers [1 ]->data ()) +
@@ -271,11 +272,11 @@ void UnpackFixedSizeBinaryDictionary(FunctionContext* ctx, const Array& indices,
271272 int32_t byte_width =
272273 static_cast <const FixedSizeBinaryType&>(*output->type ).byte_width ();
273274 for (int64_t i = 0 ; i < indices.length (); ++i) {
274- if (bitset_valid_bits & ( 1 << bit_offset_valid_bits )) {
275+ if (valid_bits_reader. IsSet ( )) {
275276 const uint8_t * value = dictionary.Value (in[i]);
276277 memcpy (out + i * byte_width, value, byte_width);
277278 }
278- READ_NEXT_BITSET (valid_bits );
279+ valid_bits_reader. Next ( );
279280 }
280281}
281282
@@ -293,8 +294,7 @@ struct CastFunctor<
293294
294295 // Check if values and output type match
295296 DCHECK (values_type.Equals (*output->type ))
296- << " Dictionary type: " << values_type
297- << " target type: " << (*output->type );
297+ << " Dictionary type: " << values_type << " target type: " << (*output->type );
298298
299299 const Array& indices = *dict_array.indices ();
300300 switch (indices.type ()->id ()) {
@@ -327,21 +327,21 @@ Status UnpackBinaryDictionary(FunctionContext* ctx, const Array& indices,
327327 RETURN_NOT_OK (MakeBuilder (ctx->memory_pool (), output->type , &builder));
328328 BinaryBuilder* binary_builder = static_cast <BinaryBuilder*>(builder.get ());
329329
330- const uint8_t * valid_bits = indices.null_bitmap_data ();
331- INIT_BITSET (valid_bits, indices.offset ());
330+ internal::BitmapReader valid_bits_reader ( indices.null_bitmap_data (), indices. offset (),
331+ indices.length ());
332332
333333 const index_c_type* in =
334334 reinterpret_cast <const index_c_type*>(indices.data ()->buffers [1 ]->data ()) +
335335 indices.offset ();
336336 for (int64_t i = 0 ; i < indices.length (); ++i) {
337- if (bitset_valid_bits & ( 1 << bit_offset_valid_bits )) {
337+ if (valid_bits_reader. IsSet ( )) {
338338 int32_t length;
339339 const uint8_t * value = dictionary.GetValue (in[i], &length);
340340 RETURN_NOT_OK (binary_builder->Append (value, length));
341341 } else {
342342 RETURN_NOT_OK (binary_builder->AppendNull ());
343343 }
344- READ_NEXT_BITSET (valid_bits );
344+ valid_bits_reader. Next ( );
345345 }
346346
347347 std::shared_ptr<Array> plain_array;
@@ -366,8 +366,7 @@ struct CastFunctor<T, DictionaryType,
366366
367367 // Check if values and output type match
368368 DCHECK (values_type.Equals (*output->type ))
369- << " Dictionary type: " << values_type
370- << " target type: " << (*output->type );
369+ << " Dictionary type: " << values_type << " target type: " << (*output->type );
371370
372371 const Array& indices = *dict_array.indices ();
373372 switch (indices.type ()->id ()) {
@@ -401,17 +400,17 @@ void UnpackPrimitiveDictionary(const Array& indices, const c_type* dictionary,
401400 c_type* out) {
402401 using index_c_type = typename IndexType::c_type;
403402
404- const uint8_t * valid_bits = indices.null_bitmap_data ();
405- INIT_BITSET (valid_bits, indices.offset ());
403+ internal::BitmapReader valid_bits_reader ( indices.null_bitmap_data (), indices. offset (),
404+ indices.length ());
406405
407406 const index_c_type* in =
408407 reinterpret_cast <const index_c_type*>(indices.data ()->buffers [1 ]->data ()) +
409408 indices.offset ();
410409 for (int64_t i = 0 ; i < indices.length (); ++i) {
411- if (bitset_valid_bits & ( 1 << bit_offset_valid_bits )) {
410+ if (valid_bits_reader. IsSet ( )) {
412411 out[i] = dictionary[in[i]];
413412 }
414- READ_NEXT_BITSET (valid_bits );
413+ valid_bits_reader. Next ( );
415414 }
416415}
417416
@@ -429,8 +428,7 @@ struct CastFunctor<T, DictionaryType,
429428
430429 // Check if values and output type match
431430 DCHECK (values_type.Equals (*output->type ))
432- << " Dictionary type: " << values_type
433- << " target type: " << (*output->type );
431+ << " Dictionary type: " << values_type << " target type: " << (*output->type );
434432
435433 auto dictionary =
436434 reinterpret_cast <const c_type*>(type.dictionary ()->data ()->buffers [1 ]->data ()) +
0 commit comments