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

Method AssembleArray

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

Source from the content-addressed store, hash-verified

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