本文整理汇总了Java中org.apache.drill.exec.vector.AllocationHelper类的典型用法代码示例。如果您正苦于以下问题:Java AllocationHelper类的具体用法?Java AllocationHelper怎么用?Java AllocationHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AllocationHelper类属于org.apache.drill.exec.vector包,在下文中一共展示了AllocationHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doAlloc
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
private boolean doAlloc() {
//Allocate vv in the allocationVectors.
for (final ValueVector v : this.allocationVectors) {
AllocationHelper.allocateNew(v, incoming.getRecordCount());
}
//Allocate vv for complexWriters.
if (complexWriters == null) {
return true;
}
for (final ComplexWriter writer : complexWriters) {
writer.allocate();
}
return true;
}
示例2: buildSchema
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
@Override
public void buildSchema() throws SchemaChangeException {
IterOutcome outcome = next(incoming);
switch (outcome) {
case NONE:
state = BatchState.DONE;
container.buildSchema(SelectionVectorMode.NONE);
return;
case OUT_OF_MEMORY:
state = BatchState.OUT_OF_MEMORY;
return;
case STOP:
state = BatchState.STOP;
return;
}
if (!createAggregator()) {
state = BatchState.DONE;
}
for (VectorWrapper w : container) {
AllocationHelper.allocatePrecomputedChildCount(w.getValueVector(), 0, 0, 0);
}
}
示例3: allocateOutgoing
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
private void allocateOutgoing(int records) {
// Skip the keys and only allocate for outputting the workspace values
// (keys will be output through splitAndTransfer)
Iterator<VectorWrapper<?>> outgoingIter = outContainer.iterator();
for (int i = 0; i < numGroupByOutFields; i++) {
outgoingIter.next();
}
while (outgoingIter.hasNext()) {
ValueVector vv = outgoingIter.next().getValueVector();
MajorType type = vv.getField().getType();
/*
* In build schema we use the allocation model that specifies exact record count
* so we need to stick with that allocation model until DRILL-2211 is resolved. Using
* 50 as the average bytes per value as is used in HashTable.
*/
AllocationHelper.allocatePrecomputedChildCount(vv, records, VARIABLE_WIDTH_VALUE_SIZE, 0);
}
}
示例4: copyRecords
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
@Override
public int copyRecords(int index, int recordCount){
for(VectorWrapper<?> out : outgoing){
MajorType type = out.getField().getType();
if (!Types.isFixedWidthType(type) || Types.isRepeated(type)) {
out.getValueVector().allocateNew();
} else {
AllocationHelper.allocate(out.getValueVector(), recordCount, 1);
}
}
int outgoingPosition = 0;
for(int svIndex = index; svIndex < index + recordCount; svIndex++, outgoingPosition++){
int deRefIndex = sv4.get(svIndex);
doEval(deRefIndex, outgoingPosition);
}
return outgoingPosition;
}
示例5: copyRecords
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
@Override
public int copyRecords(int index, int recordCount){
for(VectorWrapper<?> out : outgoing){
MajorType type = out.getField().getType();
if (!Types.isFixedWidthType(type) || Types.isRepeated(type)) {
out.getValueVector().allocateNew();
} else {
AllocationHelper.allocate(out.getValueVector(), recordCount, 1);
}
}
int outgoingPosition = 0;
for(int svIndex = index; svIndex < index + recordCount; svIndex++, outgoingPosition++){
doEval(sv2.getIndex(svIndex), outgoingPosition);
}
return outgoingPosition;
}
示例6: addOutputContainerData
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
private void addOutputContainerData() {
final VarCharVector fragmentIdVector = (VarCharVector) container.getValueAccessorById(
VarCharVector.class,
container.getValueVectorId(SchemaPath.getSimplePath("Fragment")).getFieldIds())
.getValueVector();
AllocationHelper.allocate(fragmentIdVector, 1, 50);
final BigIntVector summaryVector = (BigIntVector) container.getValueAccessorById(BigIntVector.class,
container.getValueVectorId(SchemaPath.getSimplePath("Number of records written")).getFieldIds())
.getValueVector();
AllocationHelper.allocate(summaryVector, 1, 8);
fragmentIdVector.getMutator().setSafe(0, fragmentUniqueId.getBytes());
fragmentIdVector.getMutator().setValueCount(1);
summaryVector.getMutator().setSafe(0, counter);
summaryVector.getMutator().setValueCount(1);
container.setRecordCount(1);
}
示例7: populatePartitionVectors
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
private void populatePartitionVectors() {
for (int index = 0; index < selectedPartitionColumns.size(); index++) {
final int i = selectedPartitionColumns.get(index);
final NullableVarCharVector v = (NullableVarCharVector) partitionVectors.get(index);
if (partitionValues.length > i) {
final String val = partitionValues[i];
AllocationHelper.allocate(v, recordCount, val.length());
final byte[] bytes = val.getBytes();
for (int j = 0; j < recordCount; j++) {
v.getMutator().setSafe(j, bytes, 0, bytes.length);
}
v.getMutator().setValueCount(recordCount);
} else {
AllocationHelper.allocate(v, recordCount, 0);
v.getMutator().setValueCount(recordCount);
}
}
}
示例8: doAlloc
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
private boolean doAlloc(int recordCount) {
//Allocate vv in the allocationVectors.
for (final ValueVector v : this.allocationVectors) {
AllocationHelper.allocateNew(v, recordCount);
}
//Allocate vv for complexWriters.
if (complexWriters == null) {
return true;
}
for (final ComplexWriter writer : complexWriters) {
writer.allocate();
}
return true;
}
示例9: buildSchema
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
@Override
public void buildSchema() throws SchemaChangeException {
IterOutcome outcome = next(incoming);
switch (outcome) {
case NONE:
state = BatchState.DONE;
container.buildSchema(SelectionVectorMode.NONE);
return;
case OUT_OF_MEMORY:
state = BatchState.OUT_OF_MEMORY;
return;
case STOP:
state = BatchState.STOP;
return;
}
this.incomingSchema = incoming.getSchema();
if (!createAggregator()) {
state = BatchState.DONE;
}
for (VectorWrapper<?> w : container) {
AllocationHelper.allocatePrecomputedChildCount(w.getValueVector(), 0, 0, 0);
}
}
示例10: copyRecords
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
@Override
public int copyRecords(int index, int recordCount) throws SchemaChangeException {
for(VectorWrapper<?> out : outgoing){
MajorType type = out.getField().getType();
if (!Types.isFixedWidthType(type) || Types.isRepeated(type)) {
out.getValueVector().allocateNew();
} else {
AllocationHelper.allocate(out.getValueVector(), recordCount, 1);
}
}
int outgoingPosition = 0;
for(int svIndex = index; svIndex < index + recordCount; svIndex++, outgoingPosition++){
int deRefIndex = sv4.get(svIndex);
doEval(deRefIndex, outgoingPosition);
}
return outgoingPosition;
}
示例11: copyRecords
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
@Override
public int copyRecords(int index, int recordCount) throws SchemaChangeException {
for(VectorWrapper<?> out : outgoing){
MajorType type = out.getField().getType();
if (!Types.isFixedWidthType(type) || Types.isRepeated(type)) {
out.getValueVector().allocateNew();
} else {
AllocationHelper.allocate(out.getValueVector(), recordCount, 1);
}
}
int outgoingPosition = 0;
for(int svIndex = index; svIndex < index + recordCount; svIndex++, outgoingPosition++){
doEval(sv2.getIndex(svIndex), outgoingPosition);
}
return outgoingPosition;
}
示例12: addOutputContainerData
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
private void addOutputContainerData() {
@SuppressWarnings("resource")
final VarCharVector fragmentIdVector = (VarCharVector) container.getValueAccessorById(
VarCharVector.class,
container.getValueVectorId(SchemaPath.getSimplePath("Fragment")).getFieldIds())
.getValueVector();
AllocationHelper.allocate(fragmentIdVector, 1, 50);
@SuppressWarnings("resource")
final BigIntVector summaryVector = (BigIntVector) container.getValueAccessorById(BigIntVector.class,
container.getValueVectorId(SchemaPath.getSimplePath("Number of records written")).getFieldIds())
.getValueVector();
AllocationHelper.allocate(summaryVector, 1, 8);
fragmentIdVector.getMutator().setSafe(0, fragmentUniqueId.getBytes());
fragmentIdVector.getMutator().setValueCount(1);
summaryVector.getMutator().setSafe(0, counter);
summaryVector.getMutator().setValueCount(1);
container.setRecordCount(1);
}
示例13: populateImplicitVectors
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
private void populateImplicitVectors(Map<String, String> implicitValues, int recordCount) {
if (implicitValues != null) {
for (Map.Entry<String, String> entry : implicitValues.entrySet()) {
@SuppressWarnings("resource")
final NullableVarCharVector v = (NullableVarCharVector) implicitFieldVectorMap.get(entry.getKey());
String val;
if ((val = entry.getValue()) != null) {
AllocationHelper.allocate(v, recordCount, val.length());
final byte[] bytes = val.getBytes();
for (int j = 0; j < recordCount; j++) {
v.getMutator().setSafe(j, bytes, 0, bytes.length);
}
v.getMutator().setValueCount(recordCount);
} else {
AllocationHelper.allocate(v, recordCount, 0);
v.getMutator().setValueCount(recordCount);
}
}
}
}
示例14: allocateNew
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
@Override
public void allocateNew(int groupCount, int innerValueCount) {
clear();
try {
offsets.allocateNew(groupCount + 1);
for (ValueVector v : getChildren()) {
AllocationHelper.allocatePrecomputedChildCount(v, groupCount, 50, innerValueCount);
}
} catch (OutOfMemoryRuntimeException e){
clear();
throw e;
}
offsets.zeroVector();
mutator.reset();
}
示例15: doAlloc
import org.apache.drill.exec.vector.AllocationHelper; //导入依赖的package包/类
private boolean doAlloc() {
for (ValueVector v : allocationVectors) {
try {
AllocationHelper.allocateNew(v, current.getRecordCount());
} catch (OutOfMemoryRuntimeException ex) {
return false;
}
}
return true;
}