Search in sources :

Example 1 with DefaultQueryParallelizer

use of org.apache.drill.exec.planner.fragment.DefaultQueryParallelizer in project drill by apache.

the class TestFragmentChecker method print.

private void print(String fragmentFile, int bitCount, int expectedFragmentCount) throws Exception {
    PhysicalPlanReader ppr = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
    Fragment fragmentRoot = getRootFragment(ppr, fragmentFile);
    SimpleParallelizer par = new DefaultQueryParallelizer(true, 1000 * 1000, 5, 10, 1.2);
    List<DrillbitEndpoint> endpoints = Lists.newArrayList();
    DrillbitEndpoint localBit = null;
    for (int i = 0; i < bitCount; i++) {
        DrillbitEndpoint b1 = DrillbitEndpoint.newBuilder().setAddress("localhost").setControlPort(1234 + i).build();
        if (i == 0) {
            localBit = b1;
        }
        endpoints.add(b1);
    }
    final QueryContextInformation queryContextInfo = Utilities.createQueryContextInfo("dummySchemaName", "938ea2d9-7cb9-4baf-9414-a5a0b7777e8e");
    QueryWorkUnit qwu = par.generateWorkUnit(new OptionList(), localBit, QueryId.getDefaultInstance(), endpoints, fragmentRoot, UserSession.Builder.newBuilder().withCredentials(UserBitShared.UserCredentials.newBuilder().setUserName("foo").build()).build(), queryContextInfo);
    qwu.applyPlan(ppr);
    assertEquals(expectedFragmentCount, qwu.getFragments().size() + 1);
}
Also used : DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) PhysicalPlanReader(org.apache.drill.exec.planner.PhysicalPlanReader) QueryWorkUnit(org.apache.drill.exec.work.QueryWorkUnit) SimpleParallelizer(org.apache.drill.exec.planner.fragment.SimpleParallelizer) Fragment(org.apache.drill.exec.planner.fragment.Fragment) DefaultQueryParallelizer(org.apache.drill.exec.planner.fragment.DefaultQueryParallelizer) DrillbitEndpoint(org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint) QueryContextInformation(org.apache.drill.exec.proto.BitControl.QueryContextInformation) OptionList(org.apache.drill.exec.server.options.OptionList)

Aggregations

PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)1 DefaultQueryParallelizer (org.apache.drill.exec.planner.fragment.DefaultQueryParallelizer)1 Fragment (org.apache.drill.exec.planner.fragment.Fragment)1 SimpleParallelizer (org.apache.drill.exec.planner.fragment.SimpleParallelizer)1 QueryContextInformation (org.apache.drill.exec.proto.BitControl.QueryContextInformation)1 DrillbitEndpoint (org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint)1 OptionList (org.apache.drill.exec.server.options.OptionList)1 QueryWorkUnit (org.apache.drill.exec.work.QueryWorkUnit)1