rowIdVectorMutator.setSafe(outputIndex, valueIndex + 1);
startIndices.getMutator().set(getBucketIndex(hashCode, numBuckets()), currentIdx);
this.rowIdVector.getMutator().setValueCount(outputRecords);
newStartIndices.getMutator().set(bucketIdx, entryIdx); // update the start index to point to entry newLinks.getMutator().set(entryIdxWithinBatch, EMPTY_SLOT); newHashValues.getMutator().set(entryIdxWithinBatch, hash); newLinks.getMutator().set(idxWithinBatch, entryIdx); newLinks.getMutator().set(entryIdxWithinBatch, EMPTY_SLOT); newHashValues.getMutator().set(entryIdxWithinBatch, hash); bh.links.getMutator().set(idxWithinBatch, entryIdx); // update the link in the other batch newLinks.getMutator().set(entryIdxWithinBatch, EMPTY_SLOT); // update the newLink entry in this newHashValues.getMutator().set(entryIdxWithinBatch, hash);
currHVVector.getMutator().set(ind, hashCode); // store the hash value in the new HV column
/** * For each incoming record, get the partition id it belongs to by invoking the * partitioning function. Set this id in the output partitionIdVector. For all other * incoming value vectors, just do a transfer. * @param recordCount * @param firstOutputIndex * @return the number of records projected */ private final int projectRecords(final int recordCount, int firstOutputIndex) { final int countN = recordCount; int counter = 0; for (int i = 0; i < countN; i++, firstOutputIndex++) { int partition = getPartition(i); partitionIdVector.getMutator().setSafe(i, partition); counter++; } for(TransferPair t : transfers){ t.transfer(); } return counter; }
public Pair<VectorContainer, Integer> nextBatch() { if (batchHolders == null || batchHolders.size() == 0) { return null; } if (htIter == null) { htIter = batchHolders.iterator(); } if (htIter.hasNext()) { BatchHolder bh = htIter.next(); // set the value count for the vectors in the batch // TODO: investigate why the value count is not already set in the // batch.. it seems even outputKeys() sets the value count explicitly if (bh != null) { bh.setValueCount(); return Pair.of(bh.htContainer, bh.maxOccupiedIdx); } } return null; }
private void insertEntry(int incomingRowIdx, int currentIdx, int hashValue, BatchHolder lastEntryBatch, int lastEntryIdxWithinBatch) throws SchemaChangeException { int currentIdxWithinBatch = currentIdx & BATCH_MASK; setValue(incomingRowIdx, currentIdxWithinBatch); // setValue may OOM when doubling of one of the VarChar Key Value Vectors // This would be caught and retried later (setValue() is idempotent) // the previous entry in this hash chain should now point to the entry in this currentIdx if (lastEntryBatch != null) { lastEntryBatch.updateLinks(lastEntryIdxWithinBatch, currentIdx); } // since this is the last entry in the hash chain, the links array at position currentIdx // will point to a null (empty) slot links.getMutator().set(currentIdxWithinBatch, EMPTY_SLOT); hashValues.getMutator().set(currentIdxWithinBatch, hashValue); maxOccupiedIdx = Math.max(maxOccupiedIdx, currentIdxWithinBatch); if (EXTRA_DEBUG) { logger.debug("BatchHolder: inserted key at incomingRowIdx = {}, currentIdx = {}, hash value = {}.", incomingRowIdx, currentIdx, hashValue); } }
public void setSkipNull(int index, IntHolder holder) { values.getMutator().set(index, holder); }
@Override public final int projectRecords(final int recordCount, int firstOutputIndex) { final int countN = recordCount; int counter = 0; for (int i = 0; i < countN; i++, firstOutputIndex++) { int partition = getPartition(i); partitionValues.getMutator().setSafe(i, partition); counter++; } for(TransferPair t : transfers){ t.transfer(); } return counter; }
@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); }
static void setIntegerColumnValue(final int data, final ValueVector vv, final int count) { ((IntVector.Mutator) vv.getMutator()) .setSafe(count, data); }
public void setSkipNull(int index, NullableIntHolder holder) { values.getMutator().set(index, holder); }
public void write(NullableIntHolder h) { mutator.setSafe(idx(), h); vector.getMutator().setValueCount(idx()+1); }
private void updateLinks(int lastEntryIdxWithinBatch, int currentIdx) { links.getMutator().set(lastEntryIdxWithinBatch, currentIdx); }
/** * 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 IntVector.Mutator valuesMutator = values.getMutator(); final UInt1Vector.Mutator bitsMutator = bits.getMutator(); bitsMutator.set(index, 1); valuesMutator.set(index, value); }
public void set(int index, NullableIntHolder holder) { final IntVector.Mutator valuesMutator = values.getMutator(); bits.getMutator().set(index, holder.isSet); valuesMutator.set(index, holder); }
public void setSafe(int index, NullableIntHolder holder) { while(index >= getValueCapacity()) { reAlloc(); } set(index, holder); }
protected void add(int index, IntHolder holder) { final int nextOffset = offsets.getAccessor().get(index+1); values.getMutator().set(nextOffset, holder); offsets.getMutator().set(index+1, nextOffset+1); }
/** * Add an element to the given record index. This is similar to the set() method in other * value vectors, except that it permits setting multiple values for a single record. * * @param index record of the element to add * @param value value to add to the given row */ public void add(int index, int value) { final int nextOffset = offsets.getAccessor().get(index+1); values.getMutator().set(nextOffset, value); offsets.getMutator().set(index+1, nextOffset+1); }