| 99 | } |
| 100 | |
| 101 | static Future<std::shared_ptr<FragmentScanner>> Make( |
| 102 | const FragmentScanRequest& scan_request, |
| 103 | const JsonFragmentScanOptions& format_options, |
| 104 | const JsonInspectedFragment& inspected, Executor* cpu_executor) { |
| 105 | auto parse_options = format_options.parse_options; |
| 106 | ARROW_ASSIGN_OR_RAISE(parse_options.explicit_schema, |
| 107 | GetSchema(scan_request, inspected)); |
| 108 | parse_options.unexpected_field_behavior = json::UnexpectedFieldBehavior::Ignore; |
| 109 | |
| 110 | int64_t block_size = format_options.read_options.block_size; |
| 111 | auto num_batches = |
| 112 | static_cast<int>(bit_util::CeilDiv(inspected.num_bytes, block_size)); |
| 113 | |
| 114 | auto future = json::StreamingReader::MakeAsync( |
| 115 | inspected.stream, format_options.read_options, parse_options, |
| 116 | io::default_io_context(), cpu_executor); |
| 117 | return future.Then([num_batches, block_size](const ReaderPtr& reader) |
| 118 | -> Result<std::shared_ptr<FragmentScanner>> { |
| 119 | return std::make_shared<JsonFragmentScanner>(reader, num_batches, block_size); |
| 120 | }); |
| 121 | } |
| 122 | |
| 123 | private: |
| 124 | ReaderPtr reader_; |
nothing calls this directly
no test coverage detected