Class ParquetTypeUtils

java.lang.Object
io.trino.parquet.ParquetTypeUtils

public final class ParquetTypeUtils extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    checkBytesFitInShortDecimal(byte[] bytes, int offset, int length, org.apache.parquet.column.ColumnDescriptor descriptor)
     
    static Optional<Field>
    constructField(Type type, org.apache.parquet.io.ColumnIO columnIO)
     
     
    static org.apache.parquet.io.ColumnIO
    getArrayElementColumn(org.apache.parquet.io.ColumnIO columnIO)
     
    static org.apache.parquet.io.MessageColumnIO
    getColumnIO(org.apache.parquet.schema.MessageType fileSchema, org.apache.parquet.schema.MessageType requestedSchema)
     
    static List<org.apache.parquet.io.PrimitiveColumnIO>
    getColumns(org.apache.parquet.schema.MessageType fileSchema, org.apache.parquet.schema.MessageType requestedSchema)
     
    static Optional<org.apache.parquet.column.ColumnDescriptor>
    getDescriptor(List<org.apache.parquet.io.PrimitiveColumnIO> columns, List<String> path)
     
    static Map<List<String>,org.apache.parquet.column.ColumnDescriptor>
    getDescriptors(org.apache.parquet.schema.MessageType fileSchema, org.apache.parquet.schema.MessageType requestedSchema)
     
    static org.apache.parquet.io.GroupColumnIO
    getMapKeyValueColumn(org.apache.parquet.io.GroupColumnIO groupColumnIO)
     
    getParquetEncoding(org.apache.parquet.column.Encoding encoding)
     
    static org.apache.parquet.schema.Type
    getParquetTypeByName(String columnName, org.apache.parquet.schema.GroupType groupType)
     
    static long
    getShortDecimalValue(byte[] bytes)
     
    static long
    getShortDecimalValue(byte[] bytes, int startOffset, int length)
     
    static boolean
    isOptionalFieldValueNull(int definitionLevel, int maxDefinitionLevel)
     
    static boolean
    isValueNull(boolean required, int definitionLevel, int maxDefinitionLevel)
    For optional fields: definitionLevel == maxDefinitionLevel => Value is defined definitionLevel == maxDefinitionLevel - 1 => Value is null definitionLevel < maxDefinitionLevel - 1 => Value does not exist, because one of its optional parent fields is null
    static org.apache.parquet.io.ColumnIO
    lookupColumnById(org.apache.parquet.io.GroupColumnIO groupColumnIO, int columnId)
     
    static org.apache.parquet.io.ColumnIO
    lookupColumnByName(org.apache.parquet.io.GroupColumnIO groupColumnIO, String columnName)
    Parquet column names are case-sensitive unlike Hive, which converts all column names to lowercase.
    static byte[]
    paddingBigInteger(BigInteger bigInteger, int numBytes)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getColumns

      public static List<org.apache.parquet.io.PrimitiveColumnIO> getColumns(org.apache.parquet.schema.MessageType fileSchema, org.apache.parquet.schema.MessageType requestedSchema)
    • getColumnIO

      public static org.apache.parquet.io.MessageColumnIO getColumnIO(org.apache.parquet.schema.MessageType fileSchema, org.apache.parquet.schema.MessageType requestedSchema)
    • getMapKeyValueColumn

      public static org.apache.parquet.io.GroupColumnIO getMapKeyValueColumn(org.apache.parquet.io.GroupColumnIO groupColumnIO)
    • getArrayElementColumn

      public static org.apache.parquet.io.ColumnIO getArrayElementColumn(org.apache.parquet.io.ColumnIO columnIO)
    • getDescriptors

      public static Map<List<String>,org.apache.parquet.column.ColumnDescriptor> getDescriptors(org.apache.parquet.schema.MessageType fileSchema, org.apache.parquet.schema.MessageType requestedSchema)
    • getDescriptor

      public static Optional<org.apache.parquet.column.ColumnDescriptor> getDescriptor(List<org.apache.parquet.io.PrimitiveColumnIO> columns, List<String> path)
    • getParquetEncoding

      public static ParquetEncoding getParquetEncoding(org.apache.parquet.column.Encoding encoding)
    • getParquetTypeByName

      public static org.apache.parquet.schema.Type getParquetTypeByName(String columnName, org.apache.parquet.schema.GroupType groupType)
    • lookupColumnByName

      public static org.apache.parquet.io.ColumnIO lookupColumnByName(org.apache.parquet.io.GroupColumnIO groupColumnIO, String columnName)
      Parquet column names are case-sensitive unlike Hive, which converts all column names to lowercase. Therefore, when we look up columns we first check for exact match, and if that fails we look for a case-insensitive match.
    • lookupColumnById

      @Nullable public static org.apache.parquet.io.ColumnIO lookupColumnById(org.apache.parquet.io.GroupColumnIO groupColumnIO, int columnId)
    • createDecimalType

      public static Optional<DecimalType> createDecimalType(PrimitiveField field)
    • isValueNull

      public static boolean isValueNull(boolean required, int definitionLevel, int maxDefinitionLevel)
      For optional fields: definitionLevel == maxDefinitionLevel => Value is defined definitionLevel == maxDefinitionLevel - 1 => Value is null definitionLevel < maxDefinitionLevel - 1 => Value does not exist, because one of its optional parent fields is null
    • isOptionalFieldValueNull

      public static boolean isOptionalFieldValueNull(int definitionLevel, int maxDefinitionLevel)
    • getShortDecimalValue

      public static long getShortDecimalValue(byte[] bytes)
    • getShortDecimalValue

      public static long getShortDecimalValue(byte[] bytes, int startOffset, int length)
    • checkBytesFitInShortDecimal

      public static void checkBytesFitInShortDecimal(byte[] bytes, int offset, int length, org.apache.parquet.column.ColumnDescriptor descriptor)
    • paddingBigInteger

      public static byte[] paddingBigInteger(BigInteger bigInteger, int numBytes)
    • constructField

      public static Optional<Field> constructField(Type type, org.apache.parquet.io.ColumnIO columnIO)