| 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 | |
| 716 | class PARQUET_NO_EXPORT FixedSizeListReader : public ListReader<int32_t> { |
nothing calls this directly
no test coverage detected