Interface CloudSpannerJdbcStatement (2.15.5)

public interface CloudSpannerJdbcStatement extends Statement

This interface is implemented by Statements that are created on Cloud Spanner JDBC connections.

Implements

Statement

Methods

partitionQuery(String query, PartitionOptions partitionOptions, Options.QueryOption[] options)

public abstract ResultSet partitionQuery(String query, PartitionOptions partitionOptions, Options.QueryOption[] options)

Partitions the given query, so it can be executed in parallel. This method returns a ResultSet with a string-representation of the partitions that were created. These strings can be used to execute a partition either on this connection or an any other connection (on this host or an any other host) by calling the method #runPartition(String). This method will automatically enable data boost for the query if CloudSpannerJdbcConnection#isDataBoostEnabled() returns true.

Parameters
NameDescription
queryString
partitionOptionsPartitionOptions
optionsQueryOption[]
Returns
TypeDescription
ResultSet
Exceptions
TypeDescription
SQLException

runPartition(String encodedPartitionId)

public abstract ResultSet runPartition(String encodedPartitionId)

Executes the given partition of a query. The encodedPartitionId should be a string that was returned by #partitionQuery(String, PartitionOptions, QueryOption...).

Parameter
NameDescription
encodedPartitionIdString
Returns
TypeDescription
ResultSet
Exceptions
TypeDescription
SQLException

runPartitionedQuery(String query, PartitionOptions partitionOptions, Options.QueryOption[] options)

public abstract CloudSpannerJdbcPartitionedQueryResultSet runPartitionedQuery(String query, PartitionOptions partitionOptions, Options.QueryOption[] options)

Executes the given query as a partitioned query. The query will first be partitioned using the #partitionQuery(String, PartitionOptions, QueryOption...) method. Each of the partitions will then be executed in the background, and the results will be merged into a single result set.

This method will use CloudSpannerJdbcConnection#getMaxPartitionedParallelism() threads to execute the partitioned query. Set this variable to a higher/lower value to increase/decrease the degree of parallelism used for execution.

Parameters
NameDescription
queryString
partitionOptionsPartitionOptions
optionsQueryOption[]
Returns
TypeDescription
CloudSpannerJdbcPartitionedQueryResultSet
Exceptions
TypeDescription
SQLException