| 427 | namespace { |
| 428 | |
| 429 | Result<std::shared_ptr<InspectedFragment>> DoInspectFragment( |
| 430 | const FileSource& source, const CsvFragmentScanOptions& csv_options, |
| 431 | compute::ExecContext* exec_context) { |
| 432 | ARROW_ASSIGN_OR_RAISE(auto input, source.OpenCompressed()); |
| 433 | if (csv_options.stream_transform_func) { |
| 434 | ARROW_ASSIGN_OR_RAISE(input, csv_options.stream_transform_func(input)); |
| 435 | } |
| 436 | ARROW_ASSIGN_OR_RAISE( |
| 437 | input, io::BufferedInputStream::Create(csv_options.read_options.block_size, |
| 438 | default_memory_pool(), std::move(input))); |
| 439 | |
| 440 | ARROW_ASSIGN_OR_RAISE(std::string_view first_block, |
| 441 | input->Peek(csv_options.read_options.block_size)); |
| 442 | |
| 443 | ARROW_ASSIGN_OR_RAISE( |
| 444 | std::vector<std::string> column_names, |
| 445 | GetOrderedColumnNames(csv_options.read_options, csv_options.parse_options, |
| 446 | first_block, exec_context->memory_pool())); |
| 447 | return std::make_shared<CsvInspectedFragment>(std::move(column_names), std::move(input), |
| 448 | source.Size()); |
| 449 | } |
| 450 | |
| 451 | } // namespace |
| 452 |
no test coverage detected