| 980 | } |
| 981 | |
| 982 | int DecodeIndices(int num_values, ::arrow::ArrayBuilder* builder) override { |
| 983 | num_values = std::min(num_values, this->num_values_); |
| 984 | if (num_values > 0) { |
| 985 | // TODO(wesm): Refactor to batch reads for improved memory use. This is |
| 986 | // relatively simple here because we don't have to do any bookkeeping of |
| 987 | // nulls |
| 988 | PARQUET_THROW_NOT_OK(indices_scratch_space_->TypedResize<int32_t>( |
| 989 | num_values, /*shrink_to_fit=*/false)); |
| 990 | } |
| 991 | auto indices_buffer = indices_scratch_space_->mutable_data_as<int32_t>(); |
| 992 | if (num_values != idx_decoder_.GetBatch(indices_buffer, num_values)) { |
| 993 | ParquetException::EofException(); |
| 994 | } |
| 995 | auto binary_builder = checked_cast<::arrow::BinaryDictionary32Builder*>(builder); |
| 996 | PARQUET_THROW_NOT_OK(binary_builder->AppendIndices(indices_buffer, num_values)); |
| 997 | this->num_values_ -= num_values; |
| 998 | return num_values; |
| 999 | } |
| 1000 | |
| 1001 | int DecodeIndices(int num_values, int32_t* indices) override { |
| 1002 | if (num_values != idx_decoder_.GetBatch(indices, num_values)) { |