| 134 | } |
| 135 | |
| 136 | void StressTableReader(TableReaderFactory reader_factory) { |
| 137 | #ifdef ARROW_VALGRIND |
| 138 | const int NTASKS = 10; |
| 139 | const int NROWS = 100; |
| 140 | #else |
| 141 | const int NTASKS = 100; |
| 142 | const int NROWS = 1000; |
| 143 | #endif |
| 144 | ASSERT_OK_AND_ASSIGN(auto table_buffer, MakeSampleCsvBuffer(NROWS)); |
| 145 | |
| 146 | std::vector<Future<std::shared_ptr<Table>>> task_futures(NTASKS); |
| 147 | for (int i = 0; i < NTASKS; i++) { |
| 148 | auto input = std::make_shared<io::BufferReader>(table_buffer); |
| 149 | ASSERT_OK_AND_ASSIGN( |
| 150 | auto reader, reader_factory(input, ParseOptions::Defaults(), /*block_size=*/{})); |
| 151 | task_futures[i] = reader->ReadAsync(); |
| 152 | } |
| 153 | auto combined_future = All(task_futures); |
| 154 | combined_future.Wait(); |
| 155 | |
| 156 | ASSERT_OK_AND_ASSIGN(std::vector<Result<std::shared_ptr<Table>>> results, |
| 157 | combined_future.result()); |
| 158 | for (auto&& result : results) { |
| 159 | ASSERT_OK_AND_ASSIGN(auto table, result); |
| 160 | ASSERT_EQ(NROWS, table->num_rows()); |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | void StressInvalidTableReader(TableReaderFactory reader_factory) { |
| 165 | #ifdef ARROW_VALGRIND |