| 378 | Status Unify(const Array& dictionary) override { return Unify(dictionary, nullptr); } |
| 379 | |
| 380 | Status GetResult(std::shared_ptr<DataType>* out_type, |
| 381 | std::shared_ptr<Array>* out_dict) override { |
| 382 | int64_t dict_length = memo_table_.size(); |
| 383 | std::shared_ptr<DataType> index_type; |
| 384 | if (dict_length <= std::numeric_limits<int8_t>::max()) { |
| 385 | index_type = int8(); |
| 386 | } else if (dict_length <= std::numeric_limits<int16_t>::max()) { |
| 387 | index_type = int16(); |
| 388 | } else if (dict_length <= std::numeric_limits<int32_t>::max()) { |
| 389 | index_type = int32(); |
| 390 | } else { |
| 391 | index_type = int64(); |
| 392 | } |
| 393 | // Build unified dictionary type with the right index type |
| 394 | *out_type = arrow::dictionary(index_type, value_type_); |
| 395 | |
| 396 | // Build unified dictionary array |
| 397 | ARROW_ASSIGN_OR_RAISE( |
| 398 | auto data, DictTraits::GetDictionaryArrayData(pool_, value_type_, memo_table_, |
| 399 | 0 /* start_offset */)); |
| 400 | *out_dict = MakeArray(data); |
| 401 | return Status::OK(); |
| 402 | } |
| 403 | |
| 404 | Status GetResultWithIndexType(const std::shared_ptr<DataType>& index_type, |
| 405 | std::shared_ptr<Array>* out_dict) override { |