@Override public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, getPositionCount()); long sizeInBytes = 0; int usedPositionCount = 0; for (int i = 0; i < positions.length; ++i) { if (positions[i]) { usedPositionCount++; sizeInBytes += getOffset(i + 1) - getOffset(i); } } return sizeInBytes + (Integer.BYTES + Byte.BYTES) * (long) usedPositionCount; }
@Override public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, positionCount); boolean[] used = new boolean[dictionary.getPositionCount()]; for (int i = 0; i < positions.length; i++) { if (positions[i]) { used[getId(i)] = true; } } return dictionary.getPositionsSizeInBytes(used) + (Integer.BYTES * (long) countUsedPositions(positions)); }
@Override public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, getPositionCount()); int usedPositionCount = 0; boolean[] fieldPositions = new boolean[getRawFieldBlocks()[0].getPositionCount()]; for (int i = 0; i < positions.length; i++) { if (positions[i]) { usedPositionCount++; int startFieldBlockOffset = getFieldBlockOffset(i); int endFieldBlockOffset = getFieldBlockOffset(i + 1); for (int j = startFieldBlockOffset; j < endFieldBlockOffset; j++) { fieldPositions[j] = true; } } } long sizeInBytes = 0; for (int j = 0; j < numFields; j++) { sizeInBytes += getRawFieldBlocks()[j].getPositionsSizeInBytes(fieldPositions); } return sizeInBytes + (Integer.BYTES + Byte.BYTES) * (long) usedPositionCount; }
@Override public long getPositionsSizeInBytes(boolean[] positions) { checkValidPositions(positions, getPositionCount()); boolean[] used = new boolean[getRawElementBlock().getPositionCount()]; int usedPositionCount = 0; for (int i = 0; i < positions.length; ++i) { if (positions[i]) { usedPositionCount++; int valueStart = getOffsets()[getOffsetBase() + i]; int valueEnd = getOffsets()[getOffsetBase() + i + 1]; for (int j = valueStart; j < valueEnd; ++j) { used[j] = true; } } } return getRawElementBlock().getPositionsSizeInBytes(used) + ((Integer.BYTES + Byte.BYTES) * (long) usedPositionCount); }
@Override public long getPositionsSizeInBytes(boolean[] positions) { // We can use either the getRegionSizeInBytes or getPositionsSizeInBytes // from the underlying raw blocks to implement this function. We chose // getPositionsSizeInBytes with the assumption that constructing a // positions array is cheaper than calling getRegionSizeInBytes for each // used position. int positionCount = getPositionCount(); checkValidPositions(positions, positionCount); boolean[] entryPositions = new boolean[getRawKeyBlock().getPositionCount()]; int usedEntryCount = 0; int usedPositionCount = 0; for (int i = 0; i < positions.length; ++i) { if (positions[i]) { usedPositionCount++; int entriesStart = getOffsets()[getOffsetBase() + i]; int entriesEnd = getOffsets()[getOffsetBase() + i + 1]; for (int j = entriesStart; j < entriesEnd; j++) { entryPositions[j] = true; } usedEntryCount += (entriesEnd - entriesStart); } } return getRawKeyBlock().getPositionsSizeInBytes(entryPositions) + getRawValueBlock().getPositionsSizeInBytes(entryPositions) + (Integer.BYTES + Byte.BYTES) * (long) usedPositionCount + Integer.BYTES * HASH_MULTIPLIER * (long) usedEntryCount; }