use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestMergeJoinMulCondition method testMergeJoinInnerNullKey.
@Test
public // select * from cp.`region.json` t1, cp.`region.json` t2 where t1.non_exist = t2.non_exist2 ;
void testMergeJoinInnerNullKey() 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}", "INNER"));
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
count += b.getHeader().getRowCount();
}
b.release();
}
assertEquals(0, count);
}
}
use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestMergeJoinMulCondition method testMergeJoinMultiKeys.
@Test
public // + " l.l_suppkey = ps.ps_suppkey";
void testMergeJoinMultiKeys() 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/mj_multi_condition.json"), Charsets.UTF_8));
int count = 0;
for (QueryDataBatch b : results) {
if (b.getHeader().getRowCount() != 0) {
count += b.getHeader().getRowCount();
}
b.release();
}
assertEquals(60175, count);
}
}
use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestDateTypes method testTimeStamp.
@Test
public void testTimeStamp() throws Exception {
try (RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
Drillbit bit = new Drillbit(CONFIG, serviceSet);
DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
// run query.
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, Files.toString(FileUtils.getResourceAsFile("/record/vector/test_timestamp.json"), Charsets.UTF_8).replace("#{TEST_FILE}", "/test_simple_date.json"));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
QueryDataBatch batch = results.get(0);
assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData()));
for (VectorWrapper<?> v : batchLoader) {
ValueVector.Accessor accessor = v.getValueVector().getAccessor();
assertEquals(accessor.getObject(0).toString(), "1970-01-02 10:20:33.000");
assertEquals(accessor.getObject(1).toString(), "2008-12-28 11:34:00.129");
assertEquals(accessor.getObject(2).toString(), "2000-02-27 14:24:00.000");
}
batchLoader.clear();
for (QueryDataBatch b : results) {
b.release();
}
}
}
use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestDateTypes method testInterval.
@Test
public void testInterval() throws Exception {
try (RemoteServiceSet serviceSet = RemoteServiceSet.getLocalServiceSet();
Drillbit bit = new Drillbit(CONFIG, serviceSet);
DrillClient client = new DrillClient(CONFIG, serviceSet.getCoordinator())) {
// run query.
bit.run();
client.connect();
List<QueryDataBatch> results = client.runQuery(org.apache.drill.exec.proto.UserBitShared.QueryType.PHYSICAL, Files.toString(FileUtils.getResourceAsFile("/record/vector/test_interval.json"), Charsets.UTF_8).replace("#{TEST_FILE}", "/test_simple_interval.json"));
RecordBatchLoader batchLoader = new RecordBatchLoader(bit.getContext().getAllocator());
QueryDataBatch batch = results.get(0);
assertTrue(batchLoader.load(batch.getHeader().getDef(), batch.getData()));
Iterator<VectorWrapper<?>> itr = batchLoader.iterator();
ValueVector.Accessor accessor = itr.next().getValueVector().getAccessor();
// Check the interval type
assertEquals((accessor.getObject(0).toString()), ("2 years 2 months 1 day 1:20:35.0"));
assertEquals((accessor.getObject(1).toString()), ("2 years 2 months 0 days 0:0:0.0"));
assertEquals((accessor.getObject(2).toString()), ("0 years 0 months 0 days 1:20:35.0"));
assertEquals((accessor.getObject(3).toString()), ("2 years 2 months 1 day 1:20:35.897"));
assertEquals((accessor.getObject(4).toString()), ("0 years 0 months 0 days 0:0:35.4"));
assertEquals((accessor.getObject(5).toString()), ("1 year 10 months 1 day 0:-39:-25.0"));
accessor = itr.next().getValueVector().getAccessor();
// Check the interval year type
assertEquals((accessor.getObject(0).toString()), ("2 years 2 months "));
assertEquals((accessor.getObject(1).toString()), ("2 years 2 months "));
assertEquals((accessor.getObject(2).toString()), ("0 years 0 months "));
assertEquals((accessor.getObject(3).toString()), ("2 years 2 months "));
assertEquals((accessor.getObject(4).toString()), ("0 years 0 months "));
assertEquals((accessor.getObject(5).toString()), ("1 year 10 months "));
accessor = itr.next().getValueVector().getAccessor();
// Check the interval day type
assertEquals((accessor.getObject(0).toString()), ("1 day 1:20:35.0"));
assertEquals((accessor.getObject(1).toString()), ("0 days 0:0:0.0"));
assertEquals((accessor.getObject(2).toString()), ("0 days 1:20:35.0"));
assertEquals((accessor.getObject(3).toString()), ("1 day 1:20:35.897"));
assertEquals((accessor.getObject(4).toString()), ("0 days 0:0:35.4"));
assertEquals((accessor.getObject(5).toString()), ("1 day 0:-39:-25.0"));
batchLoader.clear();
for (QueryDataBatch b : results) {
b.release();
}
}
}
use of org.apache.drill.exec.client.DrillClient in project drill by apache.
the class TestDistributedFragmentRun method oneBitOneExchangeTwoEntryRun.
@Test
public void oneBitOneExchangeTwoEntryRun() 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(QueryType.PHYSICAL, Files.toString(FileUtils.getResourceAsFile("/physical_single_exchange_double_entry.json"), Charsets.UTF_8));
int count = 0;
for (QueryDataBatch b : results) {
count += b.getHeader().getRowCount();
b.release();
}
assertEquals(200, count);
}
}
Aggregations