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

Function test_doexchange_put

python/pyarrow/tests/test_flight.py:2225–2246  ·  view source on GitHub ↗

Emulate DoPut with DoExchange.

()

Source from the content-addressed store, hash-verified

2223
2224
2225def test_doexchange_put():
2226 """Emulate DoPut with DoExchange."""
2227 data = pa.Table.from_arrays([
2228 pa.array(range(0, 10 * 1024))
2229 ], names=["a"])
2230 batches = data.to_batches(max_chunksize=512)
2231
2232 with ExchangeFlightServer() as server, \
2233 FlightClient(("localhost", server.port)) as client:
2234 descriptor = flight.FlightDescriptor.for_command(b"put")
2235 writer, reader = client.do_exchange(descriptor)
2236 with writer:
2237 writer.begin(data.schema)
2238 for batch in batches:
2239 writer.write_batch(batch)
2240 writer.done_writing()
2241 chunk = reader.read_chunk()
2242 assert chunk.data is None
2243 expected_buf = str(len(batches)).encode("utf-8")
2244 assert chunk.app_metadata == expected_buf
2245 # Metadata only message is not counted as an ipc data message
2246 assert reader.stats.num_messages == 0
2247
2248
2249def 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