public class FlightSqlClient extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
FlightSqlClient.PreparedStatement
Helper class to encapsulate Flight SQL prepared statement logic.
|
static class |
FlightSqlClient.Savepoint
A handle for an active savepoint.
|
static class |
FlightSqlClient.SubstraitPlan
A wrapper around a Substrait plan and a Substrait version.
|
static class |
FlightSqlClient.Transaction
A handle for an active transaction.
|
Constructor and Description |
---|
FlightSqlClient(FlightClient client) |
Modifier and Type | Method and Description |
---|---|
FlightSqlClient.Savepoint |
beginSavepoint(FlightSqlClient.Transaction transaction,
String name,
CallOption... options)
Create a savepoint within a transaction.
|
FlightSqlClient.Transaction |
beginTransaction(CallOption... options)
Begin a transaction.
|
CancelFlightInfoResult |
cancelFlightInfo(CancelFlightInfoRequest request,
CallOption... options)
Cancel execution of a distributed query.
|
CancelResult |
cancelQuery(FlightInfo info,
CallOption... options)
|
void |
close() |
void |
commit(FlightSqlClient.Transaction transaction,
CallOption... options)
Commit a transaction.
|
FlightInfo |
execute(String query,
CallOption... options)
Execute a query on the server.
|
FlightInfo |
execute(String query,
FlightSqlClient.Transaction transaction,
CallOption... options)
Execute a query on the server.
|
FlightInfo |
executeSubstrait(FlightSqlClient.SubstraitPlan plan,
CallOption... options)
Execute a Substrait plan on the server.
|
FlightInfo |
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.
|
FlightInfo |
getCatalogs(CallOption... options)
Request a list of catalogs.
|
SchemaResult |
getCatalogsSchema(CallOption... options)
Get the schema of
getCatalogs(CallOption...) from the server. |
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).
|
SchemaResult |
getCrossReferenceSchema(CallOption... options)
Get the schema of
getCrossReference(TableRef, TableRef, CallOption...) from the server. |
SchemaResult |
getExecuteSchema(String query,
CallOption... options)
Get the schema of the result set of a query.
|
SchemaResult |
getExecuteSchema(String query,
FlightSqlClient.Transaction transaction,
CallOption... options)
Get the schema of the result set of a query.
|
SchemaResult |
getExecuteSubstraitSchema(FlightSqlClient.SubstraitPlan substraitPlan,
CallOption... options)
Get the schema of the result set of a Substrait plan.
|
SchemaResult |
getExecuteSubstraitSchema(FlightSqlClient.SubstraitPlan plan,
FlightSqlClient.Transaction transaction,
CallOption... options)
Get the schema of the result set of a Substrait plan.
|
FlightInfo |
getExportedKeys(TableRef tableRef,
CallOption... options)
Retrieves a description about the foreign key columns that reference the primary key columns of the given table.
|
SchemaResult |
getExportedKeysSchema(CallOption... options)
Get the schema of
getExportedKeys(TableRef, CallOption...) from the server. |
FlightInfo |
getImportedKeys(TableRef tableRef,
CallOption... options)
Retrieves the foreign key columns for the given table.
|
SchemaResult |
getImportedKeysSchema(CallOption... options)
Get the schema of
getImportedKeys(TableRef, CallOption...) from the server. |
FlightInfo |
getPrimaryKeys(TableRef tableRef,
CallOption... options)
Request the primary keys for a table.
|
SchemaResult |
getPrimaryKeysSchema(CallOption... options)
Get the schema of
getPrimaryKeys(TableRef, CallOption...) from the server. |
SchemaResult |
getSchema(FlightDescriptor descriptor,
CallOption... options)
Get schema for a stream.
|
FlightInfo |
getSchemas(String catalog,
String dbSchemaFilterPattern,
CallOption... options)
Request a list of schemas.
|
SchemaResult |
getSchemasSchema(CallOption... options)
Get the schema of
getSchemas(String, String, CallOption...) from the server. |
FlightInfo |
getSqlInfo(FlightSql.SqlInfo... info)
Request a set of Flight SQL metadata.
|
FlightInfo |
getSqlInfo(FlightSql.SqlInfo[] info,
CallOption... options)
Request a set of Flight SQL metadata.
|
FlightInfo |
getSqlInfo(int[] info,
CallOption... options)
Request a set of Flight SQL metadata.
|
FlightInfo |
getSqlInfo(Iterable<Integer> info,
CallOption... options)
Request a set of Flight SQL metadata.
|
SchemaResult |
getSqlInfoSchema(CallOption... options)
Get the schema of
#getSqlInfo(SqlInfo...) from the server. |
FlightStream |
getStream(Ticket ticket,
CallOption... options)
Retrieve a stream from the server.
|
FlightInfo |
getTables(String catalog,
String dbSchemaFilterPattern,
String tableFilterPattern,
List<String> tableTypes,
boolean includeSchema,
CallOption... options)
Request a list of tables.
|
SchemaResult |
getTablesSchema(boolean includeSchema,
CallOption... options)
Get the schema of
getTables(String, String, String, List, boolean, CallOption...) from the server. |
FlightInfo |
getTableTypes(CallOption... options)
Request a list of table types.
|
SchemaResult |
getTableTypesSchema(CallOption... options)
Get the schema of
getTableTypes(CallOption...) from the server. |
FlightInfo |
getXdbcTypeInfo(CallOption... options)
Request the information about all the data types supported.
|
FlightInfo |
getXdbcTypeInfo(int dataType,
CallOption... options)
Request the information about the data types supported related to
a filter data type.
|
SchemaResult |
getXdbcTypeInfoSchema(CallOption... options)
Get the schema of
getXdbcTypeInfo(CallOption...) from the server. |
FlightSqlClient.PreparedStatement |
prepare(FlightSqlClient.SubstraitPlan plan,
CallOption... options)
Create a prepared statement for a Substrait plan on the server.
|
FlightSqlClient.PreparedStatement |
prepare(FlightSqlClient.SubstraitPlan plan,
FlightSqlClient.Transaction transaction,
CallOption... options)
Create a prepared statement for a Substrait plan on the server.
|
FlightSqlClient.PreparedStatement |
prepare(String query,
CallOption... options)
Create a prepared statement for a SQL query on the server.
|
FlightSqlClient.PreparedStatement |
prepare(String query,
FlightSqlClient.Transaction transaction,
CallOption... options)
Create a prepared statement for a SQL query on the server.
|
void |
release(FlightSqlClient.Savepoint savepoint,
CallOption... options)
Release a savepoint.
|
FlightEndpoint |
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.
|
public FlightSqlClient(FlightClient client)
public FlightInfo execute(String query, CallOption... options)
query
- The query to execute.options
- RPC-layer hints for this call.public FlightInfo execute(String query, FlightSqlClient.Transaction transaction, CallOption... options)
query
- The query to execute.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.public FlightInfo executeSubstrait(FlightSqlClient.SubstraitPlan plan, CallOption... options)
plan
- The Substrait plan to execute.options
- RPC-layer hints for this call.public FlightInfo executeSubstrait(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options)
plan
- The Substrait plan to execute.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.public SchemaResult getExecuteSchema(String query, FlightSqlClient.Transaction transaction, CallOption... options)
public SchemaResult getExecuteSchema(String query, CallOption... options)
public SchemaResult getExecuteSubstraitSchema(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options)
public SchemaResult getExecuteSubstraitSchema(FlightSqlClient.SubstraitPlan substraitPlan, CallOption... options)
public long executeUpdate(String query, CallOption... options)
query
- The query to execute.options
- RPC-layer hints for this call.public long executeUpdate(String query, FlightSqlClient.Transaction transaction, CallOption... options)
query
- The query to execute.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.public long executeSubstraitUpdate(FlightSqlClient.SubstraitPlan plan, CallOption... options)
plan
- The Substrait plan to execute.options
- RPC-layer hints for this call.public long executeSubstraitUpdate(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options)
plan
- The Substrait plan to execute.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.public FlightInfo getCatalogs(CallOption... options)
options
- RPC-layer hints for this call.public SchemaResult getCatalogsSchema(CallOption... options)
getCatalogs(CallOption...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_CATALOGS_SCHEMA
.
public FlightInfo getSchemas(String catalog, String dbSchemaFilterPattern, CallOption... options)
catalog
- The catalog.dbSchemaFilterPattern
- The schema filter pattern.options
- RPC-layer hints for this call.public SchemaResult getSchemasSchema(CallOption... options)
getSchemas(String, String, CallOption...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_SCHEMAS_SCHEMA
.
public SchemaResult getSchema(FlightDescriptor descriptor, CallOption... options)
descriptor
- The descriptor for the stream.options
- RPC-layer hints for this call.public FlightStream getStream(Ticket ticket, CallOption... options)
ticket
- The ticket granting access to the data stream.options
- RPC-layer hints for this call.public FlightInfo getSqlInfo(FlightSql.SqlInfo... info)
info
- The set of metadata to retrieve. None to retrieve all metadata.public FlightInfo getSqlInfo(FlightSql.SqlInfo[] info, CallOption... options)
info
- The set of metadata to retrieve. None to retrieve all metadata.options
- RPC-layer hints for this call.public FlightInfo getSqlInfo(int[] info, CallOption... options)
info
- The set of metadata to retrieve. None to retrieve all metadata.options
- RPC-layer hints for this call.public FlightInfo getSqlInfo(Iterable<Integer> info, CallOption... options)
info
- The set of metadata to retrieve. None to retrieve all metadata.options
- RPC-layer hints for this call.public SchemaResult getSqlInfoSchema(CallOption... options)
#getSqlInfo(SqlInfo...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_SQL_INFO_SCHEMA
.
public FlightInfo getXdbcTypeInfo(int dataType, CallOption... options)
dataType
- the data type to be used as filter.options
- RPC-layer hints for this call.public FlightInfo getXdbcTypeInfo(CallOption... options)
options
- RPC-layer hints for this call.public SchemaResult getXdbcTypeInfoSchema(CallOption... options)
getXdbcTypeInfo(CallOption...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_TYPE_INFO_SCHEMA
.
public FlightInfo getTables(String catalog, String dbSchemaFilterPattern, String tableFilterPattern, List<String> tableTypes, boolean includeSchema, CallOption... options)
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.public SchemaResult getTablesSchema(boolean includeSchema, CallOption... options)
getTables(String, String, String, List, boolean, CallOption...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_TABLES_SCHEMA
or
FlightSqlProducer.Schemas.GET_TABLES_SCHEMA_NO_SCHEMA
.
public FlightInfo getPrimaryKeys(TableRef tableRef, CallOption... options)
tableRef
- An object which hold info about catalog, dbSchema and table.options
- RPC-layer hints for this call.public SchemaResult getPrimaryKeysSchema(CallOption... options)
getPrimaryKeys(TableRef, CallOption...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_PRIMARY_KEYS_SCHEMA
.
public FlightInfo getExportedKeys(TableRef tableRef, CallOption... options)
tableRef
- An object which hold info about catalog, dbSchema and table.options
- RPC-layer hints for this call.public SchemaResult getExportedKeysSchema(CallOption... options)
getExportedKeys(TableRef, CallOption...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_EXPORTED_KEYS_SCHEMA
.
public FlightInfo getImportedKeys(TableRef tableRef, CallOption... options)
tableRef
- An object which hold info about catalog, dbSchema and table.options
- RPC-layer hints for this call.public SchemaResult getImportedKeysSchema(CallOption... options)
getImportedKeys(TableRef, CallOption...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_IMPORTED_KEYS_SCHEMA
.
public FlightInfo getCrossReference(TableRef pkTableRef, TableRef fkTableRef, CallOption... options)
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.public SchemaResult getCrossReferenceSchema(CallOption... options)
getCrossReference(TableRef, TableRef, CallOption...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_CROSS_REFERENCE_SCHEMA
.
public FlightInfo getTableTypes(CallOption... options)
options
- RPC-layer hints for this call.public SchemaResult getTableTypesSchema(CallOption... options)
getTableTypes(CallOption...)
from the server.
Should be identical to FlightSqlProducer.Schemas.GET_TABLE_TYPES_SCHEMA
.
public FlightSqlClient.PreparedStatement prepare(String query, CallOption... options)
query
- The query to prepare.options
- RPC-layer hints for this call.public FlightSqlClient.PreparedStatement prepare(String query, FlightSqlClient.Transaction transaction, CallOption... options)
query
- The query to prepare.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.public FlightSqlClient.PreparedStatement prepare(FlightSqlClient.SubstraitPlan plan, CallOption... options)
plan
- The query to prepare.options
- RPC-layer hints for this call.public FlightSqlClient.PreparedStatement prepare(FlightSqlClient.SubstraitPlan plan, FlightSqlClient.Transaction transaction, CallOption... options)
plan
- The query to prepare.transaction
- The transaction that this query is part of.options
- RPC-layer hints for this call.public FlightSqlClient.Transaction beginTransaction(CallOption... options)
public FlightSqlClient.Savepoint beginSavepoint(FlightSqlClient.Transaction transaction, String name, CallOption... options)
public void commit(FlightSqlClient.Transaction transaction, CallOption... options)
public void release(FlightSqlClient.Savepoint savepoint, CallOption... options)
public void rollback(FlightSqlClient.Transaction transaction, CallOption... options)
public void rollback(FlightSqlClient.Savepoint savepoint, CallOption... options)
public CancelFlightInfoResult cancelFlightInfo(CancelFlightInfoRequest request, CallOption... options)
request
- The query to cancel.options
- Call options.@Deprecated public CancelResult cancelQuery(FlightInfo info, CallOption... options)
cancelFlightInfo(org.apache.arrow.flight.CancelFlightInfoRequest, org.apache.arrow.flight.CallOption...)
.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.
public FlightEndpoint renewFlightEndpoint(RenewFlightEndpointRequest request, CallOption... options)
request
- The result set partition.options
- Call options.public void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 2023 The Apache Software Foundation. All rights reserved.