| 441 | namespace { |
| 442 | |
| 443 | Result<std::shared_ptr<InspectedFragment>> DoInspectFragment( |
| 444 | const FileSource& source, const CsvFragmentScanOptions& csv_options, |
| 445 | compute::ExecContext* exec_context) { |
| 446 | ARROW_ASSIGN_OR_RAISE(auto input, source.OpenCompressed()); |
| 447 | if (csv_options.stream_transform_func) { |
| 448 | ARROW_ASSIGN_OR_RAISE(input, csv_options.stream_transform_func(input)); |
| 449 | } |
| 450 | ARROW_ASSIGN_OR_RAISE( |
| 451 | input, io::BufferedInputStream::Create(csv_options.read_options.block_size, |
| 452 | default_memory_pool(), std::move(input))); |
| 453 | |
| 454 | ARROW_ASSIGN_OR_RAISE(std::string_view first_block, |
| 455 | input->Peek(csv_options.read_options.block_size)); |
| 456 | |
| 457 | ARROW_ASSIGN_OR_RAISE( |
| 458 | std::vector<std::string> column_names, |
| 459 | GetOrderedColumnNames(csv_options.read_options, csv_options.parse_options, |
| 460 | first_block, exec_context->memory_pool())); |
| 461 | return std::make_shared<CsvInspectedFragment>(std::move(column_names), std::move(input), |
| 462 | source.Size()); |
| 463 | } |
| 464 | |
| 465 | } // namespace |
| 466 |
no test coverage detected