Interface Session

All Superinterfaces:
ApplicationService, AutoCloseable, ConfigService, ConsoleService, InputTableService, ObjectService, TableCreator<TableHandle>, TableHandleManager, TableService
All Known Implementing Classes:
SessionBase, SessionImpl

A session represents a client-side connection to a Deephaven server.
  • Method Details

    • close

      void close()
      Closes the session.
      Specified by:
      close in interface AutoCloseable
    • closeFuture

      CompletableFuture<Void> closeFuture()
      Closes the session.
      Returns:
      the future
    • newExportId

      ExportId newExportId()
      Advanced usage, creates a new table export ID for this session, but must be managed by the caller. Useful for more advanced integrations, particularly around doPut. Callers are responsible for releasing the export ID if necessary.
      Returns:
      the new export ID
      See Also:
    • release

      CompletableFuture<Void> release(ExportId exportId)
      Releases an export ID.
      Parameters:
      exportId - the export ID
      Returns:
      the future
    • publish

      CompletableFuture<Void> publish(HasTicketId resultId, HasTicketId sourceId)
      Makes a copy from a source ticket and publishes to a result ticket. Neither the source ticket, nor the destination ticket, need to be a client managed ticket.
      Parameters:
      resultId - the result id
      sourceId - the source id
      Returns:
      the future
    • export

      CompletableFuture<? extends ServerObject> export(HasTypedTicket typedTicket)
      Exports typedTicket to a client-managed server object.
      Parameters:
      typedTicket - the typed ticket
      Returns:
      the future
    • newStatefulTableService

      TableService newStatefulTableService()
      Creates a new stateful TableService that keeps references to the exports created from said service for executing queries with maximum cacheability. This allows callers to implicitly take advantage of existing exports when they are executing new queries. In the following example, the second query does not need to re-execute from the beginning; it is able to build off of the export for h1 and simply execute the where operation.
       TableServices ts = session.tableServices();
       TableHandle h1 = ts.execute(TableSpec.emptyTable(42).view("I=ii"));
       TableHandle h2 = ts.execute(TableSpec.emptyTable(42).view("I=ii").where("I % 2 == 0"));
       
      While this Session also implements TableService, query executions against this are not cached. In the following example, the second query is re-executed from the beginning.
       TableHandle h1 = session.execute(TableSpec.emptyTable(42).view("I=ii"));
       TableHandle h2 = session.execute(TableSpec.emptyTable(42).view("I=ii").where("I % 2 == 0"));
       
      When using a stateful TableService, callers may encounter exceptions that refer to an "unreferenceable table". This is an indication that the caller is trying to export a strict sub-DAG of the existing exports; this is problematic because there isn't (currently) a way to construct a query that guarantees the returned export would refer to the same physical table that the existing exports are based on. The following example demonstrates a case where such an exception would occur.
       TableServices ts = session.tableServices();
       TableHandle h1 = ts.execute(TableSpec.emptyTable(42).view("I=ii").where("I % 2 == 0"));
       // This execution will throw an "unreferenceable table" exception.
       TableHandle h2 = ts.execute(TableSpec.emptyTable(42).view("I=ii"));
       
      Returns:
      a new stateful table services
      See Also:
    • channel

      DeephavenChannel channel()
      The authenticated channel.
      Returns:
      the authenticated channel