Interface AdbcStatement
- All Superinterfaces:
AdbcOptions
,AutoCloseable
- All Known Implementing Classes:
FlightSqlStatement
,JdbcStatement
Statements may represent queries or prepared statements.
Statements may be used multiple times and can be reconfigured (e.g. they can be reused to execute multiple different queries). However, executing a statement (and changing certain other state) will invalidate result sets obtained prior to that execution.
Multiple statements may be created from a single connection. However, the driver may block or error if they are used concurrently (whether from a single thread or multiple threads).
Statements are not required to be thread-safe, but they can be used from multiple threads so long as clients take care to serialize accesses to a statement.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
The partitions of a result set.static class
The result of executing a query with a result set.static class
The result of executing a query without a result set. -
Method Summary
Modifier and TypeMethodDescriptiondefault void
bind
(VectorSchemaRoot root) Bind this statement to a VectorSchemaRoot to provide parameter values/bulk data ingestion.default void
cancel()
Cancel execution of a query.default AdbcStatement.PartitionResult
Execute a result set-generating query and get a list of partitions of the result set.Execute a result set-generating query and get the result.default Schema
Get the schema of the result set without executing the query.Execute a query.default double
Get the upper bound of the progress.default Schema
Get the schema for bound parameters.default double
Get the progress of executing a query.default Iterator<AdbcStatement.PartitionResult>
Execute a result set-generating query and get a list of partitions of the result set.void
prepare()
Turn this statement into a prepared statement.default void
Deprecated.default void
setSqlQuery
(String query) Set a SQL query to be executed on this statement.default void
setSubstraitPlan
(ByteBuffer plan) Set a Substrait plan to be executed on this statement.Methods inherited from interface org.apache.arrow.adbc.core.AdbcOptions
getOption, setOption
Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
cancel
Cancel execution of a query.This can be used to interrupt execution of a method like
executeQuery()
.This method must be thread-safe (other method are not necessarily thread-safe).
- Throws:
AdbcException
- Since:
- ADBC API revision 1.1.0
-
setOption
Deprecated.Set a generic query option.- Throws:
AdbcException
-
setSqlQuery
Set a SQL query to be executed on this statement.- Parameters:
query
- The SQL query.- Throws:
AdbcException
-
setSubstraitPlan
Set a Substrait plan to be executed on this statement.- Parameters:
plan
- The serialized Substrait plan.- Throws:
AdbcException
-
bind
Bind this statement to a VectorSchemaRoot to provide parameter values/bulk data ingestion.- Throws:
AdbcException
-
executeQuery
Execute a result set-generating query and get the result.This may invalidate any prior result sets.
- Throws:
AdbcException
-
executeUpdate
Execute a query.This may invalidate any prior result sets.
- Throws:
AdbcException
-
executePartitioned
Execute a result set-generating query and get a list of partitions of the result set.These can be serialized and deserialized for parallel and/or distributed fetching.
This may invalidate any prior result sets.
- Throws:
AdbcException
-
executeSchema
Get the schema of the result set without executing the query.- Throws:
AdbcException
- Since:
- ADBC API revision 1.1.0
-
pollPartitioned
Execute a result set-generating query and get a list of partitions of the result set.These can be serialized and deserialized for parallel and/or distributed fetching.
This may invalidate any prior result sets.
- Throws:
AdbcException
- Since:
- ADBC API revision 1.1.0
-
getProgress
Get the progress of executing a query.- Throws:
AdbcException
- Since:
- ADBC API revision 1.1.0
-
getMaxProgress
Get the upper bound of the progress.- Throws:
AdbcException
- Since:
- ADBC API revision 1.1.0
-
getParameterSchema
Get the schema for bound parameters.This retrieves an Arrow schema describing the number, names, and types of the parameters in a parameterized statement. The fields of the schema should be in order of the ordinal position of the parameters; named parameters should appear only once.
If the parameter does not have a name, or the name cannot be determined, the name of the corresponding field in the schema will be an empty string. If the type cannot be determined, the type of the corresponding field will be NA (NullType).
This should be called after AdbcStatementPrepare.
- Throws:
AdbcException
- withAdbcStatusCode.NOT_IMPLEMENTED
if the parameters cannot be determined at all.
-
prepare
Turn this statement into a prepared statement.Call
executeQuery()
,executeUpdate()
, orexecutePartitioned()
to execute the query.- Throws:
AdbcException
-
AdbcOptions.setOption(TypedKey, Object)
.