| 162 | } |
| 163 | |
| 164 | void StressInvalidTableReader(TableReaderFactory reader_factory) { |
| 165 | #ifdef ARROW_VALGRIND |
| 166 | const int NTASKS = 10; |
| 167 | const int NROWS = 100; |
| 168 | #else |
| 169 | const int NTASKS = 100; |
| 170 | const int NROWS = 1000; |
| 171 | #endif |
| 172 | ASSERT_OK_AND_ASSIGN(auto table_buffer, MakeSampleCsvBuffer(NROWS, [=](size_t row_num) { |
| 173 | return row_num != NROWS / 2; |
| 174 | })); |
| 175 | |
| 176 | std::vector<Future<std::shared_ptr<Table>>> task_futures(NTASKS); |
| 177 | for (int i = 0; i < NTASKS; i++) { |
| 178 | auto input = std::make_shared<io::BufferReader>(table_buffer); |
| 179 | ASSERT_OK_AND_ASSIGN( |
| 180 | auto reader, reader_factory(input, ParseOptions::Defaults(), /*block_size=*/{})); |
| 181 | task_futures[i] = reader->ReadAsync(); |
| 182 | } |
| 183 | auto combined_future = All(task_futures); |
| 184 | combined_future.Wait(); |
| 185 | |
| 186 | ASSERT_OK_AND_ASSIGN(std::vector<Result<std::shared_ptr<Table>>> results, |
| 187 | combined_future.result()); |
| 188 | for (auto&& result : results) { |
| 189 | ASSERT_RAISES(Invalid, result); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | void TestNestedParallelism(std::shared_ptr<internal::ThreadPool> thread_pool, |
| 194 | TableReaderFactory reader_factory) { |