public class HivePartitionUtils extends Object
Constructor and Description |
---|
HivePartitionUtils() |
Modifier and Type | Method and Description |
---|---|
static CatalogPartitionSpec |
createPartitionSpec(String hivePartitionName,
String defaultPartitionName)
Creates a
CatalogPartitionSpec from a Hive partition name string. |
static List<HiveTablePartition> |
deserializeHiveTablePartition(List<byte[]> partitionBytes) |
static List<HiveTablePartition> |
getAllPartitions(org.apache.hadoop.mapred.JobConf jobConf,
String hiveVersion,
ObjectPath tablePath,
List<String> partitionColNames,
List<Map<String,String>> remainingPartitions)
Returns all HiveTablePartitions of a hive table, returns single HiveTablePartition if the
hive table is not partitioned.
|
static org.apache.hadoop.fs.FileStatus[] |
getFileStatusRecurse(org.apache.hadoop.fs.Path path,
int expectLevel,
org.apache.hadoop.fs.FileSystem fs) |
static List<String> |
getPartitionNames(List<Map<String,String>> partitionsSpec,
List<String> partitionColNames,
String defaultStr)
Get the partitions' name by partitions' spec.
|
static Map<String,Object> |
parsePartitionValues(Map<String,String> partitionSpecs,
String[] fieldNames,
DataType[] fieldTypes,
String defaultPartitionName,
HiveShim shim)
Parse partition string specs into object values.
|
static List<String> |
partitionSpecToValues(Map<String,String> spec,
List<String> partitionColNames) |
static Object |
restorePartitionValueFromType(HiveShim shim,
String valStr,
LogicalType partitionType,
String defaultPartitionName) |
static List<byte[]> |
serializeHiveTablePartition(List<HiveTablePartition> hiveTablePartitions) |
static HiveTablePartition |
toHiveTablePartition(List<String> partitionKeys,
Properties tableProps,
org.apache.hadoop.hive.metastore.api.Partition partition) |
public static Map<String,Object> parsePartitionValues(Map<String,String> partitionSpecs, String[] fieldNames, DataType[] fieldTypes, String defaultPartitionName, HiveShim shim)
public static Object restorePartitionValueFromType(HiveShim shim, String valStr, LogicalType partitionType, String defaultPartitionName)
public static List<HiveTablePartition> getAllPartitions(org.apache.hadoop.mapred.JobConf jobConf, String hiveVersion, ObjectPath tablePath, List<String> partitionColNames, List<Map<String,String>> remainingPartitions)
public static List<String> getPartitionNames(List<Map<String,String>> partitionsSpec, List<String> partitionColNames, String defaultStr)
partitionsSpec
- a list contains the spec of the partitions, one of which is for one
partition. The map for the spec of partition can be unordered.partitionColNames
- the partition column's namedefaultStr
- the default value used to make partition name when the key or value for the
partition's spec partition column in the spec is null or empty string.public static CatalogPartitionSpec createPartitionSpec(String hivePartitionName, String defaultPartitionName)
CatalogPartitionSpec
from a Hive partition name string. Example of Hive
partition name string - "name=bob/year=2019". If the partition name for the given partition
column is equal to , the partition value in returned CatalogPartitionSpec
will be null.public static List<String> partitionSpecToValues(Map<String,String> spec, List<String> partitionColNames)
public static HiveTablePartition toHiveTablePartition(List<String> partitionKeys, Properties tableProps, org.apache.hadoop.hive.metastore.api.Partition partition)
public static org.apache.hadoop.fs.FileStatus[] getFileStatusRecurse(org.apache.hadoop.fs.Path path, int expectLevel, org.apache.hadoop.fs.FileSystem fs)
public static List<byte[]> serializeHiveTablePartition(List<HiveTablePartition> hiveTablePartitions)
public static List<HiveTablePartition> deserializeHiveTablePartition(List<byte[]> partitionBytes)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.