Transform a table with a service.
()
| 2352 | |
| 2353 | |
| 2354 | def test_doexchange_transform(): |
| 2355 | """Transform a table with a service.""" |
| 2356 | data = pa.Table.from_arrays([ |
| 2357 | pa.array(range(0, 1024)), |
| 2358 | pa.array(range(1, 1025)), |
| 2359 | pa.array(range(2, 1026)), |
| 2360 | ], names=["a", "b", "c"]) |
| 2361 | expected = pa.Table.from_arrays([ |
| 2362 | pa.array(range(3, 1024 * 3 + 3, 3)), |
| 2363 | ], names=["sum"]) |
| 2364 | |
| 2365 | with ExchangeFlightServer() as server, \ |
| 2366 | FlightClient(("localhost", server.port)) as client: |
| 2367 | descriptor = flight.FlightDescriptor.for_command(b"transform") |
| 2368 | writer, reader = client.do_exchange(descriptor) |
| 2369 | with writer: |
| 2370 | writer.begin(data.schema) |
| 2371 | writer.write_table(data) |
| 2372 | writer.done_writing() |
| 2373 | table = reader.read_all() |
| 2374 | assert expected == table |
| 2375 | |
| 2376 | |
| 2377 | def test_middleware_multi_header(): |
nothing calls this directly
no test coverage detected