@Override public void copyValueSafe(int from, int to) { for (TransferPair p : pairs) { p.copyValueSafe(from, to); } }
public void copyFrom(int fromIndex, int thisIndex, FixedSizeListVector from) { TransferPair pair = from.makeTransferPair(this); pair.copyValueSafe(fromIndex, thisIndex); }
@Override public void copy(long compoundAddr, final int srcStart, int count) { copyWatch.start(); final long max = compoundAddr + count * OFFSET_SIZE; for(int from = srcStart; compoundAddr < max; compoundAddr +=OFFSET_SIZE, from++) { final int compoundIdx = PlatformDependent.getInt(compoundAddr); final int batchIdx = compoundIdx >>> 16; final int rowIdx = compoundIdx & 65535; transfers[batchIdx].copyValueSafe(from, rowIdx); } copyWatch.stop(); } }
@Override public void copy(long offsetAddr, int count) { dst.allocateNew(); final long max = offsetAddr + count * STEP_SIZE; int target = 0; for(long addr = offsetAddr; addr < max; addr += STEP_SIZE) { final int batchNOFF = PlatformDependent.getInt(addr); transfer[batchNOFF >>> BATCH_BITS].copyValueSafe(batchNOFF & MAX_BATCH, target); target++; } }
private void copyPartial(final int offset, final int length){ outgoing.allocateNew(); recordsToSkip -= offset; recordsLeft -= length; recordCount = length; for(final TransferPair p : transfers){ for(int i = 0; i < length; i++){ p.copyValueSafe(offset + i, i); } } outgoing.setAllCount(recordCount); state = State.CAN_PRODUCE; }
@Override public void copy(long offsetAddr, int count) { dst.allocateNew(); final long max = offsetAddr + count * STEP_SIZE; int target = 0; for(long addr = offsetAddr; addr < max; addr += STEP_SIZE) { int index = Short.toUnsignedInt(PlatformDependent.getShort(addr)); transfer.copyValueSafe(index, target); target++; } }
@Override public void copy(long offsetAddr, int count) { dst.allocateNew(); final long max = offsetAddr + count * BUILD_RECORD_LINK_SIZE; int target = 0; for(long addr = offsetAddr; addr < max; addr += BUILD_RECORD_LINK_SIZE) { final int batchIndex = PlatformDependent.getInt(addr); if(batchIndex != SKIP){ final int batchOffset = Short.toUnsignedInt(PlatformDependent.getShort(addr + 4)); transfer[batchIndex].copyValueSafe(batchOffset, target); target++; } } }
@Override public void copy(long offsetAddr, int count) { dst.allocateNew(); final long max = offsetAddr + count * BUILD_RECORD_LINK_SIZE; int target = 0; for(long addr = offsetAddr; addr < max; addr += BUILD_RECORD_LINK_SIZE) { final int batchIndex = PlatformDependent.getInt(addr); final int batchOffset = Short.toUnsignedInt(PlatformDependent.getShort(addr + 4)); transfer[batchIndex].copyValueSafe(batchOffset, target); target++; } }
@Override public void copyValueSafe(int fromIndex, int toIndex) { while (toIndex >= to.getValueCapacity()) { to.reAlloc(); } BitVectorHelper.setValidityBit(to.validityBuffer, toIndex, isSet(fromIndex)); int fromOffset = fromIndex * listSize; int toOffset = toIndex * listSize; for (int i = 0; i < listSize; i++) { dataPair.copyValueSafe(fromOffset + i, toOffset + i); } } }
/** * Decodes a dictionary encoded array using the provided dictionary. * * @param indices dictionary encoded values, must be int type * @param dictionary dictionary used to decode the values * @return vector with values restored from dictionary */ public static ValueVector decode(ValueVector indices, Dictionary dictionary) { int count = indices.getValueCount(); ValueVector dictionaryVector = dictionary.getVector(); int dictionaryCount = dictionaryVector.getValueCount(); // copy the dictionary values into the decoded vector TransferPair transfer = dictionaryVector.getTransferPair(indices.getAllocator()); transfer.getTo().allocateNewSafe(); for (int i = 0; i < count; i++) { Object index = indices.getObject(i); if (index != null) { int indexAsInt = ((Number) index).intValue(); if (indexAsInt > dictionaryCount) { throw new IllegalArgumentException("Provided dictionary does not contain value for index " + indexAsInt); } transfer.copyValueSafe(indexAsInt, i); } } // TODO do we need to worry about the field? ValueVector decoded = transfer.getTo(); decoded.setValueCount(count); return decoded; }