use of io.trino.orc.checkpoint.DecimalStreamCheckpoint in project trino by trinodb.
the class DecimalColumnWriter method getIndexStreams.
@Override
public List<StreamDataOutput> getIndexStreams(CompressedMetadataWriter metadataWriter) throws IOException {
checkState(closed);
ImmutableList.Builder<RowGroupIndex> rowGroupIndexes = ImmutableList.builder();
List<DecimalStreamCheckpoint> dataCheckpoints = dataStream.getCheckpoints();
List<LongStreamCheckpoint> scaleCheckpoints = scaleStream.getCheckpoints();
Optional<List<BooleanStreamCheckpoint>> presentCheckpoints = presentStream.getCheckpoints();
for (int i = 0; i < rowGroupColumnStatistics.size(); i++) {
int groupId = i;
ColumnStatistics columnStatistics = rowGroupColumnStatistics.get(groupId);
DecimalStreamCheckpoint dataCheckpoint = dataCheckpoints.get(groupId);
LongStreamCheckpoint scaleCheckpoint = scaleCheckpoints.get(groupId);
Optional<BooleanStreamCheckpoint> presentCheckpoint = presentCheckpoints.map(checkpoints -> checkpoints.get(groupId));
List<Integer> positions = createDecimalColumnPositionList(compressed, dataCheckpoint, scaleCheckpoint, presentCheckpoint);
rowGroupIndexes.add(new RowGroupIndex(positions, columnStatistics));
}
Slice slice = metadataWriter.writeRowIndexes(rowGroupIndexes.build());
Stream stream = new Stream(columnId, StreamKind.ROW_INDEX, slice.length(), false);
return ImmutableList.of(new StreamDataOutput(slice, stream));
}
use of io.trino.orc.checkpoint.DecimalStreamCheckpoint in project trino by trinodb.
the class DecimalInputStream method seekToCheckpoint.
@Override
public void seekToCheckpoint(DecimalStreamCheckpoint checkpoint) throws IOException {
long newCheckpoint = checkpoint.getInputStreamCheckpoint();
// buffer, so last checkpoint is no longer valid)
if (block.length() > 0 && decodeCompressedBlockOffset(newCheckpoint) == decodeCompressedBlockOffset(lastCheckpoint)) {
// and decompressed position is within our block, reposition in the block directly
int blockOffset = decodeDecompressedOffset(newCheckpoint) - decodeDecompressedOffset(lastCheckpoint);
if (blockOffset >= 0 && blockOffset < block.length()) {
this.blockOffset = blockOffset;
// do not change last checkpoint because we have not moved positions
return;
}
}
chunkLoader.seekToCheckpoint(newCheckpoint);
lastCheckpoint = newCheckpoint;
block = Slices.EMPTY_SLICE;
blockOffset = 0;
}
use of io.trino.orc.checkpoint.DecimalStreamCheckpoint in project trino by trinodb.
the class DecimalOutputStream method recordCheckpoint.
@Override
public void recordCheckpoint() {
checkState(!closed);
checkpoints.add(new DecimalStreamCheckpoint(buffer.getCheckpoint()));
}
Aggregations