| 71 | } |
| 72 | |
| 73 | Result<std::shared_ptr<ChunkedArray>> ChunkedArray::Make(ArrayVector chunks, |
| 74 | std::shared_ptr<DataType> type) { |
| 75 | if (type == nullptr) { |
| 76 | if (chunks.size() == 0) { |
| 77 | return Status::Invalid( |
| 78 | "cannot construct ChunkedArray from empty vector " |
| 79 | "and omitted type"); |
| 80 | } |
| 81 | type = chunks[0]->type(); |
| 82 | } |
| 83 | for (const auto& chunk : chunks) { |
| 84 | if (!chunk->type()->Equals(*type)) { |
| 85 | return Status::TypeError("Array chunks must all be same type"); |
| 86 | } |
| 87 | } |
| 88 | return std::make_shared<ChunkedArray>(std::move(chunks), std::move(type)); |
| 89 | } |
| 90 | |
| 91 | Result<std::shared_ptr<ChunkedArray>> ChunkedArray::MakeEmpty( |
| 92 | std::shared_ptr<DataType> type, MemoryPool* memory_pool) { |