本文整理汇总了Java中org.apache.hadoop.hive.metastore.api.Table.getPartitionKeys方法的典型用法代码示例。如果您正苦于以下问题:Java Table.getPartitionKeys方法的具体用法?Java Table.getPartitionKeys怎么用?Java Table.getPartitionKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hive.metastore.api.Table
的用法示例。
在下文中一共展示了Table.getPartitionKeys方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HiveTable
import org.apache.hadoop.hive.metastore.api.Table; //导入方法依赖的package包/类
public HiveTable(Table table) {
if (table == null) {
return;
}
this.table = table;
this.tableName = table.getTableName();
this.dbName = table.getDbName();
this.owner = table.getOwner();
this.createTime = table.getCreateTime();
this.lastAccessTime = table.getLastAccessTime();
this.retention = table.getRetention();
this.sd = new StorageDescriptorWrapper(table.getSd());
this.partitionKeys = Lists.newArrayList();
for (FieldSchema f : table.getPartitionKeys()) {
this.partitionKeys.add(new FieldSchemaWrapper(f));
partitionNameTypeMap.put(f.getName(), f.getType());
}
this.parameters = table.getParameters();
this.viewOriginalText = table.getViewOriginalText();
this.viewExpandedText = table.getViewExpandedText();
this.tableType = table.getTableType();
}
示例2: getPartitions
import org.apache.hadoop.hive.metastore.api.Table; //导入方法依赖的package包/类
private static List<PartitionValue> getPartitions(Table table, Partition partition) {
if(partition == null){
return Collections.emptyList();
}
final List<String> partitionValues = partition.getValues();
final List<PartitionValue> output = Lists.newArrayList();
final List<FieldSchema> partitionKeys = table.getPartitionKeys();
for(int i =0; i < partitionKeys.size(); i++){
PartitionValue value = getPartitionValue(partitionKeys.get(i), partitionValues.get(i));
if(value != null){
output.add(value);
}
}
return output;
}
示例3: getPartitions
import org.apache.hadoop.hive.metastore.api.Table; //导入方法依赖的package包/类
public PartitionsAndStatistics getPartitions(Table table, String partitionPredicate, int maxPartitions)
throws TException {
try (CloseableMetaStoreClient client = metaStoreClientSupplier.get()) {
List<Partition> partitions = null;
if (Strings.isNullOrEmpty(partitionPredicate)) {
partitions = client.listPartitions(table.getDbName(), table.getTableName(), (short) maxPartitions);
} else {
partitions = client.listPartitionsByFilter(table.getDbName(), table.getTableName(), partitionPredicate,
(short) maxPartitions);
}
// Generate a list of partition names
List<String> partitionNames = getPartitionNames(table.getPartitionKeys(), partitions);
// Fetch the partition statistics
List<String> columnNames = getColumnNames(table);
Map<String, List<ColumnStatisticsObj>> statisticsByPartitionName = client
.getPartitionColumnStatistics(table.getDbName(), table.getTableName(), partitionNames, columnNames);
if (statisticsByPartitionName != null && !statisticsByPartitionName.isEmpty()) {
log.debug("Retrieved column stats entries for {} partitions of table {}.{}", statisticsByPartitionName.size(),
table.getDbName(), table.getTableName());
} else {
log.debug("No partition column stats retrieved for table {}.{}", table.getDbName(), table.getTableName());
}
return new PartitionsAndStatistics(table.getPartitionKeys(), partitions, statisticsByPartitionName);
}
}
示例4: getPartitionColMapping
import org.apache.hadoop.hive.metastore.api.Table; //导入方法依赖的package包/类
/**
* Create mapping of Hive partition column to directory column mapping.
*/
private Map<String, String> getPartitionColMapping(final Table hiveTable, final String partitionColumnLabel) {
final Map<String, String> partitionColMapping = Maps.newHashMap();
int i = 0;
for (FieldSchema col : hiveTable.getPartitionKeys()) {
partitionColMapping.put(col.getName(), partitionColumnLabel+i);
i++;
}
return partitionColMapping;
}