| 1128 | } |
| 1129 | |
| 1130 | Future<std::shared_ptr<StreamingReader>> MakeStreamingReader( |
| 1131 | io::IOContext io_context, std::shared_ptr<io::InputStream> input, |
| 1132 | Executor* cpu_executor, const ReadOptions& read_options, |
| 1133 | const ParseOptions& parse_options, const ConvertOptions& convert_options) { |
| 1134 | RETURN_NOT_OK(parse_options.Validate()); |
| 1135 | RETURN_NOT_OK(read_options.Validate()); |
| 1136 | RETURN_NOT_OK(convert_options.Validate()); |
| 1137 | std::shared_ptr<StreamingReaderImpl> reader; |
| 1138 | reader = std::make_shared<StreamingReaderImpl>( |
| 1139 | io_context, input, read_options, parse_options, convert_options, |
| 1140 | /*count_rows=*/!read_options.use_threads || cpu_executor->GetCapacity() == 1); |
| 1141 | return reader->Init(cpu_executor).Then([reader] { |
| 1142 | return std::dynamic_pointer_cast<StreamingReader>(reader); |
| 1143 | }); |
| 1144 | } |
| 1145 | |
| 1146 | ///////////////////////////////////////////////////////////////////////// |
| 1147 | // Row count implementation |