Class FlightSession
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
BarrageSession
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.arrow.flight.FlightClientprotected final SessionImpl -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFlightSession(SessionImpl session, org.apache.arrow.flight.FlightClient client) -
Method Summary
Modifier and TypeMethodDescriptionaddToInputTable(HasTicketId destination, NewTable source, org.apache.arrow.memory.BufferAllocator allocator) Addsourceto the input tabledestination.addToInputTable(HasTicketId destination, org.apache.arrow.flight.FlightStream source) Addsourceto the input tabledestination.voidclose()deleteFromInputTable(HasTicketId destination, NewTable source, org.apache.arrow.memory.BufferAllocator allocator) Deletesourcefrom the input tabledestination.deleteFromInputTable(HasTicketId destination, org.apache.arrow.flight.FlightStream source) Deletesourcefrom the input tabledestination.org.apache.arrow.flight.FlightClientIterable<org.apache.arrow.flight.FlightInfo>list()List the flights.static FlightSessionof(SessionImpl session, org.apache.arrow.memory.BufferAllocator incomingAllocator, io.grpc.ManagedChannel channel) Creates a flight session.voidPerforms a DoPut against thepathIdwith aNewTablepayload.voidPerforms a DoPut against thepathIdwith aFlightStreampayload.Creates a new server side exported table backed by the server semantics of DoPut with aNewTablepayload.putExport(org.apache.arrow.flight.FlightStream input) Creates a new server side exported table backed by the server semantics of DoPut with aFlightStreampayload.putExportManual(NewTable table, org.apache.arrow.memory.BufferAllocator allocator) Creates a new server side export table backed by the server semantics for DoPut with aNewTablepayload.putExportManual(org.apache.arrow.flight.FlightStream input) Creates a new server side export table backed by the server semantics for DoPut with aFlightStreampayload.Releases theexportId.org.apache.arrow.vector.types.pojo.SchemaPerform a GetSchema to get the schema.org.apache.arrow.vector.types.pojo.Schemaschema(TableHandle handle) Create a schema from the existing handle's response.session()The session.org.apache.arrow.flight.FlightClient.ExchangeReaderWriterstartExchange(HasPathId hasPathId, org.apache.arrow.flight.CallOption... options) Creates a new server side DoExchange session.org.apache.arrow.flight.FlightClient.ExchangeReaderWriterstartExchange(org.apache.arrow.flight.FlightDescriptor descriptor, org.apache.arrow.flight.CallOption... options) Creates a new server side DoExchange session.org.apache.arrow.flight.FlightStreamstream(HasTicketId ticketId) Perform a DoGet to fetch the data.
-
Field Details
-
session
-
client
protected final org.apache.arrow.flight.FlightClient client
-
-
Constructor Details
-
FlightSession
-
-
Method Details
-
of
public static FlightSession of(SessionImpl session, org.apache.arrow.memory.BufferAllocator incomingAllocator, io.grpc.ManagedChannel channel) Creates a flight session. Closing the flight session does not closechannel.- Parameters:
session- the sessionincomingAllocator- the incoming allocatorchannel- the managed channel- Returns:
- the flight session
-
session
The session.- Returns:
- the session
-
getClient
public org.apache.arrow.flight.FlightClient getClient()- Returns:
- the session's FlightClient instance
-
schema
Create a schema from the existing handle's response.Equivalent to
SchemaHelper.schema(handle.response()).- Parameters:
handle- the handle- Returns:
- the schema
- See Also:
-
schema
Perform a GetSchema to get the schema.- Parameters:
pathId- the path ID- Returns:
- the schema
-
stream
Perform a DoGet to fetch the data.- Parameters:
ticketId- the ticket- Returns:
- the stream
-
startExchange
public org.apache.arrow.flight.FlightClient.ExchangeReaderWriter startExchange(org.apache.arrow.flight.FlightDescriptor descriptor, org.apache.arrow.flight.CallOption... options) Creates a new server side DoExchange session.- Parameters:
descriptor- the FlightDescriptor object to include on the first FlightData message (other fields will remain null)options- the GRPC otions to apply to this call- Returns:
- the bi-directional ReaderWriter object
-
startExchange
public org.apache.arrow.flight.FlightClient.ExchangeReaderWriter startExchange(HasPathId hasPathId, org.apache.arrow.flight.CallOption... options) Creates a new server side DoExchange session.- Parameters:
hasPathId- an object that has aPathIdoptions- the GRPC otions to apply to this call- Returns:
- the bi-directional ReaderWriter object
-
putExport
public TableHandle putExport(NewTable table, org.apache.arrow.memory.BufferAllocator allocator) throws TableHandle.TableHandleException, InterruptedException Creates a new server side exported table backed by the server semantics of DoPut with aNewTablepayload.For more advanced use cases, callers may use
putExportManual(NewTable, BufferAllocator).- Parameters:
table- the tableallocator- the allocator- Returns:
- the table handle
- Throws:
TableHandle.TableHandleException- if a handle exception occursInterruptedException- if the current thread is interrupted
-
putExport
public TableHandle putExport(org.apache.arrow.flight.FlightStream input) throws TableHandle.TableHandleException, InterruptedException Creates a new server side exported table backed by the server semantics of DoPut with aFlightStreampayload.For more advanced use cases, callers may use
putExportManual(FlightStream).- Parameters:
input- the input- Returns:
- the table handle
- Throws:
TableHandle.TableHandleException- if a handle exception occursInterruptedException- if the current thread is interrupted
-
putExportManual
Creates a new server side export table backed by the server semantics for DoPut with aNewTablepayload. Callers are responsible for callingrelease(ExportId).This method may be more efficient, depending on how the export is going to be used. If it will simply be bound to another export table, callers should prefer
putExport(NewTable, BufferAllocator).- Parameters:
table- the tableallocator- the allocator- Returns:
- the ticket
-
putExportManual
Creates a new server side export table backed by the server semantics for DoPut with aFlightStreampayload. Callers are responsible for callingrelease(ExportId).This method may be more efficient, depending on how the ticket is going to be used. If it will simply be bound to a ticket table, callers should prefer
putExport(FlightStream).- Parameters:
input- the input- Returns:
- the export ID
-
put
Performs a DoPut against thepathIdwith aFlightStreampayload.- Parameters:
pathId- the path IDinput- the input
-
put
public void put(HasPathId pathId, NewTable table, org.apache.arrow.memory.BufferAllocator allocator) Performs a DoPut against thepathIdwith aNewTablepayload.- Parameters:
pathId- the path IDtable- the tableallocator- the allocator
-
addToInputTable
public CompletableFuture<Void> addToInputTable(HasTicketId destination, org.apache.arrow.flight.FlightStream source) Addsourceto the input tabledestination.- Parameters:
destination- the destination input tablesource- the source- Returns:
- the future
- See Also:
-
addToInputTable
public CompletableFuture<Void> addToInputTable(HasTicketId destination, NewTable source, org.apache.arrow.memory.BufferAllocator allocator) Addsourceto the input tabledestination.- Parameters:
destination- the destination input tablesource- the source- Returns:
- the future
- See Also:
-
deleteFromInputTable
public CompletableFuture<Void> deleteFromInputTable(HasTicketId destination, org.apache.arrow.flight.FlightStream source) Deletesourcefrom the input tabledestination.- Parameters:
destination- the destination input tablesource- the source- Returns:
- the future
- See Also:
-
deleteFromInputTable
public CompletableFuture<Void> deleteFromInputTable(HasTicketId destination, NewTable source, org.apache.arrow.memory.BufferAllocator allocator) Deletesourcefrom the input tabledestination.- Parameters:
destination- the destination input tablesource- the source- Returns:
- the future
- See Also:
-
release
Releases theexportId.Note: this should only be called in combination with export IDs returned from
putExportManual(NewTable, BufferAllocator)orputExportManual(FlightStream).- Parameters:
exportId- the export ID- Returns:
- the future
-
list
List the flights.- Returns:
- the flights
-
close
Closesthissession by invokingSession.closeFuture()and closing the underlyingFlightClient. More advanced users may prefer to explicitly callSession.closeFuture()and wait first. The state of the underlyingManagedChanneldepends on howthiswas constructed. In most cases, closingthisdoes not close theManagedChannel.- Specified by:
closein interfaceAutoCloseable- Throws:
InterruptedException- if the current thread is interrupted
-