Package org.apache.arrow.flight
Class FlightClient
java.lang.Object
org.apache.arrow.flight.FlightClient
- All Implemented Interfaces:
AutoCloseable
Client for Flight services.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A builder for Flight clients.static interface
Interface for writers to an Arrow data stream.static class
A pair of a reader and a writer for a DoExchange call.static interface
A handler for server-sent application metadata messages during a Flight DoPut operation. -
Method Summary
Modifier and TypeMethodDescriptionvoid
authenticate
(ClientAuthHandler handler, CallOption... options) Authenticates against the Flight service.void
authenticateBasic
(String username, String password) Authenticates with a username and password.authenticateBasicToken
(String username, String password) Authenticates with a username and password.static FlightClient.Builder
builder()
Create a builder for a Flight client.static FlightClient.Builder
builder
(BufferAllocator allocator, Location location) Create a builder for a Flight client.cancelFlightInfo
(CancelFlightInfoRequest request, CallOption... options) Cancel execution of a distributed query.void
close()
Shut down this client.closeSession
(CloseSessionRequest request, CallOption... options) Close/invalidate the current server session.doAction
(Action action, CallOption... options) Performs an action on the Flight service.doExchange
(FlightDescriptor descriptor, CallOption... options) Initiate a bidirectional data exchange with the server.getInfo
(FlightDescriptor descriptor, CallOption... options) Get info on a stream.getSchema
(FlightDescriptor descriptor, CallOption... options) Get schema for a stream.getSessionOptions
(GetSessionOptionsRequest request, CallOption... options) Get the current server session options.getStream
(Ticket ticket, CallOption... options) Retrieve a stream from the server.void
handshake
(CallOption... options) Executes the handshake against the Flight service.listActions
(CallOption... options) Lists actions available on the Flight service.listFlights
(Criteria criteria, CallOption... options) Get a list of available flights.pollInfo
(FlightDescriptor descriptor, CallOption... options) Start or get info on execution of a long-running query.renewFlightEndpoint
(RenewFlightEndpointRequest request, CallOption... options) Request the server to extend the lifetime of a query result set.setSessionOptions
(SetSessionOptionsRequest request, CallOption... options) Set server session option(s) by name/value.startPut
(FlightDescriptor descriptor, FlightClient.PutListener metadataListener, CallOption... options) Create or append a descriptor with another stream.startPut
(FlightDescriptor descriptor, VectorSchemaRoot root, FlightClient.PutListener metadataListener, CallOption... options) Create or append a descriptor with another stream.startPut
(FlightDescriptor descriptor, VectorSchemaRoot root, DictionaryProvider provider, FlightClient.PutListener metadataListener, CallOption... options) Create or append a descriptor with another stream.
-
Method Details
-
listFlights
Get a list of available flights.- Parameters:
criteria
- Criteria for selecting flightsoptions
- RPC-layer hints for the call.- Returns:
- FlightInfo Iterable
-
listActions
Lists actions available on the Flight service.- Parameters:
options
- RPC-layer hints for the call.
-
doAction
Performs an action on the Flight service.- Parameters:
action
- The action to perform.options
- RPC-layer hints for this call.- Returns:
- An iterator of results.
-
authenticateBasic
Authenticates with a username and password. -
authenticate
Authenticates against the Flight service.- Parameters:
options
- RPC-layer hints for this call.handler
- The auth mechanism to use.
-
authenticateBasicToken
Authenticates with a username and password.- Parameters:
username
- the username.password
- the password.- Returns:
- a CredentialCallOption containing a bearer token if the server emitted one, or empty if no bearer token was returned. This can be used in subsequent API calls.
-
handshake
Executes the handshake against the Flight service.- Parameters:
options
- RPC-layer hints for this call.
-
startPut
public FlightClient.ClientStreamListener startPut(FlightDescriptor descriptor, VectorSchemaRoot root, FlightClient.PutListener metadataListener, CallOption... options) Create or append a descriptor with another stream.- Parameters:
descriptor
- FlightDescriptor the descriptor for the dataroot
- VectorSchemaRoot the root containing datametadataListener
- A handler for metadata messages from the server. This will be passed buffers that will be freed afterFlightProducer.StreamListener.onNext(Object)
is called!options
- RPC-layer hints for this call.- Returns:
- ClientStreamListener an interface to control uploading data
-
startPut
public FlightClient.ClientStreamListener startPut(FlightDescriptor descriptor, VectorSchemaRoot root, DictionaryProvider provider, FlightClient.PutListener metadataListener, CallOption... options) Create or append a descriptor with another stream.- Parameters:
descriptor
- FlightDescriptor the descriptor for the dataroot
- VectorSchemaRoot the root containing datametadataListener
- A handler for metadata messages from the server.options
- RPC-layer hints for this call.- Returns:
- ClientStreamListener an interface to control uploading data.
OutboundStreamListener.start(VectorSchemaRoot, DictionaryProvider)
will already have been called.
-
startPut
public FlightClient.ClientStreamListener startPut(FlightDescriptor descriptor, FlightClient.PutListener metadataListener, CallOption... options) Create or append a descriptor with another stream.- Parameters:
descriptor
- FlightDescriptor the descriptor for the datametadataListener
- A handler for metadata messages from the server.options
- RPC-layer hints for this call.- Returns:
- ClientStreamListener an interface to control uploading data.
OutboundStreamListener.start(VectorSchemaRoot, DictionaryProvider)
will NOT already have been called.
-
getInfo
Get info on a stream.- Parameters:
descriptor
- The descriptor for the stream.options
- RPC-layer hints for this call.
-
pollInfo
Start or get info on execution of a long-running query.- Parameters:
descriptor
- The descriptor for the stream.options
- RPC-layer hints for this call.- Returns:
- Metadata about execution.
-
getSchema
Get schema for a stream.- Parameters:
descriptor
- The descriptor for the stream.options
- RPC-layer hints for this call.
-
getStream
Retrieve a stream from the server.- Parameters:
ticket
- The ticket granting access to the data stream.options
- RPC-layer hints for this call.
-
doExchange
public FlightClient.ExchangeReaderWriter doExchange(FlightDescriptor descriptor, CallOption... options) Initiate a bidirectional data exchange with the server.- Parameters:
descriptor
- A descriptor for the data stream.options
- RPC call options.- Returns:
- A pair of a readable stream and a writable stream.
-
cancelFlightInfo
public CancelFlightInfoResult cancelFlightInfo(CancelFlightInfoRequest request, CallOption... options) Cancel execution of a distributed query.- Parameters:
request
- The query to cancel.options
- Call options.- Returns:
- The server response.
-
renewFlightEndpoint
public FlightEndpoint renewFlightEndpoint(RenewFlightEndpointRequest request, CallOption... options) Request the server to extend the lifetime of a query result set.- Parameters:
request
- The result set partition.options
- Call options.- Returns:
- The new endpoint with an updated expiration time.
-
setSessionOptions
public SetSessionOptionsResult setSessionOptions(SetSessionOptionsRequest request, CallOption... options) Set server session option(s) by name/value.Sessions are generally persisted via HTTP cookies.
- Parameters:
request
- The session options to set on the server.options
- Call options.- Returns:
- The result containing per-value error statuses, if any.
-
getSessionOptions
public GetSessionOptionsResult getSessionOptions(GetSessionOptionsRequest request, CallOption... options) Get the current server session options.The session is generally accessed via an HTTP cookie.
- Parameters:
request
- The (empty) GetSessionOptionsRequest.options
- Call options.- Returns:
- The result containing the set of session options configured on the server.
-
closeSession
Close/invalidate the current server session.The session is generally accessed via an HTTP cookie.
- Parameters:
request
- The (empty) CloseSessionRequest.options
- Call options.- Returns:
- The result containing the status of the close operation.
-
close
Shut down this client.- Specified by:
close
in interfaceAutoCloseable
- Throws:
InterruptedException
-
builder
Create a builder for a Flight client. -
builder
Create a builder for a Flight client.- Parameters:
allocator
- The allocator to use for the client.location
- The location to connect to.
-