MCPcopy Create free account
hub / github.com/apache/arrow / GetBatch

Method GetBatch

cpp/src/arrow/util/rle_encoding_internal.h:372–394  ·  view source on GitHub ↗

Get a batch of values return the number of decoded elements. May write fewer elements to the output than requested if there are not enough values left.

Source from the content-addressed store, hash-verified

370 /// May write fewer elements to the output than requested if there are not enough values
371 /// left.
372 [[nodiscard]] rle_size_t GetBatch(value_type* out, rle_size_t batch_size,
373 rle_size_t value_bit_width) {
374 const int bits_read = values_read_ * value_bit_width;
375 const int bytes_fully_read = bits_read / 8;
376 const uint8_t* unread_data = data_ + bytes_fully_read;
377
378 const ::arrow::internal::UnpackOptions opts{
379 /* .batch_size= */ std::min(batch_size, remaining()),
380 /* .bit_width= */ value_bit_width,
381 /* .bit_offset= */ bits_read % 8,
382 /* .max_read_bytes= */ max_read_bytes_ - bytes_fully_read,
383 };
384
385 if constexpr (std::is_same_v<T, bool>) {
386 ::arrow::internal::unpack(unread_data, out, opts);
387
388 } else {
389 ::arrow::internal::unpack(
390 unread_data, reinterpret_cast<std::make_unsigned_t<value_type>*>(out), opts);
391 }
392 values_read_ += opts.batch_size;
393 return opts.batch_size;
394 }
395
396 private:
397 /// The pointer to the beginning of the run

Callers

nothing calls this directly

Calls 1

unpackFunction · 0.70

Tested by

no test coverage detected