MCPcopy Create free account
hub / github.com/apache/arrow / TestDoExchangeConcurrency

Method TestDoExchangeConcurrency

cpp/src/arrow/flight/test_definitions.cc:575–604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573 // would immediately return an error.
574}
575void DataTest::TestDoExchangeConcurrency() {
576 // Ensure that we can do reads/writes on separate threads
577 auto descr = FlightDescriptor::Command("echo");
578 ASSERT_OK_AND_ASSIGN(auto exchange, client_->DoExchange(descr));
579 std::unique_ptr<FlightStreamReader> reader = std::move(exchange.reader);
580 std::unique_ptr<FlightStreamWriter> writer = std::move(exchange.writer);
581
582 RecordBatchVector batches;
583 ASSERT_OK(ExampleIntBatches(&batches));
584 ASSERT_OK(writer->Begin(ExampleIntSchema()));
585
586 std::thread reader_thread([&reader, &batches]() {
587 for (size_t i = 0; i < batches.size(); i++) {
588 ASSERT_OK_AND_ASSIGN(auto chunk, reader->Next());
589 ASSERT_NE(nullptr, chunk.data);
590 ASSERT_EQ(nullptr, chunk.app_metadata);
591 AssertBatchesEqual(*batches[i], *chunk.data);
592 }
593 ASSERT_OK_AND_ASSIGN(auto chunk, reader->Next());
594 ASSERT_EQ(nullptr, chunk.data);
595 ASSERT_EQ(nullptr, chunk.app_metadata);
596 });
597
598 for (const auto& batch : batches) {
599 ASSERT_OK(writer->WriteRecordBatch(*batch));
600 }
601 ASSERT_OK(writer->DoneWriting());
602 reader_thread.join();
603 ASSERT_OK(writer->Close());
604}
605void DataTest::TestDoExchangeUndrained() {
606 // Ensure if the application doesn't drain all messages, that the
607 // server/transport does

Callers

nothing calls this directly

Calls 10

ExampleIntBatchesFunction · 0.85
ExampleIntSchemaFunction · 0.85
AssertBatchesEqualFunction · 0.85
DoneWritingMethod · 0.80
CommandFunction · 0.70
BeginMethod · 0.45
sizeMethod · 0.45
WriteRecordBatchMethod · 0.45
joinMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected