Class FlightSession
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
BarrageSession
-
Field Summary
Modifier and TypeFieldDescriptionprotected final org.apache.arrow.flight.FlightClient
protected final SessionImpl
-
Constructor Summary
ModifierConstructorDescriptionprotected
FlightSession
(SessionImpl session, org.apache.arrow.flight.FlightClient client) -
Method Summary
Modifier and TypeMethodDescriptionaddToInputTable
(HasTicketId destination, NewTable source, org.apache.arrow.memory.BufferAllocator allocator) Addsource
to the input tabledestination
.addToInputTable
(HasTicketId destination, org.apache.arrow.flight.FlightStream source) Addsource
to the input tabledestination
.void
close()
deleteFromInputTable
(HasTicketId destination, NewTable source, org.apache.arrow.memory.BufferAllocator allocator) Deletesource
from the input tabledestination
.deleteFromInputTable
(HasTicketId destination, org.apache.arrow.flight.FlightStream source) Deletesource
from the input tabledestination
.Iterable<org.apache.arrow.flight.FlightInfo>
list()
List the flights.static FlightSession
of
(SessionImpl session, org.apache.arrow.memory.BufferAllocator incomingAllocator, io.grpc.ManagedChannel channel) Creates a flight session.void
Performs a DoPut against thepathId
with aNewTable
payload.void
Performs a DoPut against thepathId
with aFlightStream
payload.Creates a new server side exported table backed by the server semantics of DoPut with aNewTable
payload.putExport
(org.apache.arrow.flight.FlightStream input) Creates a new server side exported table backed by the server semantics of DoPut with aFlightStream
payload.putExportManual
(NewTable table, org.apache.arrow.memory.BufferAllocator allocator) Creates a new server side export table backed by the server semantics for DoPut with aNewTable
payload.putExportManual
(org.apache.arrow.flight.FlightStream input) Creates a new server side export table backed by the server semantics for DoPut with aFlightStream
payload.Releases theexportId
.org.apache.arrow.vector.types.pojo.Schema
Perform a GetSchema to get the schema.org.apache.arrow.vector.types.pojo.Schema
schema
(TableHandle handle) Create a schema from the existing handle's response.session()
The session.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.org.apache.arrow.flight.FlightStream
stream
(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
-
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
-
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 aNewTable
payload.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 aFlightStream
payload.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 aNewTable
payload. 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 aFlightStream
payload. 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 thepathId
with aFlightStream
payload.- 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 thepathId
with aNewTable
payload.- Parameters:
pathId
- the path IDtable
- the tableallocator
- the allocator
-
addToInputTable
public CompletableFuture<Void> addToInputTable(HasTicketId destination, org.apache.arrow.flight.FlightStream source) Addsource
to 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) Addsource
to 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) Deletesource
from 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) Deletesource
from 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
Closesthis
session by invokingSession.closeFuture()
and closing the underlyingFlightClient
. More advanced users may prefer to explicitly callSession.closeFuture()
and wait first. The state of the underlyingManagedChannel
depends on howthis
was constructed. In most cases, closingthis
does not close theManagedChannel
.- Specified by:
close
in interfaceAutoCloseable
- Throws:
InterruptedException
- if the current thread is interrupted
-