use of org.apache.drill.exec.rpc.UserClientConnection in project drill by apache.
the class TestSimpleLimit method testLimitNoEnd.
@Test
public void testLimitNoEnd() throws Throwable {
final DrillbitContext bitContext = mockDrillbitContext();
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
verifyLimitCount(bitContext, connection, "test3.json", 95);
}
use of org.apache.drill.exec.rpc.UserClientConnection in project drill by apache.
the class TestSimpleLimit method testLimitAcrossBatches.
@Test
@Ignore
public // depending on the size of each outgoing batch, and when the batch could not hold any more values.
void testLimitAcrossBatches() throws Throwable {
final DrillbitContext bitContext = mockDrillbitContext();
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
verifyLimitCount(bitContext, connection, "test2.json", 69999);
final long start = 30000;
final long end = 100000;
// Formula for sum of series
final long expectedSum = (end - start) * (end + start - 1) / 2;
verifySum(bitContext, connection, "test4.json", 70000, expectedSum);
}
use of org.apache.drill.exec.rpc.UserClientConnection in project drill by apache.
the class TestSimpleProjection method project.
@Test
public void project() throws Throwable {
final DrillbitContext bitContext = mockDrillbitContext();
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/project/test1.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(bitContext, PlanFragment.getDefaultInstance(), connection, registry);
final SimpleRootExec exec = new SimpleRootExec(ImplCreator.getExec(context, (FragmentRoot) plan.getSortedOperators(false).iterator().next()));
while (exec.next()) {
VectorUtil.logVectorAccessibleContent(exec.getIncoming(), "\t");
final NullableBigIntVector c1 = exec.getValueVectorById(new SchemaPath("col1", ExpressionPosition.UNKNOWN), NullableBigIntVector.class);
final NullableBigIntVector c2 = exec.getValueVectorById(new SchemaPath("col2", ExpressionPosition.UNKNOWN), NullableBigIntVector.class);
final NullableBigIntVector.Accessor a1 = c1.getAccessor();
final NullableBigIntVector.Accessor a2 = c2.getAccessor();
for (int i = 0; i < c1.getAccessor().getValueCount(); i++) {
if (!a1.isNull(i)) {
assertEquals(a1.get(i) + 1, a2.get(i));
}
}
}
if (context.getExecutorState().getFailureCause() != null) {
throw context.getExecutorState().getFailureCause();
}
assertTrue(!context.getExecutorState().isFailed());
}
use of org.apache.drill.exec.rpc.UserClientConnection in project drill by apache.
the class TestSimpleLimit method testLimit.
@Test
public void testLimit() throws Throwable {
final DrillbitContext bitContext = mockDrillbitContext();
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
verifyLimitCount(bitContext, connection, "test1.json", 5);
}
use of org.apache.drill.exec.rpc.UserClientConnection in project drill by apache.
the class TestTraceMultiRecordBatch method testFilter.
@Test
public void testFilter() throws Throwable {
final DrillbitContext bitContext = mockDrillbitContext();
final UserClientConnection connection = Mockito.mock(UserClientConnection.class);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(c);
final PhysicalPlan plan = reader.readPhysicalPlan(Files.asCharSource(DrillFileUtils.getResourceAsFile("/trace/multi_record_batch_trace.json"), Charsets.UTF_8).read());
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(c);
final FragmentContextImpl context = new FragmentContextImpl(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.getExecutorState().getFailureCause() != null) {
throw context.getExecutorState().getFailureCause();
}
assertTrue(!context.getExecutorState().isFailed());
}
Aggregations