Class FlightSqlClient
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Helper class to encapsulate Flight SQL prepared statement logic.static class
A handle for an active savepoint.static final class
A wrapper around a Substrait plan and a Substrait version.static class
A handle for an active transaction. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbeginSavepoint
(FlightSqlClient.Transaction transaction, String name, CallOption... options) Create a savepoint within a transaction.beginTransaction
(CallOption... options) Begin a transaction.cancelFlightInfo
(CancelFlightInfoRequest request, CallOption... options) Cancel execution of a distributed query.cancelQuery
(FlightInfo info, CallOption... options) Deprecated.void
close()
closeSession
(CloseSessionRequest request, CallOption... options) void
commit
(FlightSqlClient.Transaction transaction, CallOption... options) Commit a transaction.execute
(String query, CallOption... options) Execute a query on the server.execute
(String query, FlightSqlClient.Transaction transaction, CallOption... options) Execute a query on the server.executeSubstrait
(FlightSqlClient.SubstraitPlan plan, CallOption... options) Execute a Substrait plan on the server.executeSubstrait
(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options) Execute a Substrait plan on the server.long
executeSubstraitUpdate
(FlightSqlClient.SubstraitPlan plan, CallOption... options) Execute an update query on the server.long
executeSubstraitUpdate
(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options) Execute an update query on the server.long
executeUpdate
(String query, CallOption... options) Execute an update query on the server.long
executeUpdate
(String query, FlightSqlClient.Transaction transaction, CallOption... options) Execute an update query on the server.getCatalogs
(CallOption... options) Request a list of catalogs.getCatalogsSchema
(CallOption... options) Get the schema ofgetCatalogs(CallOption...)
from the server.getCrossReference
(TableRef pkTableRef, TableRef fkTableRef, CallOption... options) Retrieves a description of the foreign key columns that reference the given table's primary key columns (the foreign keys exported by a table).getCrossReferenceSchema
(CallOption... options) Get the schema ofgetCrossReference(TableRef, TableRef, CallOption...)
from the server.getExecuteSchema
(String query, CallOption... options) Get the schema of the result set of a query.getExecuteSchema
(String query, FlightSqlClient.Transaction transaction, CallOption... options) Get the schema of the result set of a query.getExecuteSubstraitSchema
(FlightSqlClient.SubstraitPlan substraitPlan, CallOption... options) Get the schema of the result set of a Substrait plan.getExecuteSubstraitSchema
(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options) Get the schema of the result set of a Substrait plan.getExportedKeys
(TableRef tableRef, CallOption... options) Retrieves a description about the foreign key columns that reference the primary key columns of the given table.getExportedKeysSchema
(CallOption... options) Get the schema ofgetExportedKeys(TableRef, CallOption...)
from the server.getImportedKeys
(TableRef tableRef, CallOption... options) Retrieves the foreign key columns for the given table.getImportedKeysSchema
(CallOption... options) Get the schema ofgetImportedKeys(TableRef, CallOption...)
from the server.getPrimaryKeys
(TableRef tableRef, CallOption... options) Request the primary keys for a table.getPrimaryKeysSchema
(CallOption... options) Get the schema ofgetPrimaryKeys(TableRef, CallOption...)
from the server.getSchema
(FlightDescriptor descriptor, CallOption... options) Get schema for a stream.getSchemas
(String catalog, String dbSchemaFilterPattern, CallOption... options) Request a list of schemas.getSchemasSchema
(CallOption... options) Get the schema ofgetSchemas(String, String, CallOption...)
from the server.getSessionOptions
(GetSessionOptionsRequest request, CallOption... options) getSqlInfo
(int[] info, CallOption... options) Request a set of Flight SQL metadata.getSqlInfo
(Iterable<Integer> info, CallOption... options) Request a set of Flight SQL metadata.getSqlInfo
(FlightSql.SqlInfo... info) Request a set of Flight SQL metadata.getSqlInfo
(FlightSql.SqlInfo[] info, CallOption... options) Request a set of Flight SQL metadata.getSqlInfoSchema
(CallOption... options) Get the schema ofgetSqlInfo(SqlInfo...)
from the server.getStream
(Ticket ticket, CallOption... options) Retrieve a stream from the server.getTables
(String catalog, String dbSchemaFilterPattern, String tableFilterPattern, List<String> tableTypes, boolean includeSchema, CallOption... options) Request a list of tables.getTablesSchema
(boolean includeSchema, CallOption... options) Get the schema ofgetTables(String, String, String, List, boolean, CallOption...)
from the server.getTableTypes
(CallOption... options) Request a list of table types.getTableTypesSchema
(CallOption... options) Get the schema ofgetTableTypes(CallOption...)
from the server.getXdbcTypeInfo
(int dataType, CallOption... options) Request the information about the data types supported related to a filter data type.getXdbcTypeInfo
(CallOption... options) Request the information about all the data types supported.getXdbcTypeInfoSchema
(CallOption... options) Get the schema ofgetXdbcTypeInfo(CallOption...)
from the server.prepare
(String query, CallOption... options) Create a prepared statement for a SQL query on the server.prepare
(String query, FlightSqlClient.Transaction transaction, CallOption... options) Create a prepared statement for a SQL query on the server.prepare
(FlightSqlClient.SubstraitPlan plan, CallOption... options) Create a prepared statement for a Substrait plan on the server.prepare
(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options) Create a prepared statement for a Substrait plan on the server.void
release
(FlightSqlClient.Savepoint savepoint, CallOption... options) Release a savepoint.renewFlightEndpoint
(RenewFlightEndpointRequest request, CallOption... options) Request the server to extend the lifetime of a query result set.void
rollback
(FlightSqlClient.Savepoint savepoint, CallOption... options) Rollback to a savepoint.void
rollback
(FlightSqlClient.Transaction transaction, CallOption... options) Rollback a transaction.setSessionOptions
(SetSessionOptionsRequest request, CallOption... options)
-
Constructor Details
-
FlightSqlClient
-
-
Method Details
-
execute
Execute a query on the server.- Parameters:
query
- The query to execute.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
execute
public FlightInfo execute(String query, FlightSqlClient.Transaction transaction, CallOption... options) Execute a query on the server.- Parameters:
query
- The query to execute.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
executeSubstrait
Execute a Substrait plan on the server.- Parameters:
plan
- The Substrait plan to execute.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
executeSubstrait
public FlightInfo executeSubstrait(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options) Execute a Substrait plan on the server.- Parameters:
plan
- The Substrait plan to execute.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getExecuteSchema
public SchemaResult getExecuteSchema(String query, FlightSqlClient.Transaction transaction, CallOption... options) Get the schema of the result set of a query. -
getExecuteSchema
Get the schema of the result set of a query. -
getExecuteSubstraitSchema
public SchemaResult getExecuteSubstraitSchema(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options) Get the schema of the result set of a Substrait plan. -
getExecuteSubstraitSchema
public SchemaResult getExecuteSubstraitSchema(FlightSqlClient.SubstraitPlan substraitPlan, CallOption... options) Get the schema of the result set of a Substrait plan. -
executeUpdate
Execute an update query on the server.- Parameters:
query
- The query to execute.options
- RPC-layer hints for this call.- Returns:
- the number of rows affected.
-
executeUpdate
public long executeUpdate(String query, FlightSqlClient.Transaction transaction, CallOption... options) Execute an update query on the server.- Parameters:
query
- The query to execute.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.- Returns:
- the number of rows affected.
-
executeSubstraitUpdate
Execute an update query on the server.- Parameters:
plan
- The Substrait plan to execute.options
- RPC-layer hints for this call.- Returns:
- the number of rows affected.
-
executeSubstraitUpdate
public long executeSubstraitUpdate(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options) Execute an update query on the server.- Parameters:
plan
- The Substrait plan to execute.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.- Returns:
- the number of rows affected.
-
getCatalogs
Request a list of catalogs.- Parameters:
options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getCatalogsSchema
Get the schema ofgetCatalogs(CallOption...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_CATALOGS_SCHEMA
. -
getSchemas
Request a list of schemas.- Parameters:
catalog
- The catalog.dbSchemaFilterPattern
- The schema filter pattern.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getSchemasSchema
Get the schema ofgetSchemas(String, String, CallOption...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_SCHEMAS_SCHEMA
. -
getSchema
Get schema for a stream.- Parameters:
descriptor
- The descriptor for the stream.options
- RPC-layer hints for this call.
-
getStream
Retrieve a stream from the server.- Parameters:
ticket
- The ticket granting access to the data stream.options
- RPC-layer hints for this call.
-
getSqlInfo
Request a set of Flight SQL metadata.- Parameters:
info
- The set of metadata to retrieve. None to retrieve all metadata.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getSqlInfo
Request a set of Flight SQL metadata.- Parameters:
info
- The set of metadata to retrieve. None to retrieve all metadata.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getSqlInfo
Request a set of Flight SQL metadata. Use this method if you would like to retrieve custom metadata, where the custom metadata key values start from 10_000.- Parameters:
info
- The set of metadata to retrieve. None to retrieve all metadata.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getSqlInfo
Request a set of Flight SQL metadata. Use this method if you would like to retrieve custom metadata, where the custom metadata key values start from 10_000.- Parameters:
info
- The set of metadata to retrieve. None to retrieve all metadata.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getSqlInfoSchema
Get the schema ofgetSqlInfo(SqlInfo...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_SQL_INFO_SCHEMA
. -
getXdbcTypeInfo
Request the information about the data types supported related to a filter data type.- Parameters:
dataType
- the data type to be used as filter.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getXdbcTypeInfo
Request the information about all the data types supported.- Parameters:
options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getXdbcTypeInfoSchema
Get the schema ofgetXdbcTypeInfo(CallOption...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_TYPE_INFO_SCHEMA
. -
getTables
public FlightInfo getTables(String catalog, String dbSchemaFilterPattern, String tableFilterPattern, List<String> tableTypes, boolean includeSchema, CallOption... options) Request a list of tables.- Parameters:
catalog
- The catalog.dbSchemaFilterPattern
- The schema filter pattern.tableFilterPattern
- The table filter pattern.tableTypes
- The table types to include.includeSchema
- True to include the schema upon return, false to not include the schema.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getTablesSchema
Get the schema ofgetTables(String, String, String, List, boolean, CallOption...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_TABLES_SCHEMA
orFlightSqlProducer.Schemas.GET_TABLES_SCHEMA_NO_SCHEMA
. -
getPrimaryKeys
Request the primary keys for a table.- Parameters:
tableRef
- An object which hold info about catalog, dbSchema and table.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getPrimaryKeysSchema
Get the schema ofgetPrimaryKeys(TableRef, CallOption...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_PRIMARY_KEYS_SCHEMA
. -
getExportedKeys
Retrieves a description about the foreign key columns that reference the primary key columns of the given table.- Parameters:
tableRef
- An object which hold info about catalog, dbSchema and table.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getExportedKeysSchema
Get the schema ofgetExportedKeys(TableRef, CallOption...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_EXPORTED_KEYS_SCHEMA
. -
getImportedKeys
Retrieves the foreign key columns for the given table.- Parameters:
tableRef
- An object which hold info about catalog, dbSchema and table.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getImportedKeysSchema
Get the schema ofgetImportedKeys(TableRef, CallOption...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_IMPORTED_KEYS_SCHEMA
. -
getCrossReference
public FlightInfo getCrossReference(TableRef pkTableRef, TableRef fkTableRef, CallOption... options) Retrieves a description of the foreign key columns that reference the given table's primary key columns (the foreign keys exported by a table).- Parameters:
pkTableRef
- An object which hold info about catalog, dbSchema and table from a primary table.fkTableRef
- An object which hold info about catalog, dbSchema and table from a foreign table.options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getCrossReferenceSchema
Get the schema ofgetCrossReference(TableRef, TableRef, CallOption...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_CROSS_REFERENCE_SCHEMA
. -
getTableTypes
Request a list of table types.- Parameters:
options
- RPC-layer hints for this call.- Returns:
- a FlightInfo object representing the stream(s) to fetch.
-
getTableTypesSchema
Get the schema ofgetTableTypes(CallOption...)
from the server.Should be identical to
FlightSqlProducer.Schemas.GET_TABLE_TYPES_SCHEMA
. -
prepare
Create a prepared statement for a SQL query on the server.- Parameters:
query
- The query to prepare.options
- RPC-layer hints for this call.- Returns:
- The representation of the prepared statement which exists on the server.
-
prepare
public FlightSqlClient.PreparedStatement prepare(String query, FlightSqlClient.Transaction transaction, CallOption... options) Create a prepared statement for a SQL query on the server.- Parameters:
query
- The query to prepare.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.- Returns:
- The representation of the prepared statement which exists on the server.
-
prepare
public FlightSqlClient.PreparedStatement prepare(FlightSqlClient.SubstraitPlan plan, CallOption... options) Create a prepared statement for a Substrait plan on the server.- Parameters:
plan
- The query to prepare.options
- RPC-layer hints for this call.- Returns:
- The representation of the prepared statement which exists on the server.
-
prepare
public FlightSqlClient.PreparedStatement prepare(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options) Create a prepared statement for a Substrait plan on the server.- Parameters:
plan
- The query to prepare.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.- Returns:
- The representation of the prepared statement which exists on the server.
-
beginTransaction
Begin a transaction. -
beginSavepoint
public FlightSqlClient.Savepoint beginSavepoint(FlightSqlClient.Transaction transaction, String name, CallOption... options) Create a savepoint within a transaction. -
commit
Commit a transaction. -
release
Release a savepoint. -
rollback
Rollback a transaction. -
rollback
Rollback to a savepoint. -
cancelFlightInfo
public CancelFlightInfoResult cancelFlightInfo(CancelFlightInfoRequest request, CallOption... options) Cancel execution of a distributed query.- Parameters:
request
- The query to cancel.options
- Call options.- Returns:
- The server response.
-
cancelQuery
Deprecated.Explicitly cancel a running query.This lets a single client explicitly cancel work, no matter how many clients are involved/whether the query is distributed or not, given server support. The transaction/statement is not rolled back; it is the application's job to commit or rollback as appropriate. This only indicates the client no longer wishes to read the remainder of the query results or continue submitting data.
-
renewFlightEndpoint
public FlightEndpoint renewFlightEndpoint(RenewFlightEndpointRequest request, CallOption... options) Request the server to extend the lifetime of a query result set.- Parameters:
request
- The result set partition.options
- Call options.- Returns:
- The new endpoint with an updated expiration time.
-
setSessionOptions
public SetSessionOptionsResult setSessionOptions(SetSessionOptionsRequest request, CallOption... options) -
getSessionOptions
public GetSessionOptionsResult getSessionOptions(GetSessionOptionsRequest request, CallOption... options) -
closeSession
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
cancelFlightInfo(org.apache.arrow.flight.CancelFlightInfoRequest, org.apache.arrow.flight.CallOption...)
.