Search in sources :

Example 1 with ByteStreamCheckpoint

use of io.trino.orc.checkpoint.ByteStreamCheckpoint in project trino by trinodb.

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();
}
Also used : BooleanStreamCheckpoint(io.trino.orc.checkpoint.BooleanStreamCheckpoint) ImmutableList(com.google.common.collect.ImmutableList) ByteStreamCheckpoint(io.trino.orc.checkpoint.ByteStreamCheckpoint) BooleanStreamCheckpoint(io.trino.orc.checkpoint.BooleanStreamCheckpoint) ByteStreamCheckpoint(io.trino.orc.checkpoint.ByteStreamCheckpoint)

Example 2 with ByteStreamCheckpoint

use of io.trino.orc.checkpoint.ByteStreamCheckpoint in project trino by trinodb.

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));
}
Also used : ColumnStatistics(io.trino.orc.metadata.statistics.ColumnStatistics) BooleanStreamCheckpoint(io.trino.orc.checkpoint.BooleanStreamCheckpoint) ImmutableList(com.google.common.collect.ImmutableList) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) ByteStreamCheckpoint(io.trino.orc.checkpoint.ByteStreamCheckpoint) StreamDataOutput(io.trino.orc.stream.StreamDataOutput) ByteStreamCheckpoint(io.trino.orc.checkpoint.ByteStreamCheckpoint) BooleanStreamCheckpoint(io.trino.orc.checkpoint.BooleanStreamCheckpoint) RowGroupIndex(io.trino.orc.metadata.RowGroupIndex) Slice(io.airlift.slice.Slice) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) List(java.util.List) PresentOutputStream(io.trino.orc.stream.PresentOutputStream) Stream(io.trino.orc.metadata.Stream) ByteOutputStream(io.trino.orc.stream.ByteOutputStream)

Example 3 with ByteStreamCheckpoint

use of io.trino.orc.checkpoint.ByteStreamCheckpoint in project trino by trinodb.

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();
}
Also used : ByteStreamCheckpoint(io.trino.orc.checkpoint.ByteStreamCheckpoint)

Example 4 with ByteStreamCheckpoint

use of io.trino.orc.checkpoint.ByteStreamCheckpoint in project trino by trinodb.

the class ByteOutputStream method recordCheckpoint.

@Override
public void recordCheckpoint() {
    checkState(!closed);
    checkpoints.add(new ByteStreamCheckpoint(size, buffer.getCheckpoint()));
}
Also used : ByteStreamCheckpoint(io.trino.orc.checkpoint.ByteStreamCheckpoint)

Aggregations

ByteStreamCheckpoint (io.trino.orc.checkpoint.ByteStreamCheckpoint)4 ImmutableList (com.google.common.collect.ImmutableList)2 BooleanStreamCheckpoint (io.trino.orc.checkpoint.BooleanStreamCheckpoint)2 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)1 Slice (io.airlift.slice.Slice)1 RowGroupIndex (io.trino.orc.metadata.RowGroupIndex)1 Stream (io.trino.orc.metadata.Stream)1 ColumnStatistics (io.trino.orc.metadata.statistics.ColumnStatistics)1 ByteOutputStream (io.trino.orc.stream.ByteOutputStream)1 PresentOutputStream (io.trino.orc.stream.PresentOutputStream)1 StreamDataOutput (io.trino.orc.stream.StreamDataOutput)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1