| 345 | } |
| 346 | } |
| 347 | void DataTest::TestDoExchange() { |
| 348 | auto descr = FlightDescriptor::Command("counter"); |
| 349 | RecordBatchVector batches; |
| 350 | auto a1 = ArrayFromJSON(int32(), "[4, 5, 6, null]"); |
| 351 | auto schema = arrow::schema({field("f1", a1->type())}); |
| 352 | batches.push_back(RecordBatch::Make(schema, a1->length(), {a1})); |
| 353 | ASSERT_OK_AND_ASSIGN(auto exchange, client_->DoExchange(descr)); |
| 354 | std::unique_ptr<FlightStreamReader> reader = std::move(exchange.reader); |
| 355 | std::unique_ptr<FlightStreamWriter> writer = std::move(exchange.writer); |
| 356 | ASSERT_OK(writer->Begin(schema)); |
| 357 | for (const auto& batch : batches) { |
| 358 | ASSERT_OK(writer->WriteRecordBatch(*batch)); |
| 359 | } |
| 360 | ASSERT_OK(writer->DoneWriting()); |
| 361 | ASSERT_OK_AND_ASSIGN(auto chunk, reader->Next()); |
| 362 | ASSERT_NE(nullptr, chunk.app_metadata); |
| 363 | ASSERT_EQ(nullptr, chunk.data); |
| 364 | ASSERT_EQ("1", chunk.app_metadata->ToString()); |
| 365 | ASSERT_OK_AND_ASSIGN(auto server_schema, reader->GetSchema()); |
| 366 | AssertSchemaEqual(schema, server_schema); |
| 367 | for (const auto& batch : batches) { |
| 368 | ASSERT_OK_AND_ASSIGN(chunk, reader->Next()); |
| 369 | ASSERT_BATCHES_EQUAL(*batch, *chunk.data); |
| 370 | } |
| 371 | ASSERT_OK(writer->Close()); |
| 372 | } |
| 373 | // Test pure-metadata DoExchange to ensure nothing blocks waiting for |
| 374 | // schema messages |
| 375 | void DataTest::TestDoExchangeNoData() { |
nothing calls this directly
no test coverage detected