Search in sources :

Example 1 with ByteArrayStreamCheckpoint

use of io.prestosql.orc.checkpoint.ByteArrayStreamCheckpoint in project hetu-core by openlookeng.

the class ByteArrayOutputStream method recordCheckpoint.

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

Example 2 with ByteArrayStreamCheckpoint

use of io.prestosql.orc.checkpoint.ByteArrayStreamCheckpoint in project hetu-core by openlookeng.

the class SliceDirectColumnWriter method getIndexStreams.

@Override
public List<StreamDataOutput> getIndexStreams(CompressedMetadataWriter metadataWriter) throws IOException {
    checkState(closed);
    ImmutableList.Builder<RowGroupIndex> rowGroupIndexes = ImmutableList.builder();
    List<LongStreamCheckpoint> lengthCheckpoints = lengthStream.getCheckpoints();
    List<ByteArrayStreamCheckpoint> 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);
        LongStreamCheckpoint lengthCheckpoint = lengthCheckpoints.get(groupId);
        ByteArrayStreamCheckpoint dataCheckpoint = dataCheckpoints.get(groupId);
        Optional<BooleanStreamCheckpoint> presentCheckpoint = presentCheckpoints.map(checkpoints -> checkpoints.get(groupId));
        List<Integer> positions = createSliceColumnPositionList(compressed, lengthCheckpoint, 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.prestosql.orc.metadata.statistics.ColumnStatistics) BooleanStreamCheckpoint(io.prestosql.orc.checkpoint.BooleanStreamCheckpoint) ByteArrayStreamCheckpoint(io.prestosql.orc.checkpoint.ByteArrayStreamCheckpoint) ImmutableList(com.google.common.collect.ImmutableList) StreamDataOutput(io.prestosql.orc.stream.StreamDataOutput) LongStreamCheckpoint(io.prestosql.orc.checkpoint.LongStreamCheckpoint) BooleanStreamCheckpoint(io.prestosql.orc.checkpoint.BooleanStreamCheckpoint) LongStreamCheckpoint(io.prestosql.orc.checkpoint.LongStreamCheckpoint) ByteArrayStreamCheckpoint(io.prestosql.orc.checkpoint.ByteArrayStreamCheckpoint) RowGroupIndex(io.prestosql.orc.metadata.RowGroupIndex) Slice(io.airlift.slice.Slice) ArrayList(java.util.ArrayList) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) LongOutputStream(io.prestosql.orc.stream.LongOutputStream) LongOutputStream.createLengthOutputStream(io.prestosql.orc.stream.LongOutputStream.createLengthOutputStream) PresentOutputStream(io.prestosql.orc.stream.PresentOutputStream) ByteArrayOutputStream(io.prestosql.orc.stream.ByteArrayOutputStream) Stream(io.prestosql.orc.metadata.Stream)

Aggregations

ByteArrayStreamCheckpoint (io.prestosql.orc.checkpoint.ByteArrayStreamCheckpoint)2 ImmutableList (com.google.common.collect.ImmutableList)1 Slice (io.airlift.slice.Slice)1 BooleanStreamCheckpoint (io.prestosql.orc.checkpoint.BooleanStreamCheckpoint)1 LongStreamCheckpoint (io.prestosql.orc.checkpoint.LongStreamCheckpoint)1 RowGroupIndex (io.prestosql.orc.metadata.RowGroupIndex)1 Stream (io.prestosql.orc.metadata.Stream)1 ColumnStatistics (io.prestosql.orc.metadata.statistics.ColumnStatistics)1 ByteArrayOutputStream (io.prestosql.orc.stream.ByteArrayOutputStream)1 LongOutputStream (io.prestosql.orc.stream.LongOutputStream)1 LongOutputStream.createLengthOutputStream (io.prestosql.orc.stream.LongOutputStream.createLengthOutputStream)1 PresentOutputStream (io.prestosql.orc.stream.PresentOutputStream)1 StreamDataOutput (io.prestosql.orc.stream.StreamDataOutput)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1