@qualithm/arrow-flight-client - v0.1.4
    Preparing search index...

    Class FlightClient

    Low-level Arrow Flight client for communicating with Flight servers.

    This client provides access to all core Flight RPC methods. For SQL operations, use FlightSqlClient instead.

    const client = new FlightClient({ url: "https://flight.example.com:8815" })

    const info = await client.getFlightInfo({ type: "cmd", cmd: myCommand })
    for await (const flight of client.listFlights()) {
    console.log(flight)
    }

    client.close()
    Index

    Constructors

    Accessors

    • get authenticated(): boolean

      Whether the client has been authenticated via handshake.

      Returns boolean

    • get closed(): boolean

      Whether the client has been closed.

      Returns boolean

    • get url(): string

      The base URL of the Flight server.

      Returns string

    Methods

    • Authenticate with the server using configured credentials.

      For basic auth, this calls the Handshake RPC. For bearer auth, no action is needed (token is sent in headers).

      Returns Promise<string | undefined>

      The authentication token (if applicable)

    • Close the client and release resources. After calling close, the client should not be used.

      Returns void

    • Execute a custom action on the server.

      Parameters

      • action: FlightAction

        The action to execute (type and optional body)

      Returns AsyncIterable<Result>

      Result messages from the server

    • Retrieve flight data for the given ticket. Returns an async iterable of FlightData messages.

      Use the IPC decoding utilities to convert FlightData to Arrow RecordBatches:

      • decodeFlightDataStream() - decode to RecordBatch stream
      • decodeFlightDataToTable() - decode to a single Table

      Parameters

      • ticket: FlightTicket

        The ticket identifying the data to retrieve

      Returns AsyncIterable<FlightData>

      FlightData messages containing Arrow IPC data

      import { decodeFlightDataStream } from "@qualithm/arrow-flight-client"

      const stream = client.doGet(ticket)
      for await (const batch of decodeFlightDataStream(stream)) {
      console.log(`Received batch with ${batch.numRows} rows`)
      }
    • Upload data to the server. Returns an async iterable of PutResult messages containing server acknowledgements.

      Use the IPC encoding utilities to create FlightData from Arrow data:

      • encodeRecordBatchesToFlightData() - encode RecordBatch stream
      • encodeTableToFlightData() - encode a Table

      Parameters

      • data: AsyncIterable<FlightData>

        Async iterable of FlightData messages to upload (include descriptor in first message)

      Returns AsyncIterable<PutResult>

      PutResult messages from the server

      import { encodeTableToFlightData } from "@qualithm/arrow-flight-client"

      const descriptor = { type: "path", path: ["my", "table"] }
      const flightData = encodeTableToFlightData(table)

      // Add descriptor to first message
      async function* withDescriptor() {
      let first = true
      for await (const data of flightData) {
      if (first) {
      yield { ...data, flightDescriptor: descriptor }
      first = false
      } else {
      yield data
      }
      }
      }

      for await (const result of client.doPut(withDescriptor())) {
      console.log("Server acknowledged:", result.appMetadata)
      }
    • Perform Flight Handshake authentication.

      This method is automatically called for clients configured with auth: { type: "basic" }. For custom handshake payloads, call this method directly with raw bytes.

      Parameters

      • Optionalpayload: Uint8Array<ArrayBufferLike>

        Raw handshake payload (defaults to BasicAuth if auth.type is "basic")

      Returns Promise<string>

      The authentication token from the server

    • List available actions supported by the server.

      Returns AsyncIterable<ActionType>

      ActionType describing each available action

    • List available flights matching the given criteria.

      Parameters

      • Optionalcriteria: FlightCriteria

        Optional filter criteria for listing flights

      Returns AsyncIterable<FlightInfo>

      FlightInfo for each matching flight

    • Poll for updated flight information (useful for long-running queries).

      Parameters

      Returns Promise<PollInfo>

      Poll information with progress and updated flight info