All Known Implementing Classes:
Cluster, Scope

@ThreadSafe public interface Queryable
  • Method Details Link icon

    • executeQuery Link icon

      QueryResult executeQuery(String statement, Consumer<QueryOptions> options)
      Executes a query statement using the specified options (query parameters, etc.), and buffers all result rows in memory.

      If the results are not known to fit in memory, consider using the streaming version that takes a row action callback: executeStreamingQuery(String, Consumer, Consumer).

      Parameters:
      statement - The Columnar SQL++ statement to execute.
      options - A callback for specifying custom query options.
      Returns:
      A query result consisting of metadata and a list of rows.
      Throws:
      CancellationException - if the calling thread is interrupted.
      TimeoutException - if the query does not complete before the timeout expires.
      QueryException - if the server response indicates an error occurred.
      InvalidCredentialException - if the server rejects the user credentials.
    • executeQuery Link icon

      default QueryResult executeQuery(String statement)
      Executes a query statement using default options (no query parameters, etc.), and buffers all result rows in memory.

      If the statement has parameters, use the overload that takes options: executeQuery(String, Consumer).

      If the results are not known to fit in memory, consider using the streaming version that takes a row action callback: executeStreamingQuery(String, Consumer).

      Parameters:
      statement - The Columnar SQL++ statement to execute.
      Returns:
      A query result consisting of metadata and a list of rows.
      Throws:
      CancellationException - if the calling thread is interrupted.
      TimeoutException - if the query does not complete before the timeout expires.
      QueryException - if the server response indicates an error occurred.
      InvalidCredentialException - if the server rejects the user credentials.
    • executeStreamingQuery Link icon

      QueryMetadata executeStreamingQuery(String statement, Consumer<Row> rowAction, Consumer<QueryOptions> options)
      Executes a query statement using the specified options, (query parameters, etc.), and passes result rows to the given rowAction callback, one by one as they arrive from the server.

      The callback action is guaranteed to execute in the same thread (or virtual thread) that called this method. If the callback throws an exception, the query is cancelled and the exception is re-thrown by this method.

      Parameters:
      statement - The Columnar SQL++ statement to execute.
      options - A callback for specifying custom query options.
      Returns:
      Query metadata.
      Throws:
      CancellationException - if the calling thread is interrupted.
      TimeoutException - if the query does not complete before the timeout expires.
      QueryException - if the server response indicates an error occurred.
      RuntimeException - if the row action callback throws an exception.
      InvalidCredentialException - if the server rejects the user credentials.
    • executeStreamingQuery Link icon

      default QueryMetadata executeStreamingQuery(String statement, Consumer<Row> rowAction)
      Executes a query statement and passes result rows to the given rowAction callback, one by one as they arrive from the server.

      The callback action is guaranteed to execute in the same thread (or virtual thread) that called this method. If the callback throws an exception, the query is cancelled and the exception is re-thrown by this method.

      If the statement has parameters, use the overload that takes options: executeStreamingQuery(String, Consumer, Consumer).

      Parameters:
      statement - The Columnar SQL++ statement to execute.
      Returns:
      Query metadata.
      Throws:
      CancellationException - if the calling thread is interrupted.
      TimeoutException - if the query does not complete before the timeout expires.
      QueryException - if the server response indicates an error occurred.
      InvalidCredentialException - if the server rejects the user credentials.
      RuntimeException - if the row action callback throws an exception.