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