Package io.trino.plugin.hive.util
Class HiveUtil
- java.lang.Object
-
- io.trino.plugin.hive.util.HiveUtil
-
public final class HiveUtil extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringDELTA_LAKE_PROVIDERstatic StringSPARK_TABLE_PROVIDER_KEY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longbigintPartitionKey(String value, String name)static booleanbooleanPartitionKey(String value, String name)static io.airlift.slice.SlicecharPartitionKey(String value, String name, Type columnType)static voidcheckCondition(boolean condition, ErrorCodeSupplier errorCode, String formatString, Object... args)static voidcloseWithSuppression(RecordCursor recordCursor, Throwable throwable)static StringcolumnExtraInfo(boolean partitionKey)static org.apache.hadoop.mapred.RecordReader<?,?>createRecordReader(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path path, long start, long length, Properties schema, List<HiveColumnHandle> columns)static longdatePartitionKey(String value, String name)static doubledoublePartitionKey(String value, String name)static List<HiveType>extractStructFieldTypes(HiveType hiveType)static longfloatPartitionKey(String value, String name)static List<String>getColumnNames(Properties schema)static List<HiveType>getColumnTypes(Properties schema)static Optional<org.apache.hadoop.io.compress.CompressionCodec>getCompressionCodec(org.apache.hadoop.mapred.TextInputFormat inputFormat, org.apache.hadoop.fs.Path file)static Optional<DecimalType>getDecimalType(HiveType hiveType)static Optional<DecimalType>getDecimalType(String hiveTypeName)static org.apache.hadoop.hive.serde2.DeserializergetDeserializer(org.apache.hadoop.conf.Configuration configuration, Properties schema)static StringgetDeserializerClassName(Properties schema)static intgetFooterCount(Properties schema)static intgetHeaderCount(Properties schema)static org.apache.hadoop.mapred.InputFormat<?,?>getInputFormat(org.apache.hadoop.conf.Configuration configuration, Properties schema, boolean symlinkTarget)static StringgetInputFormatName(Properties schema)static OrcWriterOptionsgetOrcWriterOptions(Properties schema, OrcWriterOptions orcWriterOptions)static List<HiveColumnHandle>getPartitionKeyColumnHandles(Table table, TypeManager typeManager)static StringgetPrefilledColumnValue(HiveColumnHandle columnHandle, HivePartitionKey partitionKey, org.apache.hadoop.fs.Path path, OptionalInt bucketNumber, long fileSize, long fileModifiedTime, String partitionName)static List<HiveColumnHandle>getRegularColumnHandles(Table table, TypeManager typeManager, HiveTimestampPrecision timestampPrecision)static org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspectorgetTableObjectInspector(org.apache.hadoop.hive.serde2.Deserializer deserializer)static List<HiveColumnHandle>hiveColumnHandles(Table table, TypeManager typeManager, HiveTimestampPrecision timestampPrecision)static longintegerPartitionKey(String value, String name)static booleanisArrayType(Type type)static booleanisDeltaLakeTable(Table table)static booleanisDeserializerClass(Properties schema, Class<?> deserializerClass)static booleanisHiveNull(byte[] bytes)static booleanisHiveSystemSchema(String schemaName)static booleanisIcebergTable(Table table)static booleanisMapType(Type type)static booleanisRowType(Type type)static booleanisSplittable(org.apache.hadoop.mapred.InputFormat<?,?> inputFormat, org.apache.hadoop.fs.FileSystem fileSystem, org.apache.hadoop.fs.Path path)static booleanisStructuralType(HiveType hiveType)static booleanisStructuralType(Type type)static io.airlift.slice.SlicelongDecimalPartitionKey(String value, DecimalType type, String name)static longparseHiveDate(String value)static longparseHiveTimestamp(String value)static NullableValueparsePartitionValue(String partitionName, String value, Type type)static voidsetReadColumns(org.apache.hadoop.conf.Configuration configuration, List<Integer> readHiveColumnIndexes)static longshortDecimalPartitionKey(String value, DecimalType type, String name)static longsmallintPartitionKey(String value, String name)static SortingColumnsortingColumnFromString(String name)static StringsortingColumnToString(SortingColumn column)static longtimestampPartitionKey(String value, String name)static longtinyintPartitionKey(String value, String name)static List<String>toPartitionValues(String partitionName)static io.airlift.slice.SlicevarcharPartitionKey(String value, String name, Type columnType)static voidverifyPartitionTypeSupported(String partitionName, Type type)
-
-
-
Field Detail
-
SPARK_TABLE_PROVIDER_KEY
public static final String SPARK_TABLE_PROVIDER_KEY
- See Also:
- Constant Field Values
-
DELTA_LAKE_PROVIDER
public static final String DELTA_LAKE_PROVIDER
- See Also:
- Constant Field Values
-
-
Method Detail
-
createRecordReader
public static org.apache.hadoop.mapred.RecordReader<?,?> createRecordReader(org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.fs.Path path, long start, long length, Properties schema, List<HiveColumnHandle> columns)
-
setReadColumns
public static void setReadColumns(org.apache.hadoop.conf.Configuration configuration, List<Integer> readHiveColumnIndexes)
-
getCompressionCodec
public static Optional<org.apache.hadoop.io.compress.CompressionCodec> getCompressionCodec(org.apache.hadoop.mapred.TextInputFormat inputFormat, org.apache.hadoop.fs.Path file)
-
getInputFormat
public static org.apache.hadoop.mapred.InputFormat<?,?> getInputFormat(org.apache.hadoop.conf.Configuration configuration, Properties schema, boolean symlinkTarget)
-
getInputFormatName
public static String getInputFormatName(Properties schema)
-
parseHiveDate
public static long parseHiveDate(String value)
-
parseHiveTimestamp
public static long parseHiveTimestamp(String value)
-
isSplittable
public static boolean isSplittable(org.apache.hadoop.mapred.InputFormat<?,?> inputFormat, org.apache.hadoop.fs.FileSystem fileSystem, org.apache.hadoop.fs.Path path)
-
getTableObjectInspector
public static org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector getTableObjectInspector(org.apache.hadoop.hive.serde2.Deserializer deserializer)
-
isDeserializerClass
public static boolean isDeserializerClass(Properties schema, Class<?> deserializerClass)
-
getDeserializerClassName
public static String getDeserializerClassName(Properties schema)
-
getDeserializer
public static org.apache.hadoop.hive.serde2.Deserializer getDeserializer(org.apache.hadoop.conf.Configuration configuration, Properties schema)
-
isHiveNull
public static boolean isHiveNull(byte[] bytes)
-
verifyPartitionTypeSupported
public static void verifyPartitionTypeSupported(String partitionName, Type type)
-
parsePartitionValue
public static NullableValue parsePartitionValue(String partitionName, String value, Type type)
-
getDecimalType
public static Optional<DecimalType> getDecimalType(HiveType hiveType)
-
getDecimalType
public static Optional<DecimalType> getDecimalType(String hiveTypeName)
-
isArrayType
public static boolean isArrayType(Type type)
-
isMapType
public static boolean isMapType(Type type)
-
isRowType
public static boolean isRowType(Type type)
-
isStructuralType
public static boolean isStructuralType(Type type)
-
isStructuralType
public static boolean isStructuralType(HiveType hiveType)
-
shortDecimalPartitionKey
public static long shortDecimalPartitionKey(String value, DecimalType type, String name)
-
longDecimalPartitionKey
public static io.airlift.slice.Slice longDecimalPartitionKey(String value, DecimalType type, String name)
-
varcharPartitionKey
public static io.airlift.slice.Slice varcharPartitionKey(String value, String name, Type columnType)
-
charPartitionKey
public static io.airlift.slice.Slice charPartitionKey(String value, String name, Type columnType)
-
hiveColumnHandles
public static List<HiveColumnHandle> hiveColumnHandles(Table table, TypeManager typeManager, HiveTimestampPrecision timestampPrecision)
-
getRegularColumnHandles
public static List<HiveColumnHandle> getRegularColumnHandles(Table table, TypeManager typeManager, HiveTimestampPrecision timestampPrecision)
-
getPartitionKeyColumnHandles
public static List<HiveColumnHandle> getPartitionKeyColumnHandles(Table table, TypeManager typeManager)
-
checkCondition
public static void checkCondition(boolean condition, ErrorCodeSupplier errorCode, String formatString, Object... args)
-
columnExtraInfo
@Nullable public static String columnExtraInfo(boolean partitionKey)
-
getPrefilledColumnValue
public static String getPrefilledColumnValue(HiveColumnHandle columnHandle, HivePartitionKey partitionKey, org.apache.hadoop.fs.Path path, OptionalInt bucketNumber, long fileSize, long fileModifiedTime, String partitionName)
-
closeWithSuppression
public static void closeWithSuppression(RecordCursor recordCursor, Throwable throwable)
-
getHeaderCount
public static int getHeaderCount(Properties schema)
-
getFooterCount
public static int getFooterCount(Properties schema)
-
getColumnNames
public static List<String> getColumnNames(Properties schema)
-
getColumnTypes
public static List<HiveType> getColumnTypes(Properties schema)
-
getOrcWriterOptions
public static OrcWriterOptions getOrcWriterOptions(Properties schema, OrcWriterOptions orcWriterOptions)
-
sortingColumnFromString
public static SortingColumn sortingColumnFromString(String name)
-
sortingColumnToString
public static String sortingColumnToString(SortingColumn column)
-
isHiveSystemSchema
public static boolean isHiveSystemSchema(String schemaName)
-
isDeltaLakeTable
public static boolean isDeltaLakeTable(Table table)
-
isIcebergTable
public static boolean isIcebergTable(Table table)
-
-