| 948 | } |
| 949 | |
| 950 | TEST_F(AsyncStreamingReaderTest, AsyncReentrancy) { |
| 951 | constexpr int kNumRows = 16; |
| 952 | constexpr double kIoLatency = 1e-2; |
| 953 | |
| 954 | auto expected = GenerateTestCase(kNumRows); |
| 955 | parse_options_.explicit_schema = expected.schema; |
| 956 | parse_options_.unexpected_field_behavior = UnexpectedFieldBehavior::Error; |
| 957 | read_options_.block_size = expected.block_size; |
| 958 | |
| 959 | std::vector<Future<std::shared_ptr<RecordBatch>>> futures(expected.num_batches + 2); |
| 960 | ASSERT_OK_AND_ASSIGN(auto reader, MakeReader(expected.json, kIoLatency)); |
| 961 | EXPECT_EQ(reader->bytes_processed(), 0); |
| 962 | for (auto& future : futures) { |
| 963 | future = reader->ReadNextAsync(); |
| 964 | } |
| 965 | |
| 966 | ASSERT_FINISHES_OK_AND_ASSIGN(auto results, All(std::move(futures))); |
| 967 | EXPECT_EQ(reader->bytes_processed(), expected.json_size); |
| 968 | ASSERT_OK_AND_ASSIGN(auto batches, internal::UnwrapOrRaise(std::move(results))); |
| 969 | AssertBatchSequenceEquals(expected.batches, batches); |
| 970 | } |
| 971 | |
| 972 | TEST_F(AsyncStreamingReaderTest, FuturesOutliveReader) { |
| 973 | constexpr int kNumRows = 16; |
nothing calls this directly
no test coverage detected