Emulate DoPut with DoExchange.
(self, context, reader, writer)
| 486 | writer.write_table(data) |
| 487 | |
| 488 | def exchange_do_put(self, context, reader, writer): |
| 489 | """Emulate DoPut with DoExchange.""" |
| 490 | num_batches = 0 |
| 491 | for chunk in reader: |
| 492 | if not chunk.data: |
| 493 | raise pa.ArrowInvalid("All chunks must have data.") |
| 494 | assert reader.stats.num_messages != 0 |
| 495 | num_batches += 1 |
| 496 | assert reader.stats.num_record_batches == num_batches |
| 497 | writer.write_metadata(str(num_batches).encode("utf-8")) |
| 498 | |
| 499 | def exchange_echo(self, context, reader, writer): |
| 500 | """Run a simple echo server.""" |