} else { ((VarBinaryVector.Mutator) pci.vv.getMutator()) .setSafe(rowIndex, value, 0, value.remaining());
private void setOutputRowCount(int count) { for (ValueVector vv : familyVectorMap.values()) { vv.getMutator().setValueCount(count); } if (rowKeyVector != null) { rowKeyVector.getMutator().setValueCount(count); } }
@Override public void generateTestData(int size){ boolean even = true; final java.nio.charset.Charset charset = Charsets.UTF_8; final byte[] evenValue = new String("aaaaa").getBytes(charset); final byte[] oddValue = new String("bbbbbbbbbb").getBytes(charset); for(int i =0; i < size; i++, even = !even){ set(i, even ? evenValue : oddValue); } setValueCount(size); } }
rowKeyVector.getMutator().setSafe( rowCount, cells[0].getRowArray(),
@Override protected void readField(long recordsToReadInThisPass) { recordsReadInThisIteration = Math.min(pageReader.currentPageCount - pageReader.valuesRead, recordsToReadInThisPass - valuesReadInCurrentPass); readLengthInBits = recordsReadInThisIteration * dataTypeLengthInBits; readLength = (int) Math.ceil(readLengthInBits / BITS_COUNT_IN_BYTE_DOUBLE_VALUE); if (usingDictionary) { VarBinaryVector.Mutator mutator = valueVec.getMutator(); Binary currDictValToWrite = null; for (int i = 0; i < recordsReadInThisIteration; i++){ currDictValToWrite = pageReader.dictionaryValueReader.readBytes(); mutator.setSafe(valuesReadInCurrentPass + i, currDictValToWrite.toByteBuffer().slice(), 0, currDictValToWrite.length()); } // Set the write Index. The next page that gets read might be a page that does not use dictionary encoding // and we will go into the else condition below. The readField method of the parent class requires the // writer index to be set correctly. int writerIndex = valueVec.getBuffer().writerIndex(); valueVec.getBuffer().setIndex(0, writerIndex + (int)readLength); } else { super.readField(recordsToReadInThisPass); } // TODO - replace this with fixed binary type in drill // now we need to write the lengths of each value int byteLength = dataTypeLengthInBits / 8; for (int i = 0; i < recordsToReadInThisPass; i++) { valueVec.getMutator().setValueLengthSafe(valuesReadInCurrentPass + i, byteLength); } } }
public void setSkipNull(int index, NullableVarBinaryHolder holder) { values.getMutator().set(index, holder); }
public void splitAndTransferTo(int startIndex, int length, VarBinaryVector target) { UInt4Vector.Accessor offsetVectorAccessor = this.offsetVector.getAccessor(); final int startPoint = offsetVectorAccessor.get(startIndex); final int sliceLength = offsetVectorAccessor.get(startIndex + length) - startPoint; target.clear(); target.offsetVector.allocateNew(length + 1); offsetVectorAccessor = this.offsetVector.getAccessor(); final UInt4Vector.Mutator targetOffsetVectorMutator = target.offsetVector.getMutator(); for (int i = 0; i < length + 1; i++) { targetOffsetVectorMutator.set(i, offsetVectorAccessor.get(startIndex + i) - startPoint); } target.data = data.slice(startPoint, sliceLength).transferOwnership(target.allocator).buffer; target.getMutator().setValueCount(length); }
/** * Set the variable length element at the specified index to the supplied value. * * @param index position of the bit to set * @param value value to write */ public void set(int index, byte[] value) { setCount++; final VarBinaryVector.Mutator valuesMutator = values.getMutator(); final UInt1Vector.Mutator bitsMutator = bits.getMutator(); valuesMutator.fillEmpties(lastSet, index); bitsMutator.set(index, 1); valuesMutator.set(index, value); lastSet = index; }
public void write(NullableVarBinaryHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void setSkipNull(int index, VarBinaryHolder holder) { values.getMutator().set(index, holder); }
public void setSafe(int index, VarBinaryHolder value) { if (index > lastSet + 1) { fillEmpties(index); } bits.getMutator().setSafe(index, 1); values.getMutator().setSafe(index, value); setCount++; lastSet = index; }
public void setSafe(int index, int isSet, int startField, int endField, DrillBuf bufferField ) { if (index > lastSet + 1) { fillEmpties(index); } bits.getMutator().setSafe(index, isSet); values.getMutator().setSafe(index, startField, endField, bufferField); setCount++; lastSet = index; }
public void setSafe(int index, byte[] value, int start, int length) { if (index > lastSet + 1) { fillEmpties(index); } bits.getMutator().setSafe(index, 1); values.getMutator().setSafe(index, value, start, length); setCount++; lastSet = index; }
public void addSafe(int index, NullableVarBinaryHolder holder) { final int nextOffset = offsets.getAccessor().get(index+1); values.getMutator().setSafe(nextOffset, holder); offsets.getMutator().setSafe(index+1, nextOffset+1); }
/** * Copies the bulk input into this value vector and extends its capacity if necessary. * @param input bulk input */ public <T extends VarLenBulkEntry> void setSafe(VarLenBulkInput<T> input) { setSafe(input, null); }
private void setOutputRowCount(int count) { for (ValueVector vv : familyVectorMap.values()) { vv.getMutator().setValueCount(count); } if (rowKeyVector != null) { rowKeyVector.getMutator().setValueCount(count); } }
private void fillEmpties(int index) { final VarBinaryVector.Mutator valuesMutator = values.getMutator(); valuesMutator.fillEmpties(lastSet, index+1); while(index > bits.getValueCapacity()) { bits.reAlloc(); } lastSet = index; }
@Override public void generateTestData(int valueCount){ bits.getMutator().generateTestDataAlt(valueCount); values.getMutator().generateTestData(valueCount); lastSet = valueCount; setValueCount(valueCount); }
public VarBinaryVector(MaterializedField field, BufferAllocator allocator) { super(field, allocator); this.accessor = new Accessor(); this.mutator = new Mutator(); }
public void set(int index, int isSet, int startField, int endField, DrillBuf bufferField ) { final VarBinaryVector.Mutator valuesMutator = values.getMutator(); valuesMutator.fillEmpties(lastSet, index); bits.getMutator().set(index, isSet); valuesMutator.set(index, startField, endField, bufferField); lastSet = index; }