@Override public long getEstimatedDataSizeForStats(int position) { checkReadablePosition(position); if (isNull(position)) { return 0; } Block[] rawFieldBlocks = getRawFieldBlocks(); long size = 0; for (int i = 0; i < numFields; i++) { size += rawFieldBlocks[i].getEstimatedDataSizeForStats(getFieldBlockOffset(position)); } return size; }
@Override public Block getSingleValueBlock(int position) { checkReadablePosition(position); int startFieldBlockOffset = getFieldBlockOffset(position); int endFieldBlockOffset = getFieldBlockOffset(position + 1); int fieldBlockLength = endFieldBlockOffset - startFieldBlockOffset; Block[] newBlocks = new Block[numFields]; for (int i = 0; i < numFields; i++) { newBlocks[i] = getRawFieldBlocks()[i].copyRegion(startFieldBlockOffset, fieldBlockLength); } boolean[] newRowIsNull = new boolean[] {isNull(position)}; int[] newOffsets = new int[] {0, fieldBlockLength}; return createRowBlockInternal(0, 1, newRowIsNull, newOffsets, newBlocks); }
@Override public Block copyPositions(int[] positions, int offset, int length) { checkArrayRange(positions, offset, length); int[] newOffsets = new int[length + 1]; boolean[] newRowIsNull = new boolean[length]; IntArrayList fieldBlockPositions = new IntArrayList(length); for (int i = 0; i < length; i++) { int position = positions[offset + i]; if (isNull(position)) { newRowIsNull[i] = true; newOffsets[i + 1] = newOffsets[i]; } else { newOffsets[i + 1] = newOffsets[i] + 1; fieldBlockPositions.add(getFieldBlockOffset(position)); } } Block[] newBlocks = new Block[numFields]; for (int i = 0; i < numFields; i++) { newBlocks[i] = getRawFieldBlocks()[i].copyPositions(fieldBlockPositions.elements(), 0, fieldBlockPositions.size()); } return createRowBlockInternal(0, length, newRowIsNull, newOffsets, newBlocks); }