use of io.prestosql.orc.checkpoint.ByteStreamCheckpoint in project hetu-core by openlookeng.
the class TestBooleanOutputStream method checkpointsEqual.
private static boolean checkpointsEqual(BooleanStreamCheckpoint left, BooleanStreamCheckpoint right) {
assertNotNull(left);
assertNotNull(right);
if (left.getOffset() != right.getOffset()) {
return false;
}
ByteStreamCheckpoint leftCheckpoint = left.getByteStreamCheckpoint();
ByteStreamCheckpoint rightCheckpoint = right.getByteStreamCheckpoint();
assertNotNull(leftCheckpoint);
assertNotNull(rightCheckpoint);
return leftCheckpoint.getInputStreamCheckpoint() == rightCheckpoint.getInputStreamCheckpoint() && leftCheckpoint.getOffset() == rightCheckpoint.getOffset();
}
use of io.prestosql.orc.checkpoint.ByteStreamCheckpoint in project hetu-core by openlookeng.
the class BooleanOutputStream method getCheckpoints.
@Override
public List<BooleanStreamCheckpoint> getCheckpoints() {
checkState(closed);
ImmutableList.Builder<BooleanStreamCheckpoint> booleanStreamCheckpoint = ImmutableList.builder();
List<ByteStreamCheckpoint> byteStreamCheckpoints = byteOutputStream.getCheckpoints();
for (int groupId = 0; groupId < checkpointBitOffsets.size(); groupId++) {
int checkpointBitOffset = checkpointBitOffsets.get(groupId);
ByteStreamCheckpoint byteStreamCheckpoint = byteStreamCheckpoints.get(groupId);
booleanStreamCheckpoint.add(new BooleanStreamCheckpoint(checkpointBitOffset, byteStreamCheckpoint));
}
return booleanStreamCheckpoint.build();
}
use of io.prestosql.orc.checkpoint.ByteStreamCheckpoint in project hetu-core by openlookeng.
the class ByteColumnWriter method getIndexStreams.
@Override
public List<StreamDataOutput> getIndexStreams(CompressedMetadataWriter metadataWriter) throws IOException {
checkState(closed);
ImmutableList.Builder<RowGroupIndex> rowGroupIndexes = ImmutableList.builder();
List<ByteStreamCheckpoint> dataCheckpoints = dataStream.getCheckpoints();
Optional<List<BooleanStreamCheckpoint>> presentCheckpoints = presentStream.getCheckpoints();
for (int i = 0; i < rowGroupColumnStatistics.size(); i++) {
int groupId = i;
ColumnStatistics columnStatistics = rowGroupColumnStatistics.get(groupId);
ByteStreamCheckpoint dataCheckpoint = dataCheckpoints.get(groupId);
Optional<BooleanStreamCheckpoint> presentCheckpoint = presentCheckpoints.map(checkpoints -> checkpoints.get(groupId));
List<Integer> positions = createByteColumnPositionList(compressed, dataCheckpoint, 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.prestosql.orc.checkpoint.ByteStreamCheckpoint in project hetu-core by openlookeng.
the class ByteOutputStream method recordCheckpoint.
@Override
public void recordCheckpoint() {
checkState(!closed);
checkpoints.add(new ByteStreamCheckpoint(size, buffer.getCheckpoint()));
}
Aggregations