Interface Statement.StatementBuilder

Enclosing interface:
Statement

public static interface Statement.StatementBuilder
Statement builder provides methods for building a statement object, which represents a query and holds query-specific settings that overrides the query execution context defaults.
  • Method Details

    • query

      Sets an SQL statement string.
      Parameters:
      query - SQL query.
      Returns:
      this for chaining.
    • queryTimeout

      Statement.StatementBuilder queryTimeout(long timeout, TimeUnit timeUnit)
      Sets a query timeout.
      Parameters:
      timeout - Query timeout value. Must be positive.
      timeUnit - Timeunit.
      Returns:
      this for chaining.
    • defaultSchema

      Statement.StatementBuilder defaultSchema(String schema)
      Sets a default schema for the statement.
      Parameters:
      schema - Default schema.
      Returns:
      this for chaining.
    • pageSize

      Statement.StatementBuilder pageSize(int pageSize)
      Sets a page size - the maximum number of result rows that can be fetched at a time.
      Parameters:
      pageSize - Maximum number of rows per page. Must be positive.
      Returns:
      this for chaining.
    • timeZoneId

      Statement.StatementBuilder timeZoneId(ZoneId timeZoneId)
      Sets a time zone for this statement.

      This time zone is used in the following cases:

      1. When using SQL functions to obtain the current time (for example SELECT CURRENT_TIME)
      2. When converting a string literal to/from a TIMESTAMP WITH LOCAL TIME ZONE column (for example SELECT TIMESTAMP WITH LOCAL TIME ZONE '1992-01-18 02:30:00.123'

      If the time zone has not been set explicitly, the current JVM default time zone will be used.

      Parameters:
      timeZoneId - Time-zone ID.
      Returns:
      this for chaining.
    • memoryQuotaBlockSize

      Statement.StatementBuilder memoryQuotaBlockSize(@Nullable @Nullable Long memoryQuotaBlockSize)
      Sets a memory quota block size for this statement.
      Parameters:
      memoryQuotaBlockSize - Memory quota block size in bytes, or null to use the system default.
      Returns:
      this for chaining.
    • allowFollowerReads

      Statement.StatementBuilder allowFollowerReads(@Nullable @Nullable Boolean allowFollowerReads)
      Sets whether the SQL engine is allowed to read data from non-primary replicas for this statement.

      Affects read-only statements only; a non-null value overrides the cluster-wide setting for this statement.

      If enabled (true) spreads read load across all replicas and lets a query read from a local replica, avoiding a network hop. The trade-off is latency, as reading from a follower replica may introduce delays while waiting for the replica to catch up.

      If disabled (false) always reads from primaries.

      Parameters:
      allowFollowerReads - true or false to force-override the cluster-wide setting, or null to use the cluster-wide setting (default behavior).
      Returns:
      this for chaining.
    • build

      Statement build()
      Creates an SQL statement abject.
      Returns:
      Statement.