当前位置: 首页>>代码示例>>Java>>正文


Java Table.getPartitionKeys方法代码示例

本文整理汇总了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();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:23,代码来源:HiveTable.java

示例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;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:DatasetBuilder.java

示例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);
  }
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:29,代码来源:HiveEndpoint.java

示例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;
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:14,代码来源:ConvertHiveParquetScanToDrillParquetScan.java


注:本文中的org.apache.hadoop.hive.metastore.api.Table.getPartitionKeys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。