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

Function test_doexchange_put

python/pyarrow/tests/test_flight.py:2263–2284  ·  view source on GitHub ↗

Emulate DoPut with DoExchange.

()

Source from the content-addressed store, hash-verified

2261
2262
2263def test_doexchange_put():
2264 """Emulate DoPut with DoExchange."""
2265 data = pa.Table.from_arrays([
2266 pa.array(range(0, 10 * 1024))
2267 ], names=["a"])
2268 batches = data.to_batches(max_chunksize=512)
2269
2270 with ExchangeFlightServer() as server, \
2271 FlightClient(("localhost", server.port)) as client:
2272 descriptor = flight.FlightDescriptor.for_command(b"put")
2273 writer, reader = client.do_exchange(descriptor)
2274 with writer:
2275 writer.begin(data.schema)
2276 for batch in batches:
2277 writer.write_batch(batch)
2278 writer.done_writing()
2279 chunk = reader.read_chunk()
2280 assert chunk.data is None
2281 expected_buf = str(len(batches)).encode("utf-8")
2282 assert chunk.app_metadata == expected_buf
2283 # Metadata only message is not counted as an ipc data message
2284 assert reader.stats.num_messages == 0
2285
2286
2287def test_doexchange_echo():

Callers

nothing calls this directly

Calls 9

FlightClientClass · 0.90
lenFunction · 0.85
to_batchesMethod · 0.80
write_batchMethod · 0.80
arrayMethod · 0.45
do_exchangeMethod · 0.45
beginMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected