Search in sources :

Example 16 with PlanFragment

use of org.apache.drill.exec.proto.BitControl.PlanFragment in project drill by apache.

the class DrillSeparatePlanningTest method testMultiMinorFragmentComplexQuery.

@Test(timeout = 30000)
public void testMultiMinorFragmentComplexQuery() throws Exception {
    final String query = String.format("SELECT dir0, sum(o_totalprice) FROM dfs_test.`%s/multilevel/json` group by dir0 order by dir0", TEST_RES_PATH);
    QueryPlanFragments planFragments = getFragmentsHelper(query);
    assertNotNull(planFragments);
    assertTrue((planFragments.getFragmentsCount() > 1));
    for (PlanFragment planFragment : planFragments.getFragmentsList()) {
        assertTrue(planFragment.getLeafFragment());
    }
    getResultsHelper(planFragments);
}
Also used : QueryPlanFragments(org.apache.drill.exec.proto.UserProtos.QueryPlanFragments) PlanFragment(org.apache.drill.exec.proto.BitControl.PlanFragment) Test(org.junit.Test)

Example 17 with PlanFragment

use of org.apache.drill.exec.proto.BitControl.PlanFragment 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;
}
Also used : QueryDataBatch(org.apache.drill.exec.rpc.user.QueryDataBatch) QueryPlanFragments(org.apache.drill.exec.proto.UserProtos.QueryPlanFragments) PlanFragment(org.apache.drill.exec.proto.BitControl.PlanFragment)

Aggregations

PlanFragment (org.apache.drill.exec.proto.BitControl.PlanFragment)17 QueryWorkUnit (org.apache.drill.exec.work.QueryWorkUnit)8 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)7 Fragment (org.apache.drill.exec.planner.fragment.Fragment)5 IOException (java.io.IOException)4 PhysicalOperator (org.apache.drill.exec.physical.base.PhysicalOperator)4 FragmentHandle (org.apache.drill.exec.proto.ExecProtos.FragmentHandle)4 QueryPlanFragments (org.apache.drill.exec.proto.UserProtos.QueryPlanFragments)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 FragmentRoot (org.apache.drill.exec.physical.base.FragmentRoot)3 SimpleParallelizer (org.apache.drill.exec.planner.fragment.SimpleParallelizer)3 QueryContextInformation (org.apache.drill.exec.proto.BitControl.QueryContextInformation)3 OptionList (org.apache.drill.exec.server.options.OptionList)3 Test (org.junit.Test)3 ExecutionSetupException (org.apache.drill.common.exceptions.ExecutionSetupException)2 MinorFragmentEndpoint (org.apache.drill.exec.physical.MinorFragmentEndpoint)2 PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)2 IndexedFragmentNode (org.apache.drill.exec.planner.fragment.Materializer.IndexedFragmentNode)2 RpcException (org.apache.drill.exec.rpc.RpcException)2 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)2