public class DrillClient extends Object implements Closeable, ConnectionThrottle
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CLIENT_NAME |
Constructor and Description |
---|
DrillClient() |
DrillClient(boolean isDirect) |
DrillClient(DrillConfig config) |
DrillClient(DrillConfig config,
boolean isDirect) |
DrillClient(DrillConfig config,
ClusterCoordinator coordinator) |
DrillClient(DrillConfig config,
ClusterCoordinator coordinator,
boolean isDirect) |
DrillClient(DrillConfig config,
ClusterCoordinator coordinator,
BufferAllocator allocator) |
DrillClient(DrillConfig config,
ClusterCoordinator coordinator,
BufferAllocator allocator,
boolean isDirect) |
DrillClient(String fileName) |
Modifier and Type | Method and Description |
---|---|
DrillRpcFuture<GeneralRPCProtos.Ack> |
cancelQuery(UserBitShared.QueryId id) |
void |
close()
Closes this client's connection to the server
|
void |
connect()
Connects the client to a Drillbit server
|
void |
connect(Properties props)
Start's a connection from client to server
|
void |
connect(String connect,
Properties props)
Start's a connection from client to server
|
boolean |
connectionIsActive() |
protected static io.netty.channel.EventLoopGroup |
createEventLoop(int size,
String prefix) |
DrillRpcFuture<UserProtos.CreatePreparedStatementResp> |
createPreparedStatement(String query)
Create a prepared statement for given the
query . |
List<QueryDataBatch> |
executePreparedStatement(UserProtos.PreparedStatementHandle preparedStatementHandle)
Execute the given prepared statement and return the results.
|
void |
executePreparedStatement(UserProtos.PreparedStatementHandle preparedStatementHandle,
UserResultsListener resultsListener)
Execute the given prepared statement.
|
BufferAllocator |
getAllocator() |
DrillRpcFuture<UserProtos.GetCatalogsResp> |
getCatalogs(UserProtos.LikeFilter catalogNameFilter)
Get the list of catalogs in
INFORMATION_SCHEMA.CATALOGS table satisfying the given filters. |
DrillRpcFuture<UserProtos.GetColumnsResp> |
getColumns(UserProtos.LikeFilter catalogNameFilter,
UserProtos.LikeFilter schemaNameFilter,
UserProtos.LikeFilter tableNameFilter,
UserProtos.LikeFilter columnNameFilter)
Get the list of columns in
INFORMATION_SCHEMA.COLUMNS table satisfying the given filters. |
DrillConfig |
getConfig() |
DrillRpcFuture<UserProtos.GetSchemasResp> |
getSchemas(UserProtos.LikeFilter catalogNameFilter,
UserProtos.LikeFilter schemaNameFilter)
Get the list of schemas in
INFORMATION_SCHEMA.SCHEMATA table satisfying the given filters. |
UserProtos.RpcEndpointInfos |
getServerInfos()
Deprecated.
use
DrillClient#getServerVersion() |
DrillRpcFuture<UserProtos.GetServerMetaResp> |
getServerMeta()
Get server meta information
Get meta information about the server like the the available functions
or the identifier quoting string used by the current session
|
String |
getServerName()
Return the server name.
|
Version |
getServerVersion()
Return the server version.
|
Set<ServerMethod> |
getSupportedMethods()
Returns the list of methods supported by the server based on its advertised information.
|
DrillRpcFuture<UserProtos.GetTablesResp> |
getTables(UserProtos.LikeFilter catalogNameFilter,
UserProtos.LikeFilter schemaNameFilter,
UserProtos.LikeFilter tableNameFilter,
List<String> tableTypeFilter)
Get the list of tables in
INFORMATION_SCHEMA.TABLES table satisfying the given filters. |
boolean |
hasPing(long timeoutSec)
Verify connection with request-answer.
|
DrillRpcFuture<UserProtos.QueryPlanFragments> |
planQuery(UserBitShared.QueryType type,
String query,
boolean isSplitPlan)
API to just plan a query without execution
|
boolean |
reconnect() |
DrillRpcFuture<GeneralRPCProtos.Ack> |
resumeQuery(UserBitShared.QueryId queryId) |
void |
runQuery(UserBitShared.QueryType type,
List<BitControl.PlanFragment> planFragments,
UserResultsListener resultsListener)
Run query based on list of fragments that were supposedly produced during query planning phase.
|
List<QueryDataBatch> |
runQuery(UserBitShared.QueryType type,
String plan)
Submits a string based query plan for execution and returns the result batches.
|
void |
runQuery(UserBitShared.QueryType type,
String plan,
UserResultsListener resultsListener)
Submits a Logical plan for direct execution (bypasses parsing)
|
void |
setAutoRead(boolean enableAutoRead) |
void |
setClientName(String name)
Sets the client name.
|
void |
setSupportComplexTypes(boolean supportComplexTypes)
Sets whether the application is willing to accept complex types (Map,
Arrays) in the returned result set.
|
public static final String DEFAULT_CLIENT_NAME
public DrillClient() throws OutOfMemoryException
OutOfMemoryException
public DrillClient(boolean isDirect) throws OutOfMemoryException
OutOfMemoryException
public DrillClient(String fileName) throws OutOfMemoryException
OutOfMemoryException
public DrillClient(DrillConfig config) throws OutOfMemoryException
OutOfMemoryException
public DrillClient(DrillConfig config, boolean isDirect) throws OutOfMemoryException
OutOfMemoryException
public DrillClient(DrillConfig config, ClusterCoordinator coordinator) throws OutOfMemoryException
OutOfMemoryException
public DrillClient(DrillConfig config, ClusterCoordinator coordinator, boolean isDirect) throws OutOfMemoryException
OutOfMemoryException
public DrillClient(DrillConfig config, ClusterCoordinator coordinator, BufferAllocator allocator) throws OutOfMemoryException
OutOfMemoryException
public DrillClient(DrillConfig config, ClusterCoordinator coordinator, BufferAllocator allocator, boolean isDirect)
public DrillConfig getConfig()
public void setAutoRead(boolean enableAutoRead)
setAutoRead
in interface ConnectionThrottle
public void setClientName(String name)
DrillClient#DEFAULT_CLIENT_NAME
.name
- the client nameIllegalStateException
- if called after a connection has been established.NullPointerException
- if client name is nullpublic void setSupportComplexTypes(boolean supportComplexTypes)
true
. If set to
false
, the complex types are returned as JSON encoded VARCHAR type.IllegalStateException
- if called after a connection has been established.public void connect() throws RpcException
RpcException
public void connect(Properties props) throws RpcException
props
- - not null Properties
filled with connection url parametersRpcException
public void connect(String connect, Properties props) throws RpcException
connect
- - Zookeeper connection string provided at connection URLprops
- - not null Properties
filled with connection url parametersRpcException
protected static io.netty.channel.EventLoopGroup createEventLoop(int size, String prefix)
public boolean reconnect()
public BufferAllocator getAllocator()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
@Deprecated public UserProtos.RpcEndpointInfos getServerInfos()
DrillClient#getServerVersion()
public String getServerName()
public Version getServerVersion()
public DrillRpcFuture<UserProtos.GetServerMetaResp> getServerMeta()
public Set<ServerMethod> getSupportedMethods()
public List<QueryDataBatch> runQuery(UserBitShared.QueryType type, String plan) throws RpcException
type
- Query typeplan
- Query to executeRpcException
public DrillRpcFuture<UserProtos.QueryPlanFragments> planQuery(UserBitShared.QueryType type, String query, boolean isSplitPlan)
type
- query
- isSplitPlan
- option to tell whether to return single or split plans for a queryrunQuery(org.apache.drill.exec.proto.UserBitShared.QueryType,
java.util.List, org.apache.drill.exec.rpc.user.UserResultsListener)
to run a query without additional planningpublic void runQuery(UserBitShared.QueryType type, List<BitControl.PlanFragment> planFragments, UserResultsListener resultsListener) throws RpcException
UserBitShared.QueryType.EXECUTION
type
- planFragments
- resultsListener
- RpcException
public DrillRpcFuture<GeneralRPCProtos.Ack> cancelQuery(UserBitShared.QueryId id)
public DrillRpcFuture<GeneralRPCProtos.Ack> resumeQuery(UserBitShared.QueryId queryId)
public DrillRpcFuture<UserProtos.GetCatalogsResp> getCatalogs(UserProtos.LikeFilter catalogNameFilter)
INFORMATION_SCHEMA.CATALOGS
table satisfying the given filters.catalogNameFilter
- Filter on catalog name
. Pass null to apply no filter.INFORMATION_SCHEMA.CATALOGS
table satisfying the given filters.public DrillRpcFuture<UserProtos.GetSchemasResp> getSchemas(UserProtos.LikeFilter catalogNameFilter, UserProtos.LikeFilter schemaNameFilter)
INFORMATION_SCHEMA.SCHEMATA
table satisfying the given filters.catalogNameFilter
- Filter on catalog name
. Pass null to apply no filter.schemaNameFilter
- Filter on schema name
. Pass null to apply no filter.INFORMATION_SCHEMA.SCHEMATA
table satisfying the given filters.public DrillRpcFuture<UserProtos.GetTablesResp> getTables(UserProtos.LikeFilter catalogNameFilter, UserProtos.LikeFilter schemaNameFilter, UserProtos.LikeFilter tableNameFilter, List<String> tableTypeFilter)
INFORMATION_SCHEMA.TABLES
table satisfying the given filters.catalogNameFilter
- Filter on catalog name
. Pass null to apply no filter.schemaNameFilter
- Filter on schema name
. Pass null to apply no filter.tableNameFilter
- Filter in table name
. Pass null to apply no filter.tableTypeFilter
- Filter in table type
. Pass null to apply no filterINFORMATION_SCHEMA.TABLES
table satisfying the given filters.public DrillRpcFuture<UserProtos.GetColumnsResp> getColumns(UserProtos.LikeFilter catalogNameFilter, UserProtos.LikeFilter schemaNameFilter, UserProtos.LikeFilter tableNameFilter, UserProtos.LikeFilter columnNameFilter)
INFORMATION_SCHEMA.COLUMNS
table satisfying the given filters.catalogNameFilter
- Filter on catalog name
. Pass null to apply no filter.schemaNameFilter
- Filter on schema name
. Pass null to apply no filter.tableNameFilter
- Filter in table name
. Pass null to apply no filter.columnNameFilter
- Filter in column name
. Pass null to apply no filter.INFORMATION_SCHEMA.COLUMNS
table satisfying the given filters.public DrillRpcFuture<UserProtos.CreatePreparedStatementResp> createPreparedStatement(String query)
query
.query
- query
.public void executePreparedStatement(UserProtos.PreparedStatementHandle preparedStatementHandle, UserResultsListener resultsListener)
preparedStatementHandle
- Prepared statement handle returned in response to
createPreparedStatement(String)
.resultsListener
- UserResultsListener
instance for listening for query results.public List<QueryDataBatch> executePreparedStatement(UserProtos.PreparedStatementHandle preparedStatementHandle) throws RpcException
preparedStatementHandle
- Prepared statement handle returned in response to
createPreparedStatement(String)
.QueryDataBatch
s. It is responsibility of the caller to release query data batches.RpcException
public void runQuery(UserBitShared.QueryType type, String plan, UserResultsListener resultsListener)
plan
- the plan to executepublic boolean connectionIsActive()
public boolean hasPing(long timeoutSec) throws DrillRuntimeException
timeoutSec
- time in seconds to wait answer receiving. If 0 then won't wait.PONG
received until timeout, false otherwiseDrillRuntimeException
Copyright © 1970 The Apache Software Foundation. All rights reserved.