| 467 | class BlockDecodingOperator { |
| 468 | public: |
| 469 | Future<DecodedBlock> operator()(const ParsedBlock& block) { |
| 470 | DCHECK(!state_->column_decoders.empty()); |
| 471 | std::vector<Future<std::shared_ptr<Array>>> decoded_array_futs; |
| 472 | for (auto& decoder : state_->column_decoders) { |
| 473 | decoded_array_futs.push_back(decoder->Decode(block.parser)); |
| 474 | } |
| 475 | auto bytes_parsed_or_skipped = block.bytes_parsed_or_skipped; |
| 476 | auto decoded_arrays_fut = All(std::move(decoded_array_futs)); |
| 477 | auto state = state_; |
| 478 | return decoded_arrays_fut.Then( |
| 479 | [state, bytes_parsed_or_skipped]( |
| 480 | const std::vector<Result<std::shared_ptr<Array>>>& maybe_decoded_arrays) |
| 481 | -> Result<DecodedBlock> { |
| 482 | ARROW_ASSIGN_OR_RAISE(auto decoded_arrays, |
| 483 | arrow::internal::UnwrapOrRaise(maybe_decoded_arrays)); |
| 484 | |
| 485 | ARROW_ASSIGN_OR_RAISE(auto batch, |
| 486 | state->DecodedArraysToBatch(std::move(decoded_arrays))); |
| 487 | return DecodedBlock{std::move(batch), bytes_parsed_or_skipped}; |
| 488 | }); |
| 489 | } |
| 490 | |
| 491 | static Result<BlockDecodingOperator> Make(io::IOContext io_context, |
| 492 | ConvertOptions convert_options, |