use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestMergeJoinMulCondition method testMergeJoinLeftOuterNullKey.
@Test
public // select * from cp.`region.json` t1 left outer join cp.`region.json` t2 on t1.non_exist = t2.non_exist2 ;
void testMergeJoinLeftOuterNullKey() throws Exception {
RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
try (Drillbit bit1 = new Drillbit(CONFIG, serviceSet);
DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, Files.toString(FileUtils.getResourceAsFile("/join/merge_join_nullkey.json"), Charsets.UTF_8).replace("${JOIN_TYPE}", "LEFT"));
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
count += b.getHeader().getRowCount();
}
b.release();
}
assertEquals(110, count);
}
}
use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestSpoolingBuffer method testMultipleExchangesSingleThread.
@Test
public void testMultipleExchangesSingleThread() throws Exception {
RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
DrillConfig conf = DrillConfig.create("drill-spool-test-module.conf");
try (Drillbit bit1 = new Drillbit(conf, serviceSet);
DrillClient client = new DrillClient(conf, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, Files.toString(FileUtils.getResourceAsFile("/work/batch/multiple_exchange.json"), Charsets.UTF_8));
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
count += b.getHeader().getRowCount();
}
b.release();
}
assertEquals(500024, count);
}
}
use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestParquetPhysicalPlan method testParseParquetPhysicalPlan.
@Test
@Ignore
public void testParseParquetPhysicalPlan() throws Exception {
RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
DrillConfig config = DrillConfig.create();
try (Drillbit bit1 = new Drillbit(config, serviceSet);
DrillClient client = new DrillClient(config, serviceSet.getCoordinator())) {
bit1.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, Resources.toString(Resources.getResource(fileName), Charsets.UTF_8));
RecordBatchLoader loader = new RecordBatchLoader(bit1.getContext().getAllocator());
int count = 0;
for (QueryDataBatch b : results) {
System.out.println(String.format("Got %d results", b.getHeader().getRowCount()));
count += b.getHeader().getRowCount();
loader.load(b.getHeader().getDef(), b.getData());
for (VectorWrapper vw : loader) {
System.out.print(vw.getValueVector().getField().getPath() + ": ");
ValueVector vv = vw.getValueVector();
for (int i = 0; i < vv.getAccessor().getValueCount(); i++) {
Object o = vv.getAccessor().getObject(i);
if (o instanceof byte[]) {
System.out.print(" [" + new String((byte[]) o) + "]");
} else {
System.out.print(" [" + vv.getAccessor().getObject(i) + "]");
}
// break;
}
System.out.println();
}
loader.clear();
b.release();
}
client.close();
System.out.println(String.format("Got %d total results", count));
}
}
use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestParquetPhysicalPlan method testParseParquetPhysicalPlanRemote.
@Test
@Ignore
public void testParseParquetPhysicalPlanRemote() throws Exception {
DrillConfig config = DrillConfig.create();
try (DrillClient client = new DrillClient(config)) {
client.connect();
ParquetResultsListener listener = new ParquetResultsListener();
Stopwatch watch = Stopwatch.createStarted();
client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, Resources.toString(Resources.getResource(fileName), Charsets.UTF_8), listener);
System.out.println(String.format("Got %d total records in %d seconds", listener.await(), watch.elapsed(TimeUnit.SECONDS)));
client.close();
}
}
use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestHBaseCFAsJSONString method openMyClient.
@BeforeClass
public static void openMyClient() throws Exception {
parent_client = client;
client = new DrillClient(config, serviceSet.getCoordinator());
client.setSupportComplexTypes(false);
client.connect();
}
Aggregations