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

Method AssembleArray

cpp/src/parquet/arrow/reader.cc:691–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689 using ListReader<IndexType>::ListReader;
690
691 ::arrow::Result<std::shared_ptr<ChunkedArray>> AssembleArray(
692 std::shared_ptr<ArrayData> data) final {
693 static_assert(::arrow::internal::IsOneOf<IndexType, int32_t, int64_t>::value);
694 constexpr auto expected_type_id = std::is_same_v<IndexType, int32_t>
695 ? ::arrow::Type::LIST_VIEW
696 : ::arrow::Type::LARGE_LIST_VIEW;
697 DCHECK_EQ(this->field()->type()->id(), expected_type_id);
698 DCHECK_EQ(data->buffers.size(), 2);
699 const auto* offsets = reinterpret_cast<const IndexType*>(data->buffers[1]->data());
700 ARROW_ASSIGN_OR_RAISE(
701 auto sizes_buffer,
702 AllocateResizableBuffer(sizeof(IndexType) * data->length, this->ctx_->pool));
703 auto* sizes = reinterpret_cast<IndexType*>(sizes_buffer->mutable_data());
704 for (int64_t i = 0; i < data->length; ++i) {
705 sizes[i] = offsets[i + 1] - offsets[i];
706 }
707 // ListReader produces length + 1 offsets; ListView stores one offset per slot.
708 data->buffers[1] = ::arrow::SliceBuffer(std::move(data->buffers[1]), /*offset=*/0,
709 sizeof(IndexType) * data->length);
710 data->buffers.push_back(std::move(sizes_buffer));
711 std::shared_ptr<Array> result = ::arrow::MakeArray(data);
712 return std::make_shared<ChunkedArray>(std::move(result));
713 }
714};
715
716class PARQUET_NO_EXPORT FixedSizeListReader : public ListReader<int32_t> {

Callers

nothing calls this directly

Calls 9

fieldMethod · 0.95
SliceBufferFunction · 0.85
push_backMethod · 0.80
MakeArrayFunction · 0.50
idMethod · 0.45
typeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
mutable_dataMethod · 0.45

Tested by

no test coverage detected