use of io.cdap.cdap.client.QueryClient in project cdap by caskdata.
the class CLIMainLinkTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
cliConfig = createCLIConfigWithURIPrefix(STANDALONE.getBaseURI());
LaunchOptions launchOptions = new LaunchOptions("", true, true, false, null, LaunchOptions.DEFAULT.getUri());
cliMain = new CLIMain(launchOptions, cliConfig);
programClient = new ProgramClient(cliConfig.getClientConfig());
queryClient = new QueryClient(cliConfig.getClientConfig());
cli = cliMain.getCLI();
testSetup(cli, STANDALONE, TMP_FOLDER);
}
use of io.cdap.cdap.client.QueryClient in project cdap by caskdata.
the class CLIMainTest method setUpClass.
@BeforeClass
public static void setUpClass() throws Exception {
cliConfig = createCLIConfig(STANDALONE.getBaseURI());
LaunchOptions launchOptions = new LaunchOptions(LaunchOptions.DEFAULT.getUri(), true, true, false);
cliMain = new CLIMain(launchOptions, cliConfig);
programClient = new ProgramClient(cliConfig.getClientConfig());
queryClient = new QueryClient(cliConfig.getClientConfig());
cli = cliMain.getCLI();
testSetup(cli, STANDALONE, TMP_FOLDER);
}
use of io.cdap.cdap.client.QueryClient in project cdap by caskdata.
the class CLITestBase method dropHiveDb.
private void dropHiveDb(String hiveDb) throws Exception {
QueryClient queryClient = getQueryClient();
assertExploreQuerySuccess(queryClient.execute(NamespaceId.DEFAULT, "drop database " + hiveDb));
}
use of io.cdap.cdap.client.QueryClient in project cdap by caskdata.
the class GenerateClientUsageExample method queryClient.
public void queryClient() throws Exception {
// Construct the client used to interact with CDAP
QueryClient queryClient = new QueryClient(clientConfig);
// Perform an ad-hoc query using the Purchase example
ListenableFuture<ExploreExecutionResult> resultFuture = queryClient.execute(NamespaceId.DEFAULT, "SELECT * FROM dataset_history WHERE customer IN ('Alice','Bob')");
ExploreExecutionResult results = resultFuture.get();
// Fetch schema
List<ColumnDesc> schema = results.getResultSchema();
String[] header = new String[schema.size()];
for (int i = 0; i < header.length; i++) {
ColumnDesc column = schema.get(i);
// Hive columns start at 1
int index = column.getPosition() - 1;
header[index] = column.getName() + ": " + column.getType();
}
}
use of io.cdap.cdap.client.QueryClient in project cdap by caskdata.
the class CLITestBase method createHiveDB.
private void createHiveDB(String hiveDb) throws Exception {
QueryClient queryClient = getQueryClient();
ListenableFuture<ExploreExecutionResult> future = queryClient.execute(NamespaceId.DEFAULT, "create database " + hiveDb);
assertExploreQuerySuccess(future);
future = queryClient.execute(NamespaceId.DEFAULT, "describe database " + hiveDb);
assertExploreQuerySuccess(future);
}
Aggregations