Skip to content

Add Flight retrieval: flights (GetFlightInfo) and get (DoGet)#13

Merged
T20354 merged 1 commit into
mainfrom
feat/flight-get-operation
Jul 7, 2026
Merged

Add Flight retrieval: flights (GetFlightInfo) and get (DoGet)#13
T20354 merged 1 commit into
mainfrom
feat/flight-get-operation

Conversation

@T20354

@T20354 T20354 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the retrieval side of Arrow Flight, complementing the existing put (DoPut) and action (DoAction) operations.

  • client.flights({ path } | { cmd })GetFlightInfo. Resolves to a FlightInfoResult with raw() (the underlying FlightInfo) and endpoints().
  • client.get(ticket)DoGet. Resolves to a FlightResult with table(), rows(), and raw(); the stream is drained once and the derived views are memoized.
  • new FlightClient(location, …) — now accepts a host:port, a grpc:// / grpc+tls:// URI, or a Flight Location object (parseLocation). Redeeming a remote endpoint is explicit: open a client for the endpoint's location, get, then close.

Internals

  • src/ipc.ts now owns both directions of the FlightData⇄Arrow IPC framing. flightDataToTable reassembles a DoGet stream into a Table; put.ts imports parseIPCMessages back. Only the message header is padded to 8 bytes — the body is emitted verbatim, since the reader takes the body length from the IPC message's own bodyLength field, not from the framing.
  • convert.ts adds tableToRows, which recurses into nested structs/lists to produce plain objects (64-bit ints surface as bigint, timestamps as Date).

Design notes

  • Named flights rather than getFlightInfo; ListFlights is out of scope and would need a different name if added.
  • Connection ownership is explicit — the library holds no pool. The constructor uses a deliberate allowlist (bare address + grpc[+tls]://); other schemes throw.
  • Out of scope: ListFlights / GetSchema / PollFlightInfo, HTTP and grpc+unix locations, automatic multi-endpoint fan-out, and schema decoding.

Testing

npm run build && npm test — 63/63 pass. New coverage: the flights / get operations, the IPC round-trip (including non-8-aligned data_header, multi-record-batch streams, and nested structs/nulls), deep tableToRows, and parseLocation edge cases. An automated review pass was run; its findings — the undefined-ticket guard, body-padding safety, deep row conversion, and location edge cases — are incorporated.

🤖 Generated with Claude Code

Complements the existing put/action operations with the retrieval side:

- client.flights({path}|{cmd}) -> FlightInfoResult with raw()/endpoints()
- client.get(ticket) -> FlightResult with table()/rows()/raw()
- FlightClient accepts a Location (host:port, grpc://, grpc+tls://) via parseLocation
- src/ipc.ts holds both FlightData<->Arrow IPC framing directions; flightDataToTable
  reassembles DoGet streams and put.ts imports parseIPCMessages from it
- convert.ts: tableToRows converts a Table back to plain row objects

Tests cover the operations, the IPC round-trip (unpadded headers, multi-batch,
nested structs) and location parsing.
@T20354
T20354 merged commit 4649e5b into main Jul 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant