public void updateTargets(int index, FieldVector target) { switch (srcBufferIdx) { case 0: dstAddrs[index] = target.getValidityBufferAddress(); break; case 1: if (target instanceof VariableWidthVector) { dstAddrs[index] = target.getOffsetBufferAddress(); } else { dstAddrs[index] = target.getDataBufferAddress(); } break; case 2: dstAddrs[index] = target.getDataBufferAddress(); break; default: throw new UnsupportedOperationException("unexpected buffer offset"); } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final float newVal = Float.intBitsToFloat(PlatformDependent.getInt(incomingValue + (incomingIndex * WIDTH)) * bitVal); final int tableIndex = PlatformDependent.getInt(ordinalAddr); final long sumAddr = valueAddresses[tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK] + (tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK) * 8; PlatformDependent.putLong(sumAddr, Double.doubleToLongBits(Double.longBitsToDouble(PlatformDependent.getLong(sumAddr)) + newVal)); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final double newVal = Double.longBitsToDouble(PlatformDependent.getLong(incomingValue + (incomingIndex * WIDTH)) * bitVal); final int tableIndex = PlatformDependent.getInt(ordinalAddr); final long sumAddr = valueAddresses[tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK] + (tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK) * 8; PlatformDependent.putLong(sumAddr, Double.doubleToLongBits(Double.longBitsToDouble(PlatformDependent.getLong(sumAddr)) + newVal)); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * WIDTH_ORDINAL; FieldVector inputVector = getInput(); final long incomingBit = inputVector.getValidityBufferAddress(); final long incomingValue = inputVector.getDataBufferAddress(); final long[] valueAddresses = this.valueAddresses; final int scale = ((DecimalVector)inputVector).getScale(); int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += WIDTH_ORDINAL, incomingIndex++) { final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; java.math.BigDecimal newVal = DecimalAccumulatorUtilsNoSpill.getBigDecimal(incomingValue + (incomingIndex * WIDTH_INPUT), valBuf, scale); final int tableIndex = PlatformDependent.getInt(ordinalAddr); final long sumAddr = valueAddresses[tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK] + (tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK) * WIDTH_ACCUMULATOR; PlatformDependent.putLong(sumAddr, Double.doubleToLongBits(Double.longBitsToDouble(PlatformDependent.getLong(sumAddr)) + newVal.doubleValue() * bitVal)); } } }
public void accumulate(final long offsetAddr, final int count){ final long maxAddr = offsetAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = offsetAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final int tableIndex = PlatformDependent.getInt(ordinalAddr); final long countAddr = valueAddresses[tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK] + (tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK) * 8; PlatformDependent.putLong(countAddr, PlatformDependent.getLong(countAddr) + bitVal); } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final double newVal = Double.longBitsToDouble(PlatformDependent.getLong(incomingValue + (incomingIndex * WIDTH))); final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long minAddr = valueAddresses[chunkIndex] + (chunkOffset) * 8; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putLong(minAddr, Double.doubleToLongBits(min(Double.longBitsToDouble(PlatformDependent.getLong(minAddr)), newVal, bitVal))); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxMemAddr = memoryAddr + count * 4; final long incomaxgBit = getInput().getValidityBufferAddress(); final long incomaxgValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomaxgIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxMemAddr; ordinalAddr += 4, incomaxgIndex++){ final float newVal = Float.intBitsToFloat(PlatformDependent.getInt(incomaxgValue + (incomaxgIndex * WIDTH))); final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long maxAddr = valueAddresses[chunkIndex] + (chunkOffset) * 4; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitVal = (PlatformDependent.getByte(incomaxgBit + ((incomaxgIndex >>> 3))) >>> (incomaxgIndex & 7)) & 1; final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putInt(maxAddr, Float.floatToRawIntBits(max(Float.intBitsToFloat(PlatformDependent.getInt(maxAddr)), newVal, bitVal))); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final float newVal = Float.intBitsToFloat(PlatformDependent.getInt(incomingValue + (incomingIndex * WIDTH))); final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long minAddr = valueAddresses[chunkIndex] + (chunkOffset) * 4; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putInt(minAddr, Float.floatToIntBits(min(Float.intBitsToFloat(PlatformDependent.getInt(minAddr)), newVal, bitVal))); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final float newVal = Float.intBitsToFloat(PlatformDependent.getInt(incomingValue + (incomingIndex * WIDTH)) * bitVal); final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long sumAddr = valueAddresses[chunkIndex] + (chunkOffset) * 8; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putLong(sumAddr, Double.doubleToLongBits(Double.longBitsToDouble(PlatformDependent.getLong(sumAddr)) + newVal)); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxMemAddr = memoryAddr + count * 4; final long incomaxgBit = getInput().getValidityBufferAddress(); final long incomaxgValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomaxgIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxMemAddr; ordinalAddr += 4, incomaxgIndex++){ final double newVal = Double.longBitsToDouble(PlatformDependent.getLong(incomaxgValue + (incomaxgIndex * WIDTH))); final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long maxAddr = valueAddresses[chunkIndex] + (chunkOffset) * 8; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitVal = (PlatformDependent.getByte(incomaxgBit + ((incomaxgIndex >>> 3))) >>> (incomaxgIndex & 7)) & 1; final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putLong(maxAddr, Double.doubleToRawLongBits(max(Double.longBitsToDouble(PlatformDependent.getLong(maxAddr)), newVal, bitVal))); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
private void addBatchHelper(final ArrowBuf buffer) { resizeAttempted = true; /* the memory for accumulator vector comes from the operator's allocator that manages * memory for all data structures required for hash agg processing. * in other words, we should not use output.getAllocator() here as that allocator is * _only_ for for managing memory of output batch. */ FieldVector vector = (FieldVector) output.getTransferPair(computationVectorAllocator).getTo(); /* store the new vector and increment batches before allocating memory */ accumulators[batches] = vector; final int oldBatches = batches; batches++; /* if this step or memory allocation inside any child of NestedAccumulator fails, * we have captured enough info to rollback the operation. */ allocateAccumulatorForNewBatch(vector, buffer); /* need to clear the data since allocate new doesn't do so and we want to start with clean memory */ initialize(vector); bitAddresses[oldBatches] = vector.getValidityBufferAddress(); valueAddresses[oldBatches] = vector.getDataBufferAddress(); checkNotNull(); }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final int newVal = PlatformDependent.getInt(incomingValue + (incomingIndex * WIDTH)) * bitVal; final int tableIndex = PlatformDependent.getInt(ordinalAddr); final long sumAddr = valueAddresses[tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK] + (tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK) * 8; PlatformDependent.putLong(sumAddr, PlatformDependent.getLong(sumAddr) + newVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final long newVal = PlatformDependent.getLong(incomingValue + (incomingIndex * WIDTH)) * bitVal; final int tableIndex = PlatformDependent.getInt(ordinalAddr); final long sumAddr = valueAddresses[tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK] + (tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK) * 8; PlatformDependent.putLong(sumAddr, PlatformDependent.getLong(sumAddr) + newVal); } } }
public void accumulate(final long memoryAddr, final int count){ final long maxAddr = memoryAddr + count * PARTITIONINDEX_HTORDINAL_WIDTH; final long incomingBit = getInput().getValidityBufferAddress(); final long[] valueAddresses = this.valueAddresses; final int maxValuesPerBatch = super.maxValuesPerBatch; for (long partitionAndOrdinalAddr = memoryAddr; partitionAndOrdinalAddr < maxAddr; partitionAndOrdinalAddr += PARTITIONINDEX_HTORDINAL_WIDTH) { /* get the hash table ordinal */ final int tableIndex = PlatformDependent.getInt(partitionAndOrdinalAddr + HTORDINAL_OFFSET); /* get the index of data in input vector */ final int incomingIndex = PlatformDependent.getInt(partitionAndOrdinalAddr + KEYINDEX_OFFSET); /* get the corresponding data from input vector -- source data for accumulation */ final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; /* get the target addresses of accumulation vector */ final int chunkIndex = getChunkIndexForOrdinal(tableIndex, maxValuesPerBatch); final int chunkOffset = getOffsetInChunkForOrdinal(tableIndex, maxValuesPerBatch); final long countAddr = valueAddresses[chunkIndex] + chunkOffset * 8; /* store the accumulated values(count) at the target location of accumulation vector */ PlatformDependent.putLong(countAddr, PlatformDependent.getLong(countAddr) + bitVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxMemAddr = memoryAddr + count * 4; final long incomaxgBit = getInput().getValidityBufferAddress(); final long incomaxgValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomaxgIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxMemAddr; ordinalAddr += 4, incomaxgIndex++){ final long newVal = PlatformDependent.getLong(incomaxgValue + (incomaxgIndex * WIDTH)); final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long maxAddr = valueAddresses[chunkIndex] + (chunkOffset) * 8; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitVal = (PlatformDependent.getByte(incomaxgBit + ((incomaxgIndex >>> 3))) >>> (incomaxgIndex & 7)) & 1; final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putLong(maxAddr, max(PlatformDependent.getLong(maxAddr), newVal, bitVal)); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final int newVal = PlatformDependent.getInt(incomingValue + (incomingIndex * WIDTH)) * bitVal; final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long sumAddr = valueAddresses[chunkIndex] + (chunkOffset) * 8; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putLong(sumAddr, PlatformDependent.getLong(sumAddr) + newVal); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final long newVal = PlatformDependent.getLong(incomingValue + (incomingIndex * WIDTH)); final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long minAddr = valueAddresses[chunkIndex] + (chunkOffset) * 8; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putLong(minAddr, min(PlatformDependent.getLong(minAddr), newVal, bitVal)); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxMemAddr = memoryAddr + count * 4; final long incomaxgBit = getInput().getValidityBufferAddress(); final long incomaxgValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomaxgIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxMemAddr; ordinalAddr += 4, incomaxgIndex++){ final int newVal = PlatformDependent.getInt(incomaxgValue + (incomaxgIndex * WIDTH)); final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long maxAddr = valueAddresses[chunkIndex] + (chunkOffset) * 4; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitVal = (PlatformDependent.getByte(incomaxgBit + ((incomaxgIndex >>> 3))) >>> (incomaxgIndex & 7)) & 1; final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putInt(maxAddr, max(PlatformDependent.getInt(maxAddr), newVal, bitVal)); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final int newVal = PlatformDependent.getInt(incomingValue + (incomingIndex * WIDTH)); final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long minAddr = valueAddresses[chunkIndex] + (chunkOffset) * 4; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putInt(minAddr, min(PlatformDependent.getInt(minAddr), newVal, bitVal)); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }
public void accumulate(final long memoryAddr, final int count) { final long maxAddr = memoryAddr + count * 4; final long incomingBit = getInput().getValidityBufferAddress(); final long incomingValue = getInput().getDataBufferAddress(); final long[] bitAddresses = this.bitAddresses; final long[] valueAddresses = this.valueAddresses; int incomingIndex = 0; for(long ordinalAddr = memoryAddr; ordinalAddr < maxAddr; ordinalAddr += 4, incomingIndex++){ final int bitVal = (PlatformDependent.getByte(incomingBit + ((incomingIndex >>> 3))) >>> (incomingIndex & 7)) & 1; final long newVal = PlatformDependent.getLong(incomingValue + (incomingIndex * WIDTH)) * bitVal; final int tableIndex = PlatformDependent.getInt(ordinalAddr); int chunkIndex = tableIndex >>> LBlockHashTableNoSpill.BITS_IN_CHUNK; int chunkOffset = tableIndex & LBlockHashTableNoSpill.CHUNK_OFFSET_MASK; final long sumAddr = valueAddresses[chunkIndex] + (chunkOffset) * 8; final long bitUpdateAddr = bitAddresses[chunkIndex] + ((chunkOffset >>> 5) * 4); final int bitUpdateVal = bitVal << (chunkOffset & 31); PlatformDependent.putLong(sumAddr, PlatformDependent.getLong(sumAddr) + newVal); PlatformDependent.putInt(bitUpdateAddr, PlatformDependent.getInt(bitUpdateAddr) | bitUpdateVal); } } }