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