Search in sources :

Example 1 with PRESENT

use of io.trino.orc.metadata.Stream.StreamKind.PRESENT in project trino by trinodb.

the class PresentOutputStream method getStreamDataOutput.

public Optional<StreamDataOutput> getStreamDataOutput(OrcColumnId columnId) {
    checkArgument(closed);
    if (booleanOutputStream == null) {
        return Optional.empty();
    }
    StreamDataOutput streamDataOutput = booleanOutputStream.getStreamDataOutput(columnId);
    // rewrite the DATA stream created by the boolean output stream to a PRESENT stream
    Stream stream = new Stream(columnId, PRESENT, toIntExact(streamDataOutput.size()), streamDataOutput.getStream().isUseVInts());
    return Optional.of(new StreamDataOutput(sliceOutput -> {
        streamDataOutput.writeData(sliceOutput);
        return stream.getLength();
    }, stream));
}
Also used : OrcOutputBuffer(io.trino.orc.OrcOutputBuffer) PRESENT(io.trino.orc.metadata.Stream.StreamKind.PRESENT) BooleanStreamCheckpoint(io.trino.orc.checkpoint.BooleanStreamCheckpoint) CompressionKind(io.trino.orc.metadata.CompressionKind) Stream(io.trino.orc.metadata.Stream) ArrayList(java.util.ArrayList) Preconditions.checkState(com.google.common.base.Preconditions.checkState) List(java.util.List) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ClassLayout(org.openjdk.jol.info.ClassLayout) Optional(java.util.Optional) Math.toIntExact(java.lang.Math.toIntExact) Nullable(javax.annotation.Nullable) OrcColumnId(io.trino.orc.metadata.OrcColumnId) Stream(io.trino.orc.metadata.Stream)

Aggregations

Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 OrcOutputBuffer (io.trino.orc.OrcOutputBuffer)1 BooleanStreamCheckpoint (io.trino.orc.checkpoint.BooleanStreamCheckpoint)1 CompressionKind (io.trino.orc.metadata.CompressionKind)1 OrcColumnId (io.trino.orc.metadata.OrcColumnId)1 Stream (io.trino.orc.metadata.Stream)1 PRESENT (io.trino.orc.metadata.Stream.StreamKind.PRESENT)1 Math.toIntExact (java.lang.Math.toIntExact)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 Nullable (javax.annotation.Nullable)1 ClassLayout (org.openjdk.jol.info.ClassLayout)1