Search in sources :

Example 6 with QueryPlanFragments

use of org.apache.drill.exec.proto.UserProtos.QueryPlanFragments 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 7 with QueryPlanFragments

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;
}
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)

Example 8 with QueryPlanFragments

use of org.apache.drill.exec.proto.UserProtos.QueryPlanFragments in project drill by apache.

the class DrillSeparatePlanningTest method testPlanningNegative.

@Test(timeout = 30000)
public void testPlanningNegative() 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);
    updateTestCluster(2, config);
    // LOGICAL is not supported
    DrillRpcFuture<QueryPlanFragments> queryFragmentsFutures = client.planQuery(QueryType.LOGICAL, query, false);
    final QueryPlanFragments planFragments = queryFragmentsFutures.get();
    assertNotNull(planFragments);
    assertNotNull(planFragments.getError());
    assertTrue(planFragments.getFragmentsCount() == 0);
}
Also used : QueryPlanFragments(org.apache.drill.exec.proto.UserProtos.QueryPlanFragments) Test(org.junit.Test)

Aggregations

QueryPlanFragments (org.apache.drill.exec.proto.UserProtos.QueryPlanFragments)8 Test (org.junit.Test)5 PlanFragment (org.apache.drill.exec.proto.BitControl.PlanFragment)4 GetQueryPlanFragments (org.apache.drill.exec.proto.UserProtos.GetQueryPlanFragments)2 QueryDataBatch (org.apache.drill.exec.rpc.user.QueryDataBatch)2 QueryContext (org.apache.drill.exec.ops.QueryContext)1 DrillPBError (org.apache.drill.exec.proto.UserBitShared.DrillPBError)1 QueryId (org.apache.drill.exec.proto.UserBitShared.QueryId)1