@Override public void writePositionTo(int position, BlockBuilder blockBuilder) { checkReadablePosition(position); blockBuilder.appendStructureInternal(this, position); }
@Override public boolean isNull(int position) { checkReadablePosition(position); boolean[] rowIsNull = getRowIsNull(); return rowIsNull != null && rowIsNull[position + getOffsetBase()]; }
@Override public <T> T getObject(int position, Class<T> clazz) { if (clazz != Block.class) { throw new IllegalArgumentException("clazz must be Block.class"); } checkReadablePosition(position); return clazz.cast(new SingleRowBlock(getFieldBlockOffset(position), getRawFieldBlocks())); }
@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 void writePositionTo(int position, BlockBuilder blockBuilder) { checkReadablePosition(position); blockBuilder.appendStructureInternal(this, position); }
@Override public boolean isNull(int position) { checkReadablePosition(position); boolean[] rowIsNull = getRowIsNull(); return rowIsNull != null && rowIsNull[position + getOffsetBase()]; }
@Override public <T> T getObject(int position, Class<T> clazz) { if (clazz != Block.class) { throw new IllegalArgumentException("clazz must be Block.class"); } checkReadablePosition(position); return clazz.cast(new SingleRowBlock(getFieldBlockOffset(position), getRawFieldBlocks())); }
@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); }