本文整理汇总了Java中org.apache.drill.exec.ops.FragmentContext.close方法的典型用法代码示例。如果您正苦于以下问题:Java FragmentContext.close方法的具体用法?Java FragmentContext.close怎么用?Java FragmentContext.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.drill.exec.ops.FragmentContext
的用法示例。
在下文中一共展示了FragmentContext.close方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCastNumException
import org.apache.drill.exec.ops.FragmentContext; //导入方法依赖的package包/类
@Test(expected = NumberFormatException.class)
public void testCastNumException(@Injectable final DrillbitContext bitContext,
@Injectable UserServer.UserClientConnection connection) throws Throwable {
final BufferAllocator allocator = RootAllocatorFactory.newRoot(c);
new NonStrictExpectations() {{
bitContext.getMetrics(); result = new MetricRegistry();
bitContext.getAllocator(); result = allocator;
bitContext.getConfig(); result = c;
bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
}};
final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/functions/cast/testCastNumException.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()) {
}
exec.close();
context.close();
allocator.close();
assertTrue(context.isFailed());
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
}
示例2: testCastBigInt
import org.apache.drill.exec.ops.FragmentContext; //导入方法依赖的package包/类
@Test
// cast to bigint.
public void testCastBigInt(@Injectable final DrillbitContext bitContext,
@Injectable UserServer.UserClientConnection connection) throws Throwable {
final BufferAllocator allocator = RootAllocatorFactory.newRoot(c);
new NonStrictExpectations() {{
bitContext.getMetrics(); result = new MetricRegistry();
bitContext.getAllocator(); result = allocator;
bitContext.getConfig(); result = c;
bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
}};
final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/functions/cast/testCastBigInt.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()) {
final BigIntVector c0 = exec.getValueVectorById(new SchemaPath("varchar_cast", ExpressionPosition.UNKNOWN), BigIntVector.class);
final BigIntVector.Accessor a0 = c0.getAccessor();
int count = 0;
for(int i = 0; i < c0.getAccessor().getValueCount(); i++) {
BigIntHolder holder0 = new BigIntHolder();
a0.get(i, holder0);
assertEquals(1256, holder0.value);
++count;
}
assertEquals(5, count);
}
exec.close();
context.close();
allocator.close();
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
示例3: testCastInt
import org.apache.drill.exec.ops.FragmentContext; //导入方法依赖的package包/类
@Test
//cast to int
public void testCastInt(@Injectable final DrillbitContext bitContext,
@Injectable UserServer.UserClientConnection connection) throws Throwable {
final BufferAllocator allocator = RootAllocatorFactory.newRoot(c);
new NonStrictExpectations() {{
bitContext.getMetrics(); result = new MetricRegistry();
bitContext.getAllocator(); result = allocator;
bitContext.getConfig(); result = c;
bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
}};
final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/functions/cast/testCastInt.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()) {
final IntVector c0 = exec.getValueVectorById(new SchemaPath("varchar_cast", ExpressionPosition.UNKNOWN), IntVector.class);
final IntVector.Accessor a0 = c0.getAccessor();
int count = 0;
for(int i = 0; i < c0.getAccessor().getValueCount(); i++) {
final IntHolder holder0 = new IntHolder();
a0.get(i, holder0);
assertEquals(1256, holder0.value);
++count;
}
assertEquals(5, count);
}
exec.close();
context.close();
allocator.close();
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
示例4: testCastFloat4
import org.apache.drill.exec.ops.FragmentContext; //导入方法依赖的package包/类
@Test
//cast to float4
public void testCastFloat4(@Injectable final DrillbitContext bitContext,
@Injectable UserServer.UserClientConnection connection) throws Throwable {
final BufferAllocator allocator = RootAllocatorFactory.newRoot(c);
new NonStrictExpectations() {{
bitContext.getMetrics(); result = new MetricRegistry();
bitContext.getAllocator(); result = allocator;
bitContext.getConfig(); result = c;
bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
}};
final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/functions/cast/testCastFloat4.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()) {
final Float4Vector c0 = exec.getValueVectorById(new SchemaPath("varchar_cast2", ExpressionPosition.UNKNOWN), Float4Vector.class);
final Float4Vector.Accessor a0 = c0.getAccessor();
int count = 0;
for(int i = 0; i < c0.getAccessor().getValueCount(); i++) {
final Float4Holder holder0 = new Float4Holder();
a0.get(i, holder0);
assertEquals(12.56, holder0.value, 0.001);
++count;
}
assertEquals(5, count);
}
exec.close();
context.close();
allocator.close();
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
示例5: testCastFloat8
import org.apache.drill.exec.ops.FragmentContext; //导入方法依赖的package包/类
@Test
//cast to float8
public void testCastFloat8(@Injectable final DrillbitContext bitContext,
@Injectable UserServer.UserClientConnection connection) throws Throwable {
final BufferAllocator allocator = RootAllocatorFactory.newRoot(c);
new NonStrictExpectations() {{
bitContext.getMetrics(); result = new MetricRegistry();
bitContext.getAllocator(); result = allocator;
bitContext.getConfig(); result = c;
bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
}};
final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/functions/cast/testCastFloat8.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()) {
final Float8Vector c0 = exec.getValueVectorById(new SchemaPath("varchar_cast2", ExpressionPosition.UNKNOWN), Float8Vector.class);
final Float8Vector.Accessor a0 = c0.getAccessor();
int count = 0;
for(int i = 0; i < c0.getAccessor().getValueCount(); i++){
final Float8Holder holder0 = new Float8Holder();
a0.get(i, holder0);
assertEquals(12.56, holder0.value, 0.001);
++count;
}
assertEquals(5, count);
}
exec.close();
context.close();
allocator.close();
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
示例6: testCastVarChar
import org.apache.drill.exec.ops.FragmentContext; //导入方法依赖的package包/类
@Test
//cast to varchar(length)
public void testCastVarChar(@Injectable final DrillbitContext bitContext,
@Injectable UserServer.UserClientConnection connection) throws Throwable {
final BufferAllocator allocator = RootAllocatorFactory.newRoot(c);
new NonStrictExpectations() {{
bitContext.getMetrics(); result = new MetricRegistry();
bitContext.getAllocator(); result = allocator;
bitContext.getConfig(); result = c;
bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
}};
final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/functions/cast/testCastVarChar.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()) {
final VarCharVector c0 = exec.getValueVectorById(new SchemaPath("int_lit_cast", ExpressionPosition.UNKNOWN), VarCharVector.class);
final VarCharVector.Accessor a0 = c0.getAccessor();
int count = 0;
for(int i = 0; i < c0.getAccessor().getValueCount(); i++) {
final VarCharHolder holder0 = new VarCharHolder();
a0.get(i, holder0);
assertEquals("123", StringFunctionHelpers.toStringFromUTF8(holder0.start, holder0.end, holder0.buffer));
++count;
}
assertEquals(5, count);
}
exec.close();
context.close();
allocator.close();
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
示例7: testCastVarBinary
import org.apache.drill.exec.ops.FragmentContext; //导入方法依赖的package包/类
@Test
//cast to varbinary(length)
public void testCastVarBinary(@Injectable final DrillbitContext bitContext,
@Injectable UserServer.UserClientConnection connection) throws Throwable {
final BufferAllocator allocator = RootAllocatorFactory.newRoot(c);
new NonStrictExpectations() {{
bitContext.getMetrics(); result = new MetricRegistry();
bitContext.getAllocator(); result = allocator;
bitContext.getConfig(); result = c;
bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
}};
final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/functions/cast/testCastVarBinary.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()) {
final VarBinaryVector c0 = exec.getValueVectorById(new SchemaPath("int_lit_cast", ExpressionPosition.UNKNOWN), VarBinaryVector.class);
final VarBinaryVector.Accessor a0 = c0.getAccessor();
int count = 0;
for(int i = 0; i < c0.getAccessor().getValueCount(); i++) {
final VarBinaryHolder holder0 = new VarBinaryHolder();
a0.get(i, holder0);
assertEquals("123", StringFunctionHelpers.toStringFromUTF8(holder0.start, holder0.end, holder0.buffer));
++count;
}
assertEquals(5, count);
}
exec.close();
context.close();
allocator.close();
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
示例8: testCastNested
import org.apache.drill.exec.ops.FragmentContext; //导入方法依赖的package包/类
@Test
//nested: cast is nested in another cast, or another function.
public void testCastNested(@Injectable final DrillbitContext bitContext,
@Injectable UserServer.UserClientConnection connection) throws Throwable {
final BufferAllocator allocator = RootAllocatorFactory.newRoot(c);
new NonStrictExpectations() {{
bitContext.getMetrics(); result = new MetricRegistry();
bitContext.getAllocator(); result = allocator;
bitContext.getConfig(); result = c;
bitContext.getCompiler(); result = CodeCompiler.getTestCompiler(c);
bitContext.getOperatorCreatorRegistry(); result = new OperatorCreatorRegistry(c);
}};
final PhysicalPlanReader reader = new PhysicalPlanReader(c, c.getMapper(), CoordinationProtos.DrillbitEndpoint.getDefaultInstance());
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(FileUtils.getResourceAsFile("/functions/cast/testCastNested.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()) {
final IntVector c0 = exec.getValueVectorById(new SchemaPath("add_cast", ExpressionPosition.UNKNOWN),IntVector.class);
final IntVector.Accessor a0 = c0.getAccessor();
int count = 0;
for(int i = 0; i < c0.getAccessor().getValueCount(); i++) {
final IntHolder holder0 = new IntHolder();
a0.get(i, holder0);
assertEquals(300, holder0.value);
++count;
}
assertEquals(5, count);
}
exec.close();
context.close();
allocator.close();
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}