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

Method CheckDoPut

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

Source from the content-addressed store, hash-verified

719 }
720}
721void DoPutTest::CheckDoPut(const FlightDescriptor& descr,
722 const std::shared_ptr<Schema>& schema,
723 const RecordBatchVector& batches) {
724 ASSERT_OK_AND_ASSIGN(auto do_put_result, client_->DoPut(descr, schema));
725 std::unique_ptr<FlightStreamWriter> writer = std::move(do_put_result.writer);
726 std::unique_ptr<FlightMetadataReader> reader = std::move(do_put_result.reader);
727
728 // Ensure that the reader can be used independently of the writer
729 std::thread reader_thread([&reader, &batches]() {
730 for (size_t i = 0; i < batches.size(); i++) {
731 std::shared_ptr<Buffer> out;
732 ASSERT_OK(reader->ReadMetadata(&out));
733 }
734 });
735
736 int64_t counter = 0;
737 for (const auto& batch : batches) {
738 if (counter % 2 == 0) {
739 ASSERT_OK(writer->WriteRecordBatch(*batch));
740 } else {
741 auto buffer = Buffer::FromString(std::to_string(counter));
742 ASSERT_OK(writer->WriteWithMetadata(*batch, std::move(buffer)));
743 }
744 counter++;
745 }
746 // Write a metadata-only message
747 ASSERT_OK(writer->WriteMetadata(Buffer::FromString(kExpectedMetadata)));
748 ASSERT_OK(writer->DoneWriting());
749 reader_thread.join();
750 ASSERT_OK(writer->Close());
751
752 CheckBatches(descr, batches);
753}
754
755void DoPutTest::TestInts() {
756 auto descr = FlightDescriptor::Path({"ints"});

Callers

nothing calls this directly

Calls 10

FromStringFunction · 0.85
to_stringFunction · 0.85
DoneWritingMethod · 0.80
sizeMethod · 0.45
ReadMetadataMethod · 0.45
WriteRecordBatchMethod · 0.45
WriteWithMetadataMethod · 0.45
WriteMetadataMethod · 0.45
joinMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected