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

Method GetBatch

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

Source from the content-addressed store, hash-verified

773
774template <typename T>
775auto RleBitPackedDecoder<T>::GetBatch(value_type* out,
776 rle_size_t batch_size) -> rle_size_t {
777 using ControlFlow = RleBitPackedParser::ControlFlow;
778
779 rle_size_t values_read = 0;
780
781 // Remaining from a previous call that would have left some unread data from a run.
782 if (ARROW_PREDICT_FALSE(run_remaining() > 0)) {
783 const auto read = RunGetBatch(out, batch_size);
784 values_read += read;
785 out += read;
786
787 // Either we fulfilled all the batch to be read or we finished remaining run.
788 if (ARROW_PREDICT_FALSE(values_read == batch_size)) {
789 return values_read;
790 }
791 ARROW_DCHECK(run_remaining() == 0);
792 }
793
794 ParseWithCallable([&](auto run) {
795 using RunDecoder = typename decltype(run)::template DecoderType<value_type>;
796
797 ARROW_DCHECK_LT(values_read, batch_size);
798 RunDecoder decoder(run, value_bit_width_);
799 const auto read = decoder.GetBatch(out, batch_size - values_read, value_bit_width_);
800 ARROW_DCHECK_LE(read, batch_size - values_read);
801 values_read += read;
802 out += read;
803
804 // Stop reading and store remaining decoder
805 if (ARROW_PREDICT_FALSE(values_read == batch_size || read == 0)) {
806 decoder_ = std::move(decoder);
807 return ControlFlow::Break;
808 }
809
810 return ControlFlow::Continue;
811 });
812
813 return values_read;
814}
815
816namespace internal {
817

Callers 15

TestRleDecoderFunction · 0.45
TestBitPackedDecoderFunction · 0.45
OnRleRunFunction · 0.45
OnBitPackedRunFunction · 0.45
ValidateRleBitPackedFunction · 0.45
CheckRoundTripFunction · 0.45
RunGetBatchMethod · 0.45
RunGetSpacedFunction · 0.45
DecodeMethod · 0.45
DecodeIndicesMethod · 0.45
DecodeArrowDenseMethod · 0.45
DecodeArrowMethod · 0.45

Calls

no outgoing calls

Tested by 6

TestRleDecoderFunction · 0.36
TestBitPackedDecoderFunction · 0.36
OnRleRunFunction · 0.36
OnBitPackedRunFunction · 0.36
ValidateRleBitPackedFunction · 0.36
CheckRoundTripFunction · 0.36