| 1425 | |
| 1426 | template <typename BuilderType> |
| 1427 | Status DecodeArrowNonNull(int num_values, BuilderType* builder, int* out_num_values) { |
| 1428 | constexpr int32_t kBufferSize = 2048; |
| 1429 | int32_t indices[kBufferSize]; |
| 1430 | |
| 1431 | RETURN_NOT_OK(builder->Reserve(num_values)); |
| 1432 | |
| 1433 | const auto* dict_values = dictionary_->data_as<ByteArray>(); |
| 1434 | |
| 1435 | int values_decoded = 0; |
| 1436 | while (values_decoded < num_values) { |
| 1437 | int32_t batch_size = std::min<int32_t>(kBufferSize, num_values - values_decoded); |
| 1438 | int num_indices = idx_decoder_.GetBatch(indices, batch_size); |
| 1439 | if (num_indices == 0) ParquetException::EofException(); |
| 1440 | for (int i = 0; i < num_indices; ++i) { |
| 1441 | auto idx = indices[i]; |
| 1442 | RETURN_NOT_OK(IndexInBounds(idx)); |
| 1443 | const auto& val = dict_values[idx]; |
| 1444 | RETURN_NOT_OK(builder->Append(val.ptr, val.len)); |
| 1445 | } |
| 1446 | values_decoded += num_indices; |
| 1447 | } |
| 1448 | *out_num_values = values_decoded; |
| 1449 | return Status::OK(); |
| 1450 | } |
| 1451 | }; |
| 1452 | |
| 1453 | // Dictionary decoder for FIXED_LEN_BYTE_ARRAY that can decode directly into a |