use of org.apache.drill.exec.proto.UserProtos.QueryPlanFragments in project drill by axbaretto.
the class DrillSeparatePlanningTest method testMultiMinorFragmentComplexQuery.
@Test(timeout = 60_000)
public void testMultiMinorFragmentComplexQuery() throws Exception {
final String query = "SELECT dir0, sum(o_totalprice) FROM dfs.`multilevel/json` group by dir0 order by dir0";
QueryPlanFragments planFragments = getFragmentsHelper(query);
assertNotNull(planFragments);
assertTrue((planFragments.getFragmentsCount() > 1));
for (PlanFragment planFragment : planFragments.getFragmentsList()) {
assertTrue(planFragment.getLeafFragment());
}
int rowCount = getResultsHelper(planFragments);
assertEquals(8, rowCount);
}
use of org.apache.drill.exec.proto.UserProtos.QueryPlanFragments in project drill by axbaretto.
the class DrillSeparatePlanningTest method testPlanningNegative.
@Test(timeout = 60_000)
public void testPlanningNegative() throws Exception {
final String query = "SELECT dir0, sum(o_totalprice) FROM dfs.`multilevel/json` group by dir0 order by dir0";
// LOGICAL is not supported
final QueryPlanFragments planFragments = client.planQuery(QueryType.LOGICAL, query, false);
assertNotNull(planFragments);
assertNotNull(planFragments.getError());
assertTrue(planFragments.getFragmentsCount() == 0);
}
use of org.apache.drill.exec.proto.UserProtos.QueryPlanFragments in project drill by apache.
the class DrillSeparatePlanningTest method testMultiMinorFragmentSimpleQuery.
@Test(timeout = 60_000)
public void testMultiMinorFragmentSimpleQuery() throws Exception {
final String query = "SELECT o_orderkey FROM dfs.`multilevel/json`";
QueryPlanFragments planFragments = getFragmentsHelper(query);
assertNotNull(planFragments);
assertTrue((planFragments.getFragmentsCount() > 1));
for (PlanFragment planFragment : planFragments.getFragmentsList()) {
assertTrue(planFragment.getLeafFragment());
}
int rowCount = getResultsHelper(planFragments);
assertEquals(120, rowCount);
}
use of org.apache.drill.exec.proto.UserProtos.QueryPlanFragments in project drill by apache.
the class DrillSeparatePlanningTest method testPlanningNoSplit.
@Test(timeout = 60_000)
public void testPlanningNoSplit() throws Exception {
final String query = "SELECT dir0, sum(o_totalprice) FROM dfs.`multilevel/json` group by dir0 order by dir0";
client.alterSession("planner.slice_target", 1);
try {
final QueryPlanFragments planFragments = client.planQuery(query);
assertNotNull(planFragments);
assertTrue((planFragments.getFragmentsCount() > 1));
PlanFragment rootFragment = planFragments.getFragments(0);
assertFalse(rootFragment.getLeafFragment());
QuerySummary summary = client.queryBuilder().plan(planFragments.getFragmentsList()).run();
assertEquals(3, summary.recordCount());
} finally {
client.resetSession("planner.slice_target");
}
}
use of org.apache.drill.exec.proto.UserProtos.QueryPlanFragments in project drill by apache.
the class DrillSeparatePlanningTest method getFragmentsHelper.
private QueryPlanFragments getFragmentsHelper(final String query) throws InterruptedException, ExecutionException, RpcException {
updateTestCluster(2, config);
List<QueryDataBatch> results = client.runQuery(QueryType.SQL, "alter session set `planner.slice_target`=1");
for (QueryDataBatch batch : results) {
batch.release();
}
DrillRpcFuture<QueryPlanFragments> queryFragmentsFutures = client.planQuery(QueryType.SQL, query, true);
final QueryPlanFragments planFragments = queryFragmentsFutures.get();
for (PlanFragment fragment : planFragments.getFragmentsList()) {
System.out.println(fragment.getFragmentJson());
}
return planFragments;
}
Aggregations