| 205 | } |
| 206 | |
| 207 | void Insert(int64_t block_index, const std::shared_ptr<Field>&, |
| 208 | const std::shared_ptr<Array>& unconverted) override { |
| 209 | std::unique_lock<std::mutex> lock(mutex_); |
| 210 | |
| 211 | if (null_bitmap_chunks_.size() <= static_cast<size_t>(block_index)) { |
| 212 | null_bitmap_chunks_.resize(static_cast<size_t>(block_index) + 1, nullptr); |
| 213 | offset_chunks_.resize(null_bitmap_chunks_.size(), nullptr); |
| 214 | } |
| 215 | |
| 216 | if (unconverted->type_id() == Type::NA) { |
| 217 | auto st = InsertNull(block_index, unconverted->length()); |
| 218 | if (!st.ok()) { |
| 219 | task_group_->Append([st] { return st; }); |
| 220 | } |
| 221 | return; |
| 222 | } |
| 223 | |
| 224 | DCHECK_EQ(unconverted->type_id(), Type::LIST); |
| 225 | const auto& list_array = checked_cast<const ListArray&>(*unconverted); |
| 226 | |
| 227 | null_bitmap_chunks_[block_index] = unconverted->null_bitmap(); |
| 228 | offset_chunks_[block_index] = list_array.value_offsets(); |
| 229 | |
| 230 | value_builder_->Insert(block_index, list_array.list_type()->value_field(), |
| 231 | list_array.values()); |
| 232 | } |
| 233 | |
| 234 | Status Finish(std::shared_ptr<ChunkedArray>* out) override { |
| 235 | RETURN_NOT_OK(task_group_->Finish()); |