Interface Statement
The statement object is thread-safe.
Statement parameters and query plan can be cached on the server side. The server-side resources are managed automatically. If the server-side state does not exist due to any reason - the very first run, current client node reconnect, cache invalidation, etc. - this state is restored automatically. This may cause the user to experience a slightly increased latency.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceStatement 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 Summary
Modifier and TypeMethodDescription@Nullable BooleanReturns whether the SQL engine is allowed to read data from non-primary replicas for this statement.Returns a statement's default schema.@Nullable LongReturns memory quota block size for this statement.intpageSize()Returns a page size - the maximum number of result rows that can be fetched at a time.query()Returns a string representation of an SQL statement.longqueryTimeout(TimeUnit timeUnit) Returns a query timeout.Returns time zone used for this statement.Creates a statement builder from the current statement.
-
Method Details
-
query
String query()Returns a string representation of an SQL statement.- Returns:
- SQL statement string.
-
queryTimeout
Returns a query timeout.- Parameters:
timeUnit- Timeunit to convert timeout to.- Returns:
- Query timeout in the given timeunit.
-
defaultSchema
String defaultSchema()Returns a statement's default schema.- Returns:
- Default schema for the statement.
-
pageSize
int pageSize()Returns a page size - the maximum number of result rows that can be fetched at a time.- Returns:
- Maximum number of rows per page.
-
timeZoneId
ZoneId timeZoneId()Returns time zone used for this statement.- Returns:
- Time zone used for this statement.
- See Also:
-
memoryQuotaBlockSize
Returns memory quota block size for this statement.- Returns:
- Memory quota block size in bytes, or
nullif system default is used.
-
allowFollowerReads
Returns whether the SQL engine is allowed to read data from non-primary replicas for this statement.Affects read-only statements only; a non-
nullvalue 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.- Returns:
Trueif read from non-primary replicas is allowed for the statement,falseif disallowed,nullif the cluster-wide setting is used (default behavior).
-
toBuilder
Statement.StatementBuilder toBuilder()Creates a statement builder from the current statement.- Returns:
- Statement builder based on the current statement.
-