Class FlightSession

java.lang.Object
io.deephaven.client.impl.FlightSession
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
BarrageSession

public class FlightSession extends Object implements AutoCloseable
  • Field Details

    • session

      protected final SessionImpl session
    • client

      protected final org.apache.arrow.flight.FlightClient client
  • Constructor Details

    • FlightSession

      protected FlightSession(SessionImpl session, org.apache.arrow.flight.FlightClient client)
  • 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 close channel.
      Parameters:
      session - the session
      incomingAllocator - the incoming allocator
      channel - the managed channel
      Returns:
      the flight session
    • session

      public Session session()
      The session.
      Returns:
      the session
    • schema

      public org.apache.arrow.vector.types.pojo.Schema schema(TableHandle handle)
      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

      public org.apache.arrow.vector.types.pojo.Schema schema(HasPathId pathId)
      Perform a GetSchema to get the schema.
      Parameters:
      pathId - the path ID
      Returns:
      the schema
    • stream

      public org.apache.arrow.flight.FlightStream stream(HasTicketId ticketId)
      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 a NewTable payload.

      For more advanced use cases, callers may use putExportManual(NewTable, BufferAllocator).

      Parameters:
      table - the table
      allocator - the allocator
      Returns:
      the table handle
      Throws:
      TableHandle.TableHandleException - if a handle exception occurs
      InterruptedException - 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 a FlightStream 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 occurs
      InterruptedException - if the current thread is interrupted
    • putExportManual

      public ExportId putExportManual(NewTable table, org.apache.arrow.memory.BufferAllocator allocator)
      Creates a new server side export table backed by the server semantics for DoPut with a NewTable payload. Callers are responsible for calling release(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 table
      allocator - the allocator
      Returns:
      the ticket
    • putExportManual

      public ExportId putExportManual(org.apache.arrow.flight.FlightStream input)
      Creates a new server side export table backed by the server semantics for DoPut with a FlightStream payload. Callers are responsible for calling release(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

      public void put(HasPathId pathId, org.apache.arrow.flight.FlightStream input)
      Performs a DoPut against the pathId with a FlightStream payload.
      Parameters:
      pathId - the path ID
      input - the input
    • put

      public void put(HasPathId pathId, NewTable table, org.apache.arrow.memory.BufferAllocator allocator)
      Performs a DoPut against the pathId with a NewTable payload.
      Parameters:
      pathId - the path ID
      table - the table
      allocator - the allocator
    • addToInputTable

      public CompletableFuture<Void> addToInputTable(HasTicketId destination, org.apache.arrow.flight.FlightStream source)
      Add source to the input table destination.
      Parameters:
      destination - the destination input table
      source - the source
      Returns:
      the future
      See Also:
    • addToInputTable

      public CompletableFuture<Void> addToInputTable(HasTicketId destination, NewTable source, org.apache.arrow.memory.BufferAllocator allocator)
      Add source to the input table destination.
      Parameters:
      destination - the destination input table
      source - the source
      Returns:
      the future
      See Also:
    • deleteFromInputTable

      public CompletableFuture<Void> deleteFromInputTable(HasTicketId destination, org.apache.arrow.flight.FlightStream source)
      Delete source from the input table destination.
      Parameters:
      destination - the destination input table
      source - the source
      Returns:
      the future
      See Also:
    • deleteFromInputTable

      public CompletableFuture<Void> deleteFromInputTable(HasTicketId destination, NewTable source, org.apache.arrow.memory.BufferAllocator allocator)
      Delete source from the input table destination.
      Parameters:
      destination - the destination input table
      source - the source
      Returns:
      the future
      See Also:
    • release

      public CompletableFuture<Void> release(ExportId exportId)
      Releases the exportId.

      Note: this should only be called in combination with export IDs returned from putExportManual(NewTable, BufferAllocator) or putExportManual(FlightStream).

      Parameters:
      exportId - the export ID
      Returns:
      the future
    • list

      public Iterable<org.apache.arrow.flight.FlightInfo> list()
      List the flights.
      Returns:
      the flights
    • close

      public void close() throws InterruptedException
      Closes this session by invoking Session.closeFuture() and closing the underlying FlightClient. More advanced users may prefer to explicitly call Session.closeFuture() and wait first. The state of the underlying ManagedChannel depends on how this was constructed. In most cases, closing this does not close the ManagedChannel.
      Specified by:
      close in interface AutoCloseable
      Throws:
      InterruptedException - if the current thread is interrupted