Java Code Examples for org.apache.hadoop.hive.metastore.api.Partition#getTableName()

The following examples show how to use org.apache.hadoop.hive.metastore.api.Partition#getTableName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SentryMetastorePostEventListener.java    From incubator-sentry with Apache License 2.0 6 votes vote down vote up
@Override
public void onAddPartition(AddPartitionEvent partitionEvent)
    throws MetaException {

  // don't sync path if the operation has failed
  if (!partitionEvent.getStatus()) {
    LOGGER.debug("Skip syncing path with Sentry server for onAddPartition event," +
      " since the operation failed. \n");
    return;
  }

  for (Partition part : partitionEvent.getPartitions()) {
    if (part.getSd() != null && part.getSd().getLocation() != null) {
      String authzObj = part.getDbName() + "." + part.getTableName();
      String path = part.getSd().getLocation();
      for (SentryMetastoreListenerPlugin plugin : sentryPlugins) {
        plugin.addPath(authzObj, path);
      }
    }
  }
  super.onAddPartition(partitionEvent);
}
 
Example 2
Source File: SentryMetastorePostEventListenerV2.java    From incubator-sentry with Apache License 2.0 6 votes vote down vote up
@Override
public void onAddPartition(AddPartitionEvent partitionEvent)
    throws MetaException {
  if (partitionEvent != null && partitionEvent.getPartitionIterator() != null) {
    Iterator<Partition> it = partitionEvent.getPartitionIterator();
    while (it.hasNext()) {
      Partition part = it.next();
      if (part.getSd() != null && part.getSd().getLocation() != null) {
        String authzObj = part.getDbName() + "." + part.getTableName();
        String path = part.getSd().getLocation();
        for (SentryMetastoreListenerPlugin plugin : sentryPlugins) {
          plugin.addPath(authzObj, path);
        }
      }
    }
  }
}
 
Example 3
Source File: HiveStatsUtil.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create columnStatistics from the given Hive column stats of a hive partition.
 */
public static ColumnStatistics createPartitionColumnStats(
		Partition hivePartition,
		String partName,
		Map<String, CatalogColumnStatisticsDataBase> colStats) {
	ColumnStatisticsDesc desc = new ColumnStatisticsDesc(false, hivePartition.getDbName(), hivePartition.getTableName());
	desc.setPartName(partName);
	return createHiveColumnStatistics(colStats, hivePartition.getSd(), desc);
}
 
Example 4
Source File: ReplicaTableFactory.java    From circus-train with Apache License 2.0 5 votes vote down vote up
ColumnStatistics newReplicaPartitionStatistics(
    Table replicaTable,
    Partition replicaPartition,
    ColumnStatistics sourcePartitionStatistics) {
  ColumnStatisticsDesc statisticsDesc = new ColumnStatisticsDesc(false, replicaPartition.getDbName(),
      replicaPartition.getTableName());
  try {
    statisticsDesc.setPartName(Warehouse.makePartName(replicaTable.getPartitionKeys(), replicaPartition.getValues()));
  } catch (MetaException e) {
    throw new RuntimeException(e);
  }

  return columnStatisticsTransformation
      .transform(new ColumnStatistics(statisticsDesc, sourcePartitionStatistics.getStatsObj()));
}
 
Example 5
Source File: HiveStatsUtil.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create columnStatistics from the given Hive column stats of a hive partition.
 */
public static ColumnStatistics createPartitionColumnStats(
		Partition hivePartition,
		String partName,
		Map<String, CatalogColumnStatisticsDataBase> colStats,
		String hiveVersion) {
	ColumnStatisticsDesc desc = new ColumnStatisticsDesc(false, hivePartition.getDbName(), hivePartition.getTableName());
	desc.setPartName(partName);
	return createHiveColumnStatistics(colStats, hivePartition.getSd(), desc, hiveVersion);
}
 
Example 6
Source File: HiveDifferences.java    From circus-train with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
static PartitionAndMetadata sourcePartitionToPartitionAndMetadata(Partition sourcePartition) {
  return new PartitionAndMetadata(sourcePartition.getDbName() + "." + sourcePartition.getTableName(),
      normaliseLocation(sourcePartition.getSd().getLocation()), sourcePartition);
}
 
Example 7
Source File: TestUtils.java    From circus-train with Apache License 2.0 4 votes vote down vote up
public static PartitionAndMetadata newPartitionAndMetadata(String database, String tableName, String partitionValue) {
  Partition partition = newPartition(database, tableName, partitionValue);
  return new PartitionAndMetadata(partition.getDbName() + "." + partition.getTableName(),
      partition.getSd().getLocation(), partition);
}