use of org.apache.drill.exec.physical.impl.SimpleRootExec in project drill by apache.
the class TestTraceMultiRecordBatch method testFilter.
@Test
public void testFilter(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable {
mockDrillbitContext(bitContext);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/trace/multi_record_batch_trace.json"), Charsets.UTF_8));
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()));
while (exec.next()) {
for (final ValueVector vv : exec) {
vv.clear();
}
}
exec.close();
if (context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
use of org.apache.drill.exec.physical.impl.SimpleRootExec in project drill by apache.
the class TestAgg method oneKeyAgg.
@Test
public void oneKeyAgg(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable {
final SimpleRootExec exec = doTest(bitContext, connection, "/agg/test1.json");
while (exec.next()) {
final BigIntVector cnt = exec.getValueVectorById(SchemaPath.getSimplePath("cnt"), BigIntVector.class);
final IntVector key = exec.getValueVectorById(SchemaPath.getSimplePath("blue"), IntVector.class);
final long[] cntArr = { 10001, 9999 };
final int[] keyArr = { Integer.MIN_VALUE, Integer.MAX_VALUE };
for (int i = 0; i < exec.getRecordCount(); i++) {
assertEquals((Long) cntArr[i], cnt.getAccessor().getObject(i));
assertEquals((Integer) keyArr[i], key.getAccessor().getObject(i));
}
}
if (exec.getContext().getFailureCause() != null) {
throw exec.getContext().getFailureCause();
}
assertTrue(!exec.getContext().isFailed());
}
use of org.apache.drill.exec.physical.impl.SimpleRootExec in project drill by apache.
the class TestSimpleFilter method testFilter.
@Test
public void testFilter(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable {
// System.out.println(System.getProperty("java.class.path"));
mockDrillbitContext(bitContext);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/filter/test1.json"), Charsets.UTF_8));
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()));
while (exec.next()) {
assertEquals(50, exec.getRecordCount());
}
exec.close();
if (context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
use of org.apache.drill.exec.physical.impl.SimpleRootExec in project drill by apache.
the class TestSimpleFilter method testSV4Filter.
@Test
@Ignore("Filter does not support SV4")
public void testSV4Filter(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable {
mockDrillbitContext(bitContext);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/filter/test_sv4.json"), Charsets.UTF_8));
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 recordCount = 0;
while (exec.next()) {
for (int i = 0; i < exec.getSelectionVector4().getCount(); i++) {
System.out.println("Got: " + exec.getSelectionVector4().get(i));
}
recordCount += exec.getSelectionVector4().getCount();
}
exec.close();
assertEquals(50, recordCount);
if (context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
use of org.apache.drill.exec.physical.impl.SimpleRootExec in project drill by apache.
the class TestMergeJoin method testJoinBatchSize.
@Test
public void testJoinBatchSize(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable {
mockDrillbitContext(bitContext);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/join/join_batchsize.json"), Charsets.UTF_8));
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()));
// skip schema batch
exec.next();
while (exec.next()) {
assertEquals(100, exec.getRecordCount());
}
if (context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
Aggregations