Search in sources :

Example 1 with HiveWriterVersion

use of com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion in project presto by prestodb.

the class DwrfMetadataReader method readRowIndexes.

@Override
public List<RowGroupIndex> readRowIndexes(HiveWriterVersion hiveWriterVersion, InputStream inputStream) throws IOException {
    CodedInputStream input = CodedInputStream.newInstance(inputStream);
    DwrfProto.RowIndex rowIndex = DwrfProto.RowIndex.parseFrom(input);
    return ImmutableList.copyOf(Iterables.transform(rowIndex.getEntryList(), rowIndexEntry -> toRowGroupIndex(hiveWriterVersion, rowIndexEntry)));
}
Also used : ORIGINAL(com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion.ORIGINAL) Iterables(com.google.common.collect.Iterables) Slice(io.airlift.slice.Slice) OrcTypeKind(com.facebook.presto.orc.metadata.OrcType.OrcTypeKind) ZLIB(com.facebook.presto.orc.metadata.CompressionKind.ZLIB) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ImmutableList(com.google.common.collect.ImmutableList) HiveWriterVersion(com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion) Slices(io.airlift.slice.Slices) Map(java.util.Map) Math.toIntExact(java.lang.Math.toIntExact) StreamKind(com.facebook.presto.orc.metadata.Stream.StreamKind) OrcMetadataReader.getMinSlice(com.facebook.presto.orc.metadata.OrcMetadataReader.getMinSlice) UNCOMPRESSED(com.facebook.presto.orc.metadata.CompressionKind.UNCOMPRESSED) ImmutableMap(com.google.common.collect.ImmutableMap) ColumnEncodingKind(com.facebook.presto.orc.metadata.ColumnEncoding.ColumnEncodingKind) SNAPPY(com.facebook.presto.orc.metadata.CompressionKind.SNAPPY) IOException(java.io.IOException) OrcMetadataReader.getMaxSlice(com.facebook.presto.orc.metadata.OrcMetadataReader.getMaxSlice) Preconditions.checkState(com.google.common.base.Preconditions.checkState) List(java.util.List) CodedInputStream(com.facebook.presto.orc.protobuf.CodedInputStream) Optional(java.util.Optional) DwrfProto(com.facebook.presto.orc.proto.DwrfProto) InputStream(java.io.InputStream) CodedInputStream(com.facebook.presto.orc.protobuf.CodedInputStream) DwrfProto(com.facebook.presto.orc.proto.DwrfProto)

Example 2 with HiveWriterVersion

use of com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion in project presto by prestodb.

the class OrcMetadataReader method readRowIndexes.

@Override
public List<RowGroupIndex> readRowIndexes(HiveWriterVersion hiveWriterVersion, InputStream inputStream) throws IOException {
    CodedInputStream input = CodedInputStream.newInstance(inputStream);
    OrcProto.RowIndex rowIndex = OrcProto.RowIndex.parseFrom(input);
    return ImmutableList.copyOf(Iterables.transform(rowIndex.getEntryList(), rowIndexEntry -> toRowGroupIndex(hiveWriterVersion, rowIndexEntry)));
}
Also used : ORIGINAL(com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion.ORIGINAL) Iterables(com.google.common.collect.Iterables) Slice(io.airlift.slice.Slice) Logger(io.airlift.log.Logger) OrcTypeKind(com.facebook.presto.orc.metadata.OrcType.OrcTypeKind) BigDecimal(java.math.BigDecimal) ZLIB(com.facebook.presto.orc.metadata.CompressionKind.ZLIB) GIGABYTE(io.airlift.units.DataSize.Unit.GIGABYTE) ImmutableList(com.google.common.collect.ImmutableList) HiveWriterVersion(com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion) Slices(io.airlift.slice.Slices) Map(java.util.Map) Math.toIntExact(java.lang.Math.toIntExact) StreamKind(com.facebook.presto.orc.metadata.Stream.StreamKind) ORC_HIVE_8732(com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion.ORC_HIVE_8732) UNCOMPRESSED(com.facebook.presto.orc.metadata.CompressionKind.UNCOMPRESSED) ImmutableMap(com.google.common.collect.ImmutableMap) ColumnEncodingKind(com.facebook.presto.orc.metadata.ColumnEncoding.ColumnEncodingKind) RowIndexEntry(com.facebook.presto.orc.proto.OrcProto.RowIndexEntry) SNAPPY(com.facebook.presto.orc.metadata.CompressionKind.SNAPPY) IOException(java.io.IOException) Preconditions.checkState(com.google.common.base.Preconditions.checkState) DataSize(io.airlift.units.DataSize) List(java.util.List) CodedInputStream(com.facebook.presto.orc.protobuf.CodedInputStream) OrcProto(com.facebook.presto.orc.proto.OrcProto) Optional(java.util.Optional) VisibleForTesting(com.google.common.annotations.VisibleForTesting) MIN_SURROGATE(java.lang.Character.MIN_SURROGATE) InputStream(java.io.InputStream) CodedInputStream(com.facebook.presto.orc.protobuf.CodedInputStream) OrcProto(com.facebook.presto.orc.proto.OrcProto)

Aggregations

ColumnEncodingKind (com.facebook.presto.orc.metadata.ColumnEncoding.ColumnEncodingKind)2 SNAPPY (com.facebook.presto.orc.metadata.CompressionKind.SNAPPY)2 UNCOMPRESSED (com.facebook.presto.orc.metadata.CompressionKind.UNCOMPRESSED)2 ZLIB (com.facebook.presto.orc.metadata.CompressionKind.ZLIB)2 OrcTypeKind (com.facebook.presto.orc.metadata.OrcType.OrcTypeKind)2 HiveWriterVersion (com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion)2 ORIGINAL (com.facebook.presto.orc.metadata.PostScript.HiveWriterVersion.ORIGINAL)2 StreamKind (com.facebook.presto.orc.metadata.Stream.StreamKind)2 CodedInputStream (com.facebook.presto.orc.protobuf.CodedInputStream)2 Preconditions.checkState (com.google.common.base.Preconditions.checkState)2 ImmutableList (com.google.common.collect.ImmutableList)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 Iterables (com.google.common.collect.Iterables)2 Slice (io.airlift.slice.Slice)2 Slices (io.airlift.slice.Slices)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 Math.toIntExact (java.lang.Math.toIntExact)2 List (java.util.List)2 Map (java.util.Map)2