| 960 | } |
| 961 | |
| 962 | int DecodeIndices(int num_values, ::arrow::ArrayBuilder* builder) override { |
| 963 | num_values = std::min(num_values, this->num_values_); |
| 964 | if (num_values > 0) { |
| 965 | // TODO(wesm): Refactor to batch reads for improved memory use. This is |
| 966 | // relatively simple here because we don't have to do any bookkeeping of |
| 967 | // nulls |
| 968 | PARQUET_THROW_NOT_OK(indices_scratch_space_->TypedResize<int32_t>( |
| 969 | num_values, /*shrink_to_fit=*/false)); |
| 970 | } |
| 971 | auto indices_buffer = indices_scratch_space_->mutable_data_as<int32_t>(); |
| 972 | if (num_values != idx_decoder_.GetBatch(indices_buffer, num_values)) { |
| 973 | ParquetException::EofException(); |
| 974 | } |
| 975 | auto binary_builder = checked_cast<::arrow::BinaryDictionary32Builder*>(builder); |
| 976 | PARQUET_THROW_NOT_OK(binary_builder->AppendIndices(indices_buffer, num_values)); |
| 977 | this->num_values_ -= num_values; |
| 978 | return num_values; |
| 979 | } |
| 980 | |
| 981 | int DecodeIndices(int num_values, int32_t* indices) override { |
| 982 | if (num_values != idx_decoder_.GetBatch(indices, num_values)) { |