Refine search
requireNonNull(hashTables, "hashTables is null"); if (hashTables.length < keyBlock.getPositionCount() * HASH_MULTIPLIER) { throw new IllegalArgumentException(format("keyBlock/valueBlock size does not match hash table size: %s %s", keyBlock.getPositionCount(), hashTables.length)); this.retainedSizeInBytes = INSTANCE_SIZE + keyBlock.getRetainedSizeInBytes() + valueBlock.getRetainedSizeInBytes() + sizeOf(offsets) + sizeOf(mapIsNull) + sizeOf(hashTables);
public int getEstimatedSizeInBytes() { int result = INSTANCE_SIZE; result += sizeOfObjectArray(addresses.size()); for (HostAddress address : addresses) { result += HOST_ADDRESS_INSTANCE_SIZE + address.getHostText().length() * Character.BYTES; } return result; } }
@Override public long getSizeInBytes() { return keyBlock.getRegionSizeInBytes(offset / 2, positionCount / 2) + valueBlock.getRegionSizeInBytes(offset / 2, positionCount / 2) + sizeOfIntArray(positionCount / 2 * HASH_MULTIPLIER); }
PositionLinks.FactoryBuilder positionLinks) this.addresses = requireNonNull(addresses, "addresses is null"); this.pagesHashStrategy = requireNonNull(pagesHashStrategy, "pagesHashStrategy is null"); this.channelCount = pagesHashStrategy.getChannelCount(); size = sizeOf(addresses.elements()) + pagesHashStrategy.getSizeInBytes() + sizeOf(key) + sizeOf(positionToHashes); hashCollisions = hashCollisionsLocal; expectedHashCollisions = estimateNumberOfHashCollisions(addresses.size(), hashSize);
/** * Use createArrayBlockInternal or fromElementBlock instead of this method. The caller of this method is assumed to have * validated the arguments with validateConstructorArguments. */ private ArrayBlock(int arrayOffset, int positionCount, @Nullable boolean[] valueIsNull, int[] offsets, Block values) { // caller must check arguments with validateConstructorArguments this.arrayOffset = arrayOffset; this.positionCount = positionCount; this.valueIsNull = valueIsNull; this.offsets = offsets; this.values = requireNonNull(values); sizeInBytes = -1; retainedSizeInBytes = INSTANCE_SIZE + values.getRetainedSizeInBytes() + sizeOf(offsets) + sizeOf(valueIsNull); }
/** * Creates a slice over the specified array range. * * @param offset the array position at which the slice begins * @param length the number of array positions to include in the slice */ Slice(int[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = sizeOfIntArray(offset); this.size = multiplyExact(length, ARRAY_INT_INDEX_SCALE); this.retainedSize = INSTANCE_SIZE + sizeOf(base); this.reference = (offset == 0 && length == base.length) ? COMPACT : NOT_COMPACT; }
/** * Creates a slice over the specified array range. * * @param offset the array position at which the slice begins * @param length the number of array positions to include in the slice */ Slice(double[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = sizeOfDoubleArray(offset); this.size = multiplyExact(length, ARRAY_DOUBLE_INDEX_SCALE); this.retainedSize = INSTANCE_SIZE + sizeOf(base); this.reference = (offset == 0 && length == base.length) ? COMPACT : NOT_COMPACT; }
/** * Creates a slice over the specified array range. * * @param offset the array position at which the slice begins * @param length the number of array positions to include in the slice */ Slice(boolean[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = sizeOfBooleanArray(offset); this.size = multiplyExact(length, ARRAY_BOOLEAN_INDEX_SCALE); this.retainedSize = INSTANCE_SIZE + sizeOf(base); this.reference = (offset == 0 && length == base.length) ? COMPACT : NOT_COMPACT; }
/** * Creates a slice over the specified array range. * * @param offset the array position at which the slice begins * @param length the number of array positions to include in the slice */ Slice(float[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = sizeOfFloatArray(offset); this.size = multiplyExact(length, ARRAY_FLOAT_INDEX_SCALE); this.retainedSize = INSTANCE_SIZE + sizeOf(base); this.reference = (offset == 0 && length == base.length) ? COMPACT : NOT_COMPACT; }
/** * Creates a slice over the specified array range. * * @param offset the array position at which the slice begins * @param length the number of array positions to include in the slice */ Slice(short[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = sizeOfShortArray(offset); this.size = multiplyExact(length, ARRAY_SHORT_INDEX_SCALE); this.retainedSize = INSTANCE_SIZE + sizeOf(base); this.reference = (offset == 0 && length == base.length) ? COMPACT : NOT_COMPACT; }
/** * Creates a slice over the specified array range. * * @param offset the array position at which the slice begins * @param length the number of array positions to include in the slice */ Slice(long[] base, int offset, int length) { requireNonNull(base, "base is null"); checkPositionIndexes(offset, offset + length, base.length); this.base = base; this.address = sizeOfLongArray(offset); this.size = multiplyExact(length, ARRAY_LONG_INDEX_SCALE); this.retainedSize = INSTANCE_SIZE + sizeOf(base); this.reference = (offset == 0 && length == base.length) ? COMPACT : NOT_COMPACT; }
public InMemoryJoinHash(LongArrayList addresses, PagesHashStrategy pagesHashStrategy) this.addresses = requireNonNull(addresses, "addresses is null"); this.pagesHashStrategy = requireNonNull(pagesHashStrategy, "pagesHashStrategy is null"); this.channelCount = pagesHashStrategy.getChannelCount(); size = sizeOfIntArray(hashSize) + sizeOfBooleanArray(hashSize) + sizeOfIntArray(addresses.size()) + sizeOf(addresses.elements()) + pagesHashStrategy.getSizeInBytes();
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { for (int i = 0; i < numFields; i++) { consumer.accept(fieldBlocks[i], fieldBlocks[i].getRetainedSizeInBytes()); } consumer.accept(fieldBlockOffsets, sizeOf(fieldBlockOffsets)); consumer.accept(rowIsNull, sizeOf(rowIsNull)); consumer.accept(this, (long) INSTANCE_SIZE); }
@Override public void retainedBytesForEachPart(BiConsumer<Object, Long> consumer) { for (int i = 0; i < numFields; i++) { consumer.accept(fieldBlockBuilders[i], fieldBlockBuilders[i].getRetainedSizeInBytes()); } consumer.accept(fieldBlockOffsets, sizeOf(fieldBlockOffsets)); consumer.accept(rowIsNull, sizeOf(rowIsNull)); consumer.accept(this, (long) INSTANCE_SIZE); }
@Test public void testNewBlockBuilderLike() { int entries = 12345; double resetSkew = 1.25; BlockBuilder blockBuilder = new VariableWidthBlockBuilder(null, entries, entries); for (int i = 0; i < entries; i++) { blockBuilder.writeByte(i); blockBuilder.closeEntry(); } blockBuilder = blockBuilder.newBlockBuilderLike(null); // force to initialize capacity blockBuilder.writeByte(1); long actualArrayBytes = sizeOf(new int[(int) ceil(resetSkew * (entries + 1))]) + sizeOf(new boolean[(int) ceil(resetSkew * entries)]); long actualSliceBytes = SLICE_INSTANCE_SIZE + sizeOf(new byte[(int) ceil(resetSkew * entries)]); assertEquals(blockBuilder.getRetainedSizeInBytes(), BLOCK_BUILDER_INSTANCE_SIZE + actualSliceBytes + actualArrayBytes); }
@Override public long getRetainedSizeInBytes() { long size = INSTANCE_SIZE + sizeOf(fieldBlockOffsets) + sizeOf(rowIsNull); for (int i = 0; i < numFields; i++) { size += fieldBlockBuilders[i].getRetainedSizeInBytes(); } if (blockBuilderStatus != null) { size += BlockBuilderStatus.INSTANCE_SIZE; } return size; }
private void updateRetainedSize() { long retainedSizeInBytes = INSTANCE_SIZE + sizeOf(blocks); for (Block block : blocks) { retainedSizeInBytes += block.getRetainedSizeInBytes(); } this.retainedSizeInBytes.set(retainedSizeInBytes); }
if (joinPositions == null) { joinPositions = pagesSpatialIndex.findJoinPositions(probePosition, probe, probeGeometryChannel, partitionChannel); localUserMemoryContext.setBytes(sizeOf(joinPositions)); nextJoinPositionIndex = 0; matchFound = false; int buildColumnCount = pagesSpatialIndexFactory.getOutputTypes().size(); for (int i = 0; i < buildColumnCount; i++) { pageBuilder.getBlockBuilder(probeOutputChannels.size() + i).appendNull();
@Override public long getSizeInBytes() { return INSTANCE_SIZE + sizeOf(positionLinks); } }