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

Function test_flight_do_put_limit

python/pyarrow/tests/test_flight.py:1920–1945  ·  view source on GitHub ↗

Try a simple do_put call with a size limit.

()

Source from the content-addressed store, hash-verified

1918
1919@pytest.mark.numpy
1920def test_flight_do_put_limit():
1921 """Try a simple do_put call with a size limit."""
1922 large_batch = pa.RecordBatch.from_arrays([
1923 pa.array(np.ones(768, dtype=np.int64())),
1924 ], names=['a'])
1925
1926 with EchoFlightServer() as server, \
1927 FlightClient(('localhost', server.port),
1928 write_size_limit_bytes=4096) as client:
1929 writer, metadata_reader = client.do_put(
1930 flight.FlightDescriptor.for_path(''),
1931 large_batch.schema)
1932 with writer:
1933 with pytest.raises(flight.FlightWriteSizeExceededError,
1934 match="exceeded soft limit") as excinfo:
1935 writer.write_batch(large_batch)
1936 assert excinfo.value.limit == 4096
1937 smaller_batches = [
1938 large_batch.slice(0, 384),
1939 large_batch.slice(384),
1940 ]
1941 for batch in smaller_batches:
1942 writer.write_batch(batch)
1943 expected = pa.Table.from_batches([large_batch])
1944 actual = client.do_get(flight.Ticket(b'')).read_all()
1945 assert expected == actual
1946
1947
1948@pytest.mark.slow

Callers

nothing calls this directly

Calls 7

FlightClientClass · 0.90
EchoFlightServerClass · 0.85
write_batchMethod · 0.80
arrayMethod · 0.45
do_putMethod · 0.45
sliceMethod · 0.45
do_getMethod · 0.45

Tested by

no test coverage detected