Package io.trino.parquet
Class ParquetTypeUtils
- java.lang.Object
-
- io.trino.parquet.ParquetTypeUtils
-
public final class ParquetTypeUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<DecimalType>createDecimalType(RichColumnDescriptor descriptor)static org.apache.parquet.io.ColumnIOgetArrayElementColumn(org.apache.parquet.io.ColumnIO columnIO)static org.apache.parquet.io.MessageColumnIOgetColumnIO(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<RichColumnDescriptor>getDescriptor(List<org.apache.parquet.io.PrimitiveColumnIO> columns, List<String> path)static Map<List<String>,RichColumnDescriptor>getDescriptors(org.apache.parquet.schema.MessageType fileSchema, org.apache.parquet.schema.MessageType requestedSchema)static io.airlift.slice.SlicegetLongDecimalValue(byte[] bytes)static org.apache.parquet.io.GroupColumnIOgetMapKeyValueColumn(org.apache.parquet.io.GroupColumnIO groupColumnIO)static ParquetEncodinggetParquetEncoding(org.apache.parquet.column.Encoding encoding)static org.apache.parquet.schema.TypegetParquetTypeByName(String columnName, org.apache.parquet.schema.GroupType groupType)static longgetShortDecimalValue(byte[] bytes)static longgetShortDecimalValue(byte[] bytes, int startOffset, int length)static booleanisValueNull(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 nullstatic org.apache.parquet.io.ColumnIOlookupColumnById(org.apache.parquet.io.GroupColumnIO groupColumnIO, int columnId)static org.apache.parquet.io.ColumnIOlookupColumnByName(org.apache.parquet.io.GroupColumnIO groupColumnIO, String columnName)Parquet column names are case-sensitive unlike Hive, which converts all column names to lowercase.
-
-
-
Method Detail
-
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>,RichColumnDescriptor> getDescriptors(org.apache.parquet.schema.MessageType fileSchema, org.apache.parquet.schema.MessageType requestedSchema)
-
getDescriptor
public static Optional<RichColumnDescriptor> 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(RichColumnDescriptor descriptor)
-
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
-
getShortDecimalValue
public static long getShortDecimalValue(byte[] bytes)
-
getShortDecimalValue
public static long getShortDecimalValue(byte[] bytes, int startOffset, int length)
-
getLongDecimalValue
public static io.airlift.slice.Slice getLongDecimalValue(byte[] bytes)
-
-