本文整理汇总了Java中org.apache.drill.exec.expr.holders.IntHolder类的典型用法代码示例。如果您正苦于以下问题:Java IntHolder类的具体用法?Java IntHolder怎么用?Java IntHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IntHolder类属于org.apache.drill.exec.expr.holders包,在下文中一共展示了IntHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setup
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
public void setup() {
classifier = new WekaUpdatableClassifierHolder();
function = new StringHolder();
arffHeader = new StringHolder();
firstRun = new BitHolder();
instancesHolder = new ObjectHolder();
instancesHolder.obj = null;
// instancesList = new LinkedListHolder<weka.core.Instances>();
// instancesList.list = new java.util.LinkedList<weka.core.Instances>();
// instancesList.algorithm=null;
// instancesList.options = null;
classifier.classifier=null;
function.value=null;
arffHeader.value=null;
firstRun.value=0;
currVal = new VarCharHolder();
updatable = new IntHolder();
updatable.value=-1;
aggregatable = new IntHolder();
aggregatable.value=-1;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:22,代码来源:Weka.java
示例2: getValueExpressionFromConst
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
private LogicalExpression getValueExpressionFromConst(ValueHolder holder, TypeProtos.MinorType type) {
switch (type) {
case INT:
return ValueExpressions.getInt(((IntHolder) holder).value);
case BIGINT:
return ValueExpressions.getBigInt(((BigIntHolder) holder).value);
case FLOAT4:
return ValueExpressions.getFloat4(((Float4Holder) holder).value);
case FLOAT8:
return ValueExpressions.getFloat8(((Float8Holder) holder).value);
case DATE:
return ValueExpressions.getDate(((DateHolder) holder).value);
case TIMESTAMP:
return ValueExpressions.getTimeStamp(((TimeStampHolder) holder).value);
case TIME:
return ValueExpressions.getTime(((TimeHolder) holder).value);
default:
return null;
}
}
开发者ID:axbaretto,项目名称:drill,代码行数:21,代码来源:ParquetFilterBuilder.java
示例3: computeHashJoinCostWithKeySize
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
/**
*
* @param planner : Optimization Planner.
* @param keySize : the # of join keys in join condition. Left key size should be equal to right key size.
* @return : RelOptCost
*/
private RelOptCost computeHashJoinCostWithKeySize(RelOptPlanner planner, int keySize) {
double probeRowCount = RelMetadataQuery.getRowCount(this.getLeft());
double buildRowCount = RelMetadataQuery.getRowCount(this.getRight());
// cpu cost of hashing the join keys for the build side
double cpuCostBuild = DrillCostBase.HASH_CPU_COST * keySize * buildRowCount;
// cpu cost of hashing the join keys for the probe side
double cpuCostProbe = DrillCostBase.HASH_CPU_COST * keySize * probeRowCount;
// cpu cost of evaluating each leftkey=rightkey join condition
double joinConditionCost = DrillCostBase.COMPARE_CPU_COST * keySize;
double factor = PrelUtil.getPlannerSettings(planner).getOptions()
.getOption(ExecConstants.HASH_JOIN_TABLE_FACTOR_KEY).float_val;
long fieldWidth = PrelUtil.getPlannerSettings(planner).getOptions()
.getOption(ExecConstants.AVERAGE_FIELD_WIDTH_KEY).num_val;
// table + hashValues + links
double memCost =
(
(fieldWidth * keySize) +
IntHolder.WIDTH +
IntHolder.WIDTH
) * buildRowCount * factor;
double cpuCost = joinConditionCost * (probeRowCount) // probe size determine the join condition comparison cost
+ cpuCostBuild + cpuCostProbe ;
DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory();
return costFactory.makeCost(buildRowCount + probeRowCount, cpuCost, 0, 0, memCost);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:39,代码来源:DrillJoinRelBase.java
示例4: computeHashAggCost
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
/**
* Estimate cost of hash agg. Called by DrillAggregateRel.computeSelfCost() and HashAggPrel.computeSelfCost()
*/
protected RelOptCost computeHashAggCost(RelOptPlanner planner) {
if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) {
return super.computeSelfCost(planner).multiplyBy(.1);
}
RelNode child = this.getInput();
double inputRows = RelMetadataQuery.getRowCount(child);
int numGroupByFields = this.getGroupCount();
int numAggrFields = this.aggCalls.size();
// cpu cost of hashing each grouping key
double cpuCost = DrillCostBase.HASH_CPU_COST * numGroupByFields * inputRows;
// add cpu cost for computing the aggregate functions
cpuCost += DrillCostBase.FUNC_CPU_COST * numAggrFields * inputRows;
double diskIOCost = 0; // assume in-memory for now until we enforce operator-level memory constraints
// TODO: use distinct row count
// + hash table template stuff
double factor = PrelUtil.getPlannerSettings(planner).getOptions()
.getOption(ExecConstants.HASH_AGG_TABLE_FACTOR_KEY).float_val;
long fieldWidth = PrelUtil.getPlannerSettings(planner).getOptions()
.getOption(ExecConstants.AVERAGE_FIELD_WIDTH_KEY).num_val;
// table + hashValues + links
double memCost =
(
(fieldWidth * numGroupByFields) +
IntHolder.WIDTH +
IntHolder.WIDTH
) * inputRows * factor;
DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory();
return costFactory.makeCost(inputRows, cpuCost, diskIOCost, 0 /* network cost */, memCost);
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:38,代码来源:DrillAggregateRelBase.java
示例5: computeHashJoinCostWithKeySize
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
/**
*
* @param planner : Optimization Planner.
* @param keySize : the # of join keys in join condition. Left key size should be equal to right key size.
* @return : RelOptCost
*/
private RelOptCost computeHashJoinCostWithKeySize(RelOptPlanner planner, int keySize, RelMetadataQuery mq) {
double probeRowCount = mq.getRowCount(this.getLeft());
double buildRowCount = mq.getRowCount(this.getRight());
// cpu cost of hashing the join keys for the build side
double cpuCostBuild = DrillCostBase.HASH_CPU_COST * keySize * buildRowCount;
// cpu cost of hashing the join keys for the probe side
double cpuCostProbe = DrillCostBase.HASH_CPU_COST * keySize * probeRowCount;
// cpu cost of evaluating each leftkey=rightkey join condition
double joinConditionCost = DrillCostBase.COMPARE_CPU_COST * keySize;
double factor = PrelUtil.getPlannerSettings(planner).getOptions()
.getOption(ExecConstants.HASH_JOIN_TABLE_FACTOR_KEY).float_val;
long fieldWidth = PrelUtil.getPlannerSettings(planner).getOptions()
.getOption(ExecConstants.AVERAGE_FIELD_WIDTH_KEY).num_val;
// table + hashValues + links
double memCost =
(
(fieldWidth * keySize) +
IntHolder.WIDTH +
IntHolder.WIDTH
) * buildRowCount * factor;
double cpuCost = joinConditionCost * (probeRowCount) // probe size determine the join condition comparison cost
+ cpuCostBuild + cpuCostProbe ;
DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory();
return costFactory.makeCost(buildRowCount + probeRowCount, cpuCost, 0, 0, memCost);
}
开发者ID:axbaretto,项目名称:drill,代码行数:39,代码来源:DrillJoinRelBase.java
示例6: computeHashAggCost
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
/**
* Estimate cost of hash agg. Called by DrillAggregateRel.computeSelfCost() and HashAggPrel.computeSelfCost()
*/
protected RelOptCost computeHashAggCost(RelOptPlanner planner, RelMetadataQuery mq) {
if(PrelUtil.getSettings(getCluster()).useDefaultCosting()) {
return super.computeSelfCost(planner, mq).multiplyBy(.1);
}
RelNode child = this.getInput();
double inputRows = mq.getRowCount(child);
int numGroupByFields = this.getGroupCount();
int numAggrFields = this.aggCalls.size();
// cpu cost of hashing each grouping key
double cpuCost = DrillCostBase.HASH_CPU_COST * numGroupByFields * inputRows;
// add cpu cost for computing the aggregate functions
cpuCost += DrillCostBase.FUNC_CPU_COST * numAggrFields * inputRows;
double diskIOCost = 0; // assume in-memory for now until we enforce operator-level memory constraints
// TODO: use distinct row count
// + hash table template stuff
double factor = PrelUtil.getPlannerSettings(planner).getOptions()
.getOption(ExecConstants.HASH_AGG_TABLE_FACTOR_KEY).float_val;
long fieldWidth = PrelUtil.getPlannerSettings(planner).getOptions()
.getOption(ExecConstants.AVERAGE_FIELD_WIDTH_KEY).num_val;
// table + hashValues + links
double memCost =
(
(fieldWidth * numGroupByFields) +
IntHolder.WIDTH +
IntHolder.WIDTH
) * inputRows * factor;
DrillCostFactory costFactory = (DrillCostFactory) planner.getCostFactory();
return costFactory.makeCost(inputRows, cpuCost, diskIOCost, 0 /* network cost */, memCost);
}
开发者ID:axbaretto,项目名称:drill,代码行数:38,代码来源:DrillAggregateRelBase.java
示例7: writeInt32
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
private void writeInt32(int readInt32, final MapOrListWriterImpl writer, String fieldName, boolean isList) {
final IntHolder ih = new IntHolder();
ih.value = readInt32;
if (isList == false) {
writer.integer(fieldName).write(ih);
} else {
writer.list.integer().write(ih);
}
}
开发者ID:axbaretto,项目名称:drill,代码行数:10,代码来源:BsonRecordReader.java
示例8: testCastInt
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
@Test
//cast to int
public void testCastInt(@Injectable final DrillbitContext bitContext,
@Injectable UserClientConnection connection) throws Throwable {
mockDrillbitContext(bitContext);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastInt.json"), Charsets.UTF_8));
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
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();
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
开发者ID:axbaretto,项目名称:drill,代码行数:37,代码来源:TestCastFunctions.java
示例9: testCastNested
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
@Test
//nested: cast is nested in another cast, or another function.
public void testCastNested(@Injectable final DrillbitContext bitContext,
@Injectable UserClientConnection connection) throws Throwable {
mockDrillbitContext(bitContext);
final PhysicalPlanReader reader = PhysicalPlanReaderTestFactory.defaultPhysicalPlanReader(CONFIG);
final PhysicalPlan plan = reader.readPhysicalPlan(Files.toString(DrillFileUtils.getResourceAsFile("/functions/cast/testCastNested.json"), Charsets.UTF_8));
final FunctionImplementationRegistry registry = new FunctionImplementationRegistry(CONFIG);
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();
if(context.getFailureCause() != null) {
throw context.getFailureCause();
}
assertTrue(!context.isFailed());
}
开发者ID:axbaretto,项目名称:drill,代码行数:39,代码来源:TestCastFunctions.java
示例10: getIntHolder
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
public static IntHolder getIntHolder(int value) {
IntHolder holder = new IntHolder();
holder.value = value;
return holder;
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:7,代码来源:ValueHolderHelper.java
示例11: testVVInitialCapacity
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
@Test
public void testVVInitialCapacity() throws Exception {
final MaterializedField[] fields = new MaterializedField[9];
final ValueVector[] valueVectors = new ValueVector[9];
fields[0] = MaterializedField.create(EMPTY_SCHEMA_PATH, BitHolder.TYPE);
fields[1] = MaterializedField.create(EMPTY_SCHEMA_PATH, IntHolder.TYPE);
fields[2] = MaterializedField.create(EMPTY_SCHEMA_PATH, VarCharHolder.TYPE);
fields[3] = MaterializedField.create(EMPTY_SCHEMA_PATH, NullableVar16CharHolder.TYPE);
fields[4] = MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedFloat4Holder.TYPE);
fields[5] = MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedVarBinaryHolder.TYPE);
fields[6] = MaterializedField.create(EMPTY_SCHEMA_PATH, MapVector.TYPE);
fields[6].addChild(fields[0] /*bit*/);
fields[6].addChild(fields[2] /*varchar*/);
fields[7] = MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedMapVector.TYPE);
fields[7].addChild(fields[1] /*int*/);
fields[7].addChild(fields[3] /*optional var16char*/);
fields[8] = MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedListVector.TYPE);
fields[8].addChild(fields[1] /*int*/);
final int initialCapacity = 1024;
try {
for (int i = 0; i < valueVectors.length; i++) {
valueVectors[i] = TypeHelper.getNewVector(fields[i], allocator);
valueVectors[i].setInitialCapacity(initialCapacity);
valueVectors[i].allocateNew();
}
for (int i = 0; i < valueVectors.length; i++) {
final ValueVector vv = valueVectors[i];
final int vvCapacity = vv.getValueCapacity();
assertEquals(String.format("Incorrect value capacity for %s [%d]", vv.getField(), vvCapacity),
initialCapacity, vvCapacity);
}
} finally {
AutoCloseables.close(valueVectors);
}
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:43,代码来源:TestValueVector.java
示例12: testCastInt
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的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());
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:46,代码来源:TestCastFunctions.java
示例13: testCastNested
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的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());
}
开发者ID:skhalifa,项目名称:QDrill,代码行数:47,代码来源:TestCastFunctions.java
示例14: evalCastFunc
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
private Statistics evalCastFunc(FunctionHolderExpression holderExpr, Statistics input) {
try {
DrillSimpleFuncHolder funcHolder = (DrillSimpleFuncHolder) holderExpr.getHolder();
DrillSimpleFunc interpreter = funcHolder.createInterpreter();
final ValueHolder minHolder, maxHolder;
TypeProtos.MinorType srcType = holderExpr.args.get(0).getMajorType().getMinorType();
TypeProtos.MinorType destType = holderExpr.getMajorType().getMinorType();
if (srcType.equals(destType)) {
// same type cast ==> NoOp.
return input;
} else if (!CAST_FUNC.containsKey(srcType) || !CAST_FUNC.get(srcType).contains(destType)) {
return null; // cast func between srcType and destType is NOT allowed.
}
switch (srcType) {
case INT :
minHolder = ValueHolderHelper.getIntHolder(((IntStatistics)input).getMin());
maxHolder = ValueHolderHelper.getIntHolder(((IntStatistics)input).getMax());
break;
case BIGINT:
minHolder = ValueHolderHelper.getBigIntHolder(((LongStatistics)input).getMin());
maxHolder = ValueHolderHelper.getBigIntHolder(((LongStatistics)input).getMax());
break;
case FLOAT4:
minHolder = ValueHolderHelper.getFloat4Holder(((FloatStatistics)input).getMin());
maxHolder = ValueHolderHelper.getFloat4Holder(((FloatStatistics)input).getMax());
break;
case FLOAT8:
minHolder = ValueHolderHelper.getFloat8Holder(((DoubleStatistics)input).getMin());
maxHolder = ValueHolderHelper.getFloat8Holder(((DoubleStatistics)input).getMax());
break;
default:
return null;
}
final ValueHolder[] args1 = {minHolder};
final ValueHolder[] args2 = {maxHolder};
final ValueHolder minFuncHolder = InterpreterEvaluator.evaluateFunction(interpreter, args1, holderExpr.getName());
final ValueHolder maxFuncHolder = InterpreterEvaluator.evaluateFunction(interpreter, args2, holderExpr.getName());
switch (destType) {
//TODO : need handle # of nulls.
case INT:
return getStatistics( ((IntHolder)minFuncHolder).value, ((IntHolder)maxFuncHolder).value);
case BIGINT:
return getStatistics( ((BigIntHolder)minFuncHolder).value, ((BigIntHolder)maxFuncHolder).value);
case FLOAT4:
return getStatistics( ((Float4Holder)minFuncHolder).value, ((Float4Holder)maxFuncHolder).value);
case FLOAT8:
return getStatistics( ((Float8Holder)minFuncHolder).value, ((Float8Holder)maxFuncHolder).value);
default:
return null;
}
} catch (Exception e) {
throw new DrillRuntimeException("Error in evaluating function of " + holderExpr.getName() );
}
}
开发者ID:axbaretto,项目名称:drill,代码行数:63,代码来源:RangeExprEvaluator.java
示例15: testVVInitialCapacity
import org.apache.drill.exec.expr.holders.IntHolder; //导入依赖的package包/类
@Test
public void testVVInitialCapacity() throws Exception {
final MaterializedField[] fields = new MaterializedField[9];
final ValueVector[] valueVectors = new ValueVector[9];
fields[0] = MaterializedField.create(EMPTY_SCHEMA_PATH, BitHolder.TYPE);
fields[1] = MaterializedField.create(EMPTY_SCHEMA_PATH, IntHolder.TYPE);
fields[2] = MaterializedField.create(EMPTY_SCHEMA_PATH, VarCharHolder.TYPE);
fields[3] = MaterializedField.create(EMPTY_SCHEMA_PATH, NullableVar16CharHolder.TYPE);
fields[4] = MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedFloat4Holder.TYPE);
fields[5] = MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedVarBinaryHolder.TYPE);
fields[6] = MaterializedField.create(EMPTY_SCHEMA_PATH, MapVector.TYPE);
fields[6].addChild(fields[0] /*bit*/);
fields[6].addChild(fields[2] /*varchar*/);
fields[7] = MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedMapVector.TYPE);
fields[7].addChild(fields[1] /*int*/);
fields[7].addChild(fields[3] /*optional var16char*/);
fields[8] = MaterializedField.create(EMPTY_SCHEMA_PATH, RepeatedListVector.TYPE);
fields[8].addChild(fields[1] /*int*/);
final int initialCapacity = 1024;
try {
for (int i = 0; i < valueVectors.length; i++) {
valueVectors[i] = TypeHelper.getNewVector(fields[i], allocator);
valueVectors[i].setInitialCapacity(initialCapacity);
valueVectors[i].allocateNew();
}
for (int i = 0; i < valueVectors.length; i++) {
@SuppressWarnings("resource")
final ValueVector vv = valueVectors[i];
final int vvCapacity = vv.getValueCapacity();
// this can't be equality because Nullables will be allocated using power of two sized buffers (thus need 1025
// spots in one vector > power of two is 2048, available capacity will be 2048 => 2047)
assertTrue(String.format("Incorrect value capacity for %s [%d]", vv.getField(), vvCapacity),
initialCapacity <= vvCapacity);
}
} finally {
AutoCloseables.close(valueVectors);
}
}
开发者ID:axbaretto,项目名称:drill,代码行数:47,代码来源:TestValueVector.java
注:本文中的org.apache.drill.exec.expr.holders.IntHolder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论