Search in sources :

Example 26 with SimpleRootExec

use of org.apache.drill.exec.physical.impl.SimpleRootExec in project drill by apache.

the class TestMergeJoin method orderedEqualityMultiBatchJoin.

@Test
@Ignore
public void orderedEqualityMultiBatchJoin(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable {
    mockDrillbitContext(bitContext);
    final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c, new StoragePluginRegistryImpl(bitContext));
    final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/join/merge_multi_batch.json"), Charsets.UTF_8).replace("#{LEFT_FILE}", FileUtils.getResourceAsFile("/join/merge_multi_batch.left.json").toURI().toString()).replace("#{RIGHT_FILE}", FileUtils.getResourceAsFile("/join/merge_multi_batch.right.json").toURI().toString()));
    final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
    final FragmentContext context = new FragmentContext(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
    final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
    int totalRecordCount = 0;
    while (exec.next()) {
        totalRecordCount += exec.getRecordCount();
        System.out.println("got next with record count: " + exec.getRecordCount() + " (total: " + totalRecordCount + "):");
        for (int valueIdx = 0; valueIdx < exec.getRecordCount(); valueIdx++) {
            final List<Object> row = Lists.newArrayList();
            for (final ValueVector v : exec) {
                row.add(v.getField().getPath() + ":" + v.getAccessor().getObject(valueIdx));
            }
            for (final Object cell : row) {
                if (cell == null) {
                    System.out.print("<null>    ");
                    continue;
                }
                int len = cell.toString().length();
                System.out.print(cell + " ");
                for (int i = 0; i < (10 - len); ++i) {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }
    System.out.println("Total Record Count: " + totalRecordCount);
    assertEquals(25, totalRecordCount);
    if (context.getFailureCause() != null) {
        throw context.getFailureCause();
    }
    assertTrue(!context.isFailed());
}
Also used : ValueVector(org.apache.drill.exec.vector.ValueVector) SimpleRootExec(org.apache.drill.exec.physical.impl.SimpleRootExec) PhysicalPlan(org.apache.drill.exec.physical.PhysicalPlan) FragmentContext(org.apache.drill.exec.ops.FragmentContext) PhysicalPlanReader(org.apache.drill.exec.planner.PhysicalPlanReader) StoragePluginRegistryImpl(org.apache.drill.exec.store.StoragePluginRegistryImpl) FragmentRoot(org.apache.drill.exec.physical.base.FragmentRoot) FunctionImplementationRegistry(org.apache.drill.exec.expr.fn.FunctionImplementationRegistry) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

SimpleRootExec (org.apache.drill.exec.physical.impl.SimpleRootExec)26 FunctionImplementationRegistry (org.apache.drill.exec.expr.fn.FunctionImplementationRegistry)24 FragmentContext (org.apache.drill.exec.ops.FragmentContext)24 PhysicalPlan (org.apache.drill.exec.physical.PhysicalPlan)24 FragmentRoot (org.apache.drill.exec.physical.base.FragmentRoot)23 PhysicalPlanReader (org.apache.drill.exec.planner.PhysicalPlanReader)23 Test (org.junit.Test)20 ExecTest (org.apache.drill.exec.ExecTest)13 ValueVector (org.apache.drill.exec.vector.ValueVector)8 IntVector (org.apache.drill.exec.vector.IntVector)6 SchemaPath (org.apache.drill.common.expression.SchemaPath)5 BigIntVector (org.apache.drill.exec.vector.BigIntVector)5 Ignore (org.junit.Ignore)5 StoragePluginRegistryImpl (org.apache.drill.exec.store.StoragePluginRegistryImpl)3 NullableBigIntVector (org.apache.drill.exec.vector.NullableBigIntVector)3 OpProfileDef (org.apache.drill.exec.ops.OpProfileDef)2 OperatorStats (org.apache.drill.exec.ops.OperatorStats)2 PhysicalOperator (org.apache.drill.exec.physical.base.PhysicalOperator)2 FragmentHandle (org.apache.drill.exec.proto.ExecProtos.FragmentHandle)2 Configuration (org.apache.hadoop.conf.Configuration)2