| 191 | } |
| 192 | |
| 193 | void TestNestedParallelism(std::shared_ptr<internal::ThreadPool> thread_pool, |
| 194 | TableReaderFactory reader_factory) { |
| 195 | const int NROWS = 1000; |
| 196 | ASSERT_OK_AND_ASSIGN(auto table_buffer, MakeSampleCsvBuffer(NROWS)); |
| 197 | auto input = std::make_shared<io::BufferReader>(table_buffer); |
| 198 | ASSERT_OK_AND_ASSIGN( |
| 199 | auto reader, reader_factory(input, ParseOptions::Defaults(), /*block_size=*/{})); |
| 200 | |
| 201 | Future<std::shared_ptr<Table>> table_future; |
| 202 | |
| 203 | auto read_task = [&reader, &table_future]() mutable { |
| 204 | table_future = reader->ReadAsync(); |
| 205 | return Status::OK(); |
| 206 | }; |
| 207 | ASSERT_OK_AND_ASSIGN(auto future, thread_pool->Submit(read_task)); |
| 208 | |
| 209 | ASSERT_FINISHES_OK(future); |
| 210 | ASSERT_FINISHES_OK_AND_ASSIGN(auto table, table_future); |
| 211 | ASSERT_EQ(table->num_rows(), NROWS); |
| 212 | } |
| 213 | |
| 214 | void TestInvalidRowsSkipped(TableReaderFactory reader_factory, bool async) { |
| 215 | const int NROWS = 1000; |