Transform a table with a service.
()
| 2314 | |
| 2315 | |
| 2316 | def test_doexchange_transform(): |
| 2317 | """Transform a table with a service.""" |
| 2318 | data = pa.Table.from_arrays([ |
| 2319 | pa.array(range(0, 1024)), |
| 2320 | pa.array(range(1, 1025)), |
| 2321 | pa.array(range(2, 1026)), |
| 2322 | ], names=["a", "b", "c"]) |
| 2323 | expected = pa.Table.from_arrays([ |
| 2324 | pa.array(range(3, 1024 * 3 + 3, 3)), |
| 2325 | ], names=["sum"]) |
| 2326 | |
| 2327 | with ExchangeFlightServer() as server, \ |
| 2328 | FlightClient(("localhost", server.port)) as client: |
| 2329 | descriptor = flight.FlightDescriptor.for_command(b"transform") |
| 2330 | writer, reader = client.do_exchange(descriptor) |
| 2331 | with writer: |
| 2332 | writer.begin(data.schema) |
| 2333 | writer.write_table(data) |
| 2334 | writer.done_writing() |
| 2335 | table = reader.read_all() |
| 2336 | assert expected == table |
| 2337 | |
| 2338 | |
| 2339 | def test_middleware_multi_header(): |
nothing calls this directly
no test coverage detected