| 322 | } |
| 323 | |
| 324 | Result<std::shared_ptr<Array>> DictionaryArray::Compact(MemoryPool* pool) const { |
| 325 | std::shared_ptr<Array> compact_dictionary; |
| 326 | ARROW_ASSIGN_OR_RAISE(std::unique_ptr<Buffer> transpose_map, |
| 327 | CompactTransposeMap(this->data_, pool, compact_dictionary)); |
| 328 | |
| 329 | if (transpose_map == nullptr) { |
| 330 | return std::make_shared<DictionaryArray>(this->data_); |
| 331 | } else { |
| 332 | return this->Transpose(this->type(), compact_dictionary, |
| 333 | transpose_map->data_as<int32_t>(), pool); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | // ---------------------------------------------------------------------- |
| 338 | // Dictionary unification |