Add Flight retrieval: flights (GetFlightInfo) and get (DoGet)#13
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the retrieval side of Arrow Flight, complementing the existing
put(DoPut) andaction(DoAction) operations.client.flights({ path } | { cmd })—GetFlightInfo. Resolves to aFlightInfoResultwithraw()(the underlyingFlightInfo) andendpoints().client.get(ticket)—DoGet. Resolves to aFlightResultwithtable(),rows(), andraw(); the stream is drained once and the derived views are memoized.new FlightClient(location, …)— now accepts ahost:port, agrpc:///grpc+tls://URI, or a FlightLocationobject (parseLocation). Redeeming a remote endpoint is explicit: open a client for the endpoint's location,get, thenclose.Internals
src/ipc.tsnow owns both directions of the FlightData⇄Arrow IPC framing.flightDataToTablereassembles a DoGet stream into aTable;put.tsimportsparseIPCMessagesback. 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 ownbodyLengthfield, not from the framing.convert.tsaddstableToRows, which recurses into nested structs/lists to produce plain objects (64-bit ints surface asbigint, timestamps asDate).Design notes
flightsrather thangetFlightInfo;ListFlightsis out of scope and would need a different name if added.grpc[+tls]://); other schemes throw.ListFlights/GetSchema/PollFlightInfo, HTTP andgrpc+unixlocations, automatic multi-endpoint fan-out, and schema decoding.Testing
npm run build && npm test— 63/63 pass. New coverage: theflights/getoperations, the IPC round-trip (including non-8-aligneddata_header, multi-record-batch streams, and nested structs/nulls), deeptableToRows, andparseLocationedge cases. An automated review pass was run; its findings — theundefined-ticket guard, body-padding safety, deep row conversion, and location edge cases — are incorporated.🤖 Generated with Claude Code