Package io.trino.parquet
Class ParquetTypeUtils
java.lang.Object
io.trino.parquet.ParquetTypeUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckBytesFitInShortDecimal(byte[] bytes, int offset, int length, org.apache.parquet.column.ColumnDescriptor descriptor) constructField(Type type, org.apache.parquet.io.ColumnIO columnIO) static Optional<DecimalType>createDecimalType(PrimitiveField field) 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<org.apache.parquet.column.ColumnDescriptor>getDescriptor(List<org.apache.parquet.io.PrimitiveColumnIO> columns, List<String> path) getDescriptors(org.apache.parquet.schema.MessageType fileSchema, org.apache.parquet.schema.MessageType requestedSchema) 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 booleanisOptionalFieldValueNull(int definitionLevel, int maxDefinitionLevel) 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.static byte[]paddingBigInteger(BigInteger bigInteger, int numBytes)
-
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
-
getDescriptor
-
getParquetEncoding
-
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
-
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
-
constructField
-