public class ClientFixture extends Object implements AutoCloseable
ExampleTest for usage examples| Modifier and Type | Class and Description |
|---|---|
static class |
ClientFixture.ClientBuilder |
static class |
ClientFixture.StatementParser
Very simple parser for semi-colon separated lists of SQL statements which
handles quoted semicolons.
|
| Constructor and Description |
|---|
ClientFixture(ClientFixture.ClientBuilder builder) |
| Modifier and Type | Method and Description |
|---|---|
BufferAllocator |
allocator() |
void |
alterSession(String key,
Object value)
Set a runtime option.
|
void |
alterSystem(String key,
Object value) |
DrillClient |
client() |
void |
close() |
ClusterFixture |
cluster() |
int |
countResults(List<QueryDataBatch> results) |
int |
exec(File source)
Execute a set of statements from a file.
|
int |
exec(Reader in) |
int |
exec(String stmts)
Execute a set of statements from a string.
|
ProfileParser |
parseProfile(QueryBuilder.QuerySummary summary)
Return a parsed query profile for a query summary.
|
ProfileParser |
parseProfile(String queryId)
Parse a query profile from the local storage location given the
query ID.
|
UserProtos.QueryPlanFragments |
planQuery(String sql) |
UserProtos.QueryPlanFragments |
planQuery(UserBitShared.QueryType type,
String query,
boolean isSplitPlan)
Plan a query without execution.
|
QueryBuilder |
queryBuilder() |
void |
resetSession(String key)
Reset a system option
|
void |
resetSystem(String key) |
RowSetBuilder |
rowSetBuilder(BatchSchema schema) |
RowSetBuilder |
rowSetBuilder(TupleMetadata schema) |
void |
runQueriesAndLog(String queryString)
Run zero or more queries and log the output in TSV format.
|
void |
runQueriesAndPrint(String queryString)
Run zero or more queries and print the output in TSV format.
|
void |
runSqlSilently(String sql,
Object... args)
Run SQL silently (discard results).
|
void |
setControls(String controls)
Set a set of injection controls that apply on the next query
only.
|
TestBuilder |
testBuilder() |
public ClientFixture(ClientFixture.ClientBuilder builder) throws RpcException
RpcExceptionpublic DrillClient client()
public ClusterFixture cluster()
public BufferAllocator allocator()
public void alterSession(String key, Object value)
key - option namevalue - option valuepublic void resetSession(String key)
key - option namepublic void resetSystem(String key)
public void runSqlSilently(String sql, Object... args)
sql - queryargs - format paramsIllegalStateException - if something goes wrongpublic QueryBuilder queryBuilder()
public int countResults(List<QueryDataBatch> results)
public TestBuilder testBuilder()
public void runQueriesAndLog(String queryString)
queryString - query stringpublic void runQueriesAndPrint(String queryString)
queryString - query stringpublic UserProtos.QueryPlanFragments planQuery(UserBitShared.QueryType type, String query, boolean isSplitPlan)
type - query typequery - query stringisSplitPlan - option to tell whether to return single or split plans for a querypublic UserProtos.QueryPlanFragments planQuery(String sql)
public void close()
close in interface AutoCloseablepublic ProfileParser parseProfile(QueryBuilder.QuerySummary summary) throws IOException
summary - query summaryIOException - if unable to parse query profilepublic ProfileParser parseProfile(String queryId) throws IOException
queryId - query IDIOException - if unable to parse the profilepublic void setControls(String controls)
controls - the controls string created by
Controls.newBuilder() builder.public RowSetBuilder rowSetBuilder(BatchSchema schema)
public RowSetBuilder rowSetBuilder(TupleMetadata schema)
public int exec(Reader in) throws IOException
IOExceptionpublic int exec(File source) throws IOException
source - the set of statements, separated by semicolonsIOException - if anable to execute statements from filepublic int exec(String stmts)
stmts - the set of statements, separated by semicolonsCopyright © 2021 The Apache Software Foundation. All rights reserved.