@Override protected void readField(long recordsToReadInThisPass) { recordsReadInThisIteration = Math.min(pageReader.currentPageCount - pageReader.valuesRead, recordsToReadInThisPass - valuesReadInCurrentPass); // A more optimized reader for bit columns was removed to fix the bug // DRILL-2031. It attempted to copy large runs of values directly from the // decompressed parquet stream into a BitVector. This was complicated by // parquet not always breaking a page on a row number divisible by 8. In // this case the batch would have to be cut off early or we would have to // copy the next page byte-by-byte with a bit shift to move the values into // the correct position (to make the value vector one contiguous buffer of // data). As page boundaries do not line up across columns, cutting off a // batch at every page boundary of a bit column could be costly with many // such pages, so we opted to try to shift the bits when necessary. // // In the end, this was too much complexity for not enough performance // benefit, for now this reader has been moved to use the higher level value // by value reader provided by the parquet library. for (int i = 0; i < recordsReadInThisIteration; i++){ valueVec.getMutator().setSafe(i + valuesReadInCurrentPass, pageReader.valueReader.readBoolean() ? 1 : 0 ); } } }
target.getMutator().setValueCount(length);
public void copyFrom(int inIndex, int outIndex, BitVector from) { this.mutator.set(outIndex, from.accessor.get(inIndex)); }
public final void set(int index, BitHolder holder) { set(index, holder.value); }
public void setSkipNull(int index, BitHolder holder) { values.getMutator().set(index, holder); }
final void set(int index, NullableBitHolder holder) { set(index, holder.value); }
@Override public void generateTestData(final int valCount) { final int[] sizes = {1, 2, 0, 6}; int size = 0; int runningOffset = 0; final UInt4Vector.Mutator offsetsMutator = offsets.getMutator(); for(int i = 1; i < valCount + 1; i++, size++) { runningOffset += sizes[size % sizes.length]; offsetsMutator.set(i, runningOffset); } values.getMutator().generateTestData(valCount * 9); setValueCount(size); }
public void setSkipNull(int index, NullableBitHolder holder) { values.getMutator().set(index, holder); }
public void writeBit(int value) { mutator.setSafe(idx(), value); vector.getMutator().setValueCount(idx() + 1); }
/** * 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, int value) { setCount++; final BitVector.Mutator valuesMutator = values.getMutator(); final UInt1Vector.Mutator bitsMutator = bits.getMutator(); bitsMutator.set(index, 1); valuesMutator.set(index, value); }
@Override public Mutator getMutator() { return new Mutator(); }
@Override public void writeField(Object value, int outboundIndex) { vector.getMutator().setSafe(outboundIndex, (boolean) value ? 1 : 0); }
public void write(NullableBitHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void write(BitHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
public void addSafe(int index, NullableBitHolder holder) { final int nextOffset = offsets.getAccessor().get(index+1); values.getMutator().setSafe(nextOffset, holder); offsets.getMutator().setSafe(index+1, nextOffset+1); }
public void setSafe(int index, int value) { while(index >= getValueCapacity()) { reAlloc(); } set(index, value); }
public void set(int index, NullableBitHolder holder) { final BitVector.Mutator valuesMutator = values.getMutator(); bits.getMutator().set(index, holder.isSet); valuesMutator.set(index, holder); }
@Override public void generateTestData(int valueCount){ bits.getMutator().generateTestDataAlt(valueCount); values.getMutator().generateTestData(valueCount); setValueCount(valueCount); }
public void setSafe(int index, BitHolder holder) { while(index >= getValueCapacity()) { reAlloc(); } set(index, holder.value); }
public void set(int index, int isSet, int valueField ) { final BitVector.Mutator valuesMutator = values.getMutator(); bits.getMutator().set(index, isSet); valuesMutator.set(index, valueField); }