Search in sources :

Example 1 with ByteStreamCheckpoint

use of com.facebook.presto.orc.checkpoint.ByteStreamCheckpoint in project presto by prestodb.

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(com.facebook.presto.orc.checkpoint.BooleanStreamCheckpoint) ImmutableList(com.google.common.collect.ImmutableList) ByteStreamCheckpoint(com.facebook.presto.orc.checkpoint.ByteStreamCheckpoint) BooleanStreamCheckpoint(com.facebook.presto.orc.checkpoint.BooleanStreamCheckpoint) ByteStreamCheckpoint(com.facebook.presto.orc.checkpoint.ByteStreamCheckpoint)

Example 2 with ByteStreamCheckpoint

use of com.facebook.presto.orc.checkpoint.ByteStreamCheckpoint in project presto by prestodb.

the class ByteColumnWriter method getIndexStreams.

@Override
public List<StreamDataOutput> getIndexStreams() 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(column, StreamKind.ROW_INDEX, slice.length(), false);
    return ImmutableList.of(new StreamDataOutput(slice, stream));
}
Also used : ColumnStatistics(com.facebook.presto.orc.metadata.statistics.ColumnStatistics) BooleanStreamCheckpoint(com.facebook.presto.orc.checkpoint.BooleanStreamCheckpoint) ImmutableList(com.google.common.collect.ImmutableList) ByteStreamCheckpoint(com.facebook.presto.orc.checkpoint.ByteStreamCheckpoint) StreamDataOutput(com.facebook.presto.orc.stream.StreamDataOutput) ByteStreamCheckpoint(com.facebook.presto.orc.checkpoint.ByteStreamCheckpoint) BooleanStreamCheckpoint(com.facebook.presto.orc.checkpoint.BooleanStreamCheckpoint) RowGroupIndex(com.facebook.presto.orc.metadata.RowGroupIndex) Slice(io.airlift.slice.Slice) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) PresentOutputStream(com.facebook.presto.orc.stream.PresentOutputStream) Stream(com.facebook.presto.orc.metadata.Stream) ByteOutputStream(com.facebook.presto.orc.stream.ByteOutputStream)

Example 3 with ByteStreamCheckpoint

use of com.facebook.presto.orc.checkpoint.ByteStreamCheckpoint in project presto by prestodb.

the class ByteOutputStream method recordCheckpoint.

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

Example 4 with ByteStreamCheckpoint

use of com.facebook.presto.orc.checkpoint.ByteStreamCheckpoint in project presto by prestodb.

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(com.facebook.presto.orc.checkpoint.ByteStreamCheckpoint)

Aggregations

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