本文整理汇总了Java中org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc.setPartName方法的典型用法代码示例。如果您正苦于以下问题:Java ColumnStatisticsDesc.setPartName方法的具体用法?Java ColumnStatisticsDesc.setPartName怎么用?Java ColumnStatisticsDesc.setPartName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc
的用法示例。
在下文中一共展示了ColumnStatisticsDesc.setPartName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: typical
import org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc; //导入方法依赖的package包/类
@Test
public void typical() throws Exception {
List<FieldSchema> partitionKeys = Lists.newArrayList(newFieldSchema("a"), newFieldSchema("c"));
Table table = newTable("t1", "db1", partitionKeys, newStorageDescriptor(new File("bla"), "col1"));
List<Partition> partitions = Lists.newArrayList(newPartition(table, "b", "d"));
statisticsPerPartitionName.put("a=b/c=d", columnStats);
PartitionsAndStatistics partitionsAndStatistics = new PartitionsAndStatistics(partitionKeys, partitions,
statisticsPerPartitionName);
List<String> expectedName = Lists.newArrayList("a=b/c=d");
assertThat(partitionsAndStatistics.getPartitionNames(), is(expectedName));
assertThat(partitionsAndStatistics.getPartitions(), is(partitions));
ColumnStatisticsDesc statsDesc = new ColumnStatisticsDesc(false, "db1", "t1");
statsDesc.setPartName("a=b/c=d");
ColumnStatistics expectedStats = new ColumnStatistics(statsDesc, columnStats);
assertThat(partitionsAndStatistics.getStatisticsForPartition(partitions.get(0)), is(expectedStats));
}
示例2: newPartitionStatistics
import org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc; //导入方法依赖的package包/类
private ColumnStatistics newPartitionStatistics(String... values) {
ColumnStatisticsObj columnStatisticsObj1 = new ColumnStatisticsObj(COLUMN_A, "string",
new ColumnStatisticsData(_Fields.LONG_STATS, new LongColumnStatsData(0, 1)));
ColumnStatisticsObj columnStatisticsObj2 = new ColumnStatisticsObj(COLUMN_B, "string",
new ColumnStatisticsData(_Fields.LONG_STATS, new LongColumnStatsData(1, 2)));
List<ColumnStatisticsObj> columnStatisticsObjs = Arrays.asList(columnStatisticsObj1, columnStatisticsObj2);
ColumnStatisticsDesc statsDesc = new ColumnStatisticsDesc(false, DB_NAME, TABLE_NAME);
statsDesc.setPartName(partitionName(values));
return new ColumnStatistics(statsDesc, columnStatisticsObjs);
}
示例3: transform
import org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc; //导入方法依赖的package包/类
@Override
public ColumnStatistics transform(ColumnStatistics columnStatistics) {
ColumnStatisticsDesc statsDesc = new ColumnStatisticsDesc(false, "new_db", "new_table");
statsDesc.setPartName("part=newPart");
columnStatistics.setStatsDesc(statsDesc);
return columnStatistics;
}
示例4: newReplicaPartitionStatisticsWithTransformation
import org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc; //导入方法依赖的package包/类
@Test
public void newReplicaPartitionStatisticsWithTransformation() throws MetaException {
sourceTable.setPartitionKeys(
Arrays.asList(new FieldSchema("one", "string", null), new FieldSchema("two", "string", null)));
Partition replicaPartition = new Partition(sourcePartition);
replicaPartition.setDbName(MAPPED_DB_NAME);
replicaPartition.setTableName(MAPPED_TABLE_NAME);
replicaPartition.setValues(Arrays.asList("A", "B"));
ColumnStatisticsObj columnStatisticsObj1 = new ColumnStatisticsObj();
ColumnStatisticsObj columnStatisticsObj2 = new ColumnStatisticsObj();
List<ColumnStatisticsObj> columnStatisticsObjs = Arrays.asList(columnStatisticsObj1, columnStatisticsObj2);
ColumnStatisticsDesc columnStatisticsDesc = new ColumnStatisticsDesc(false, DB_NAME, TABLE_NAME);
columnStatisticsDesc
.setPartName(Warehouse.makePartName(sourceTable.getPartitionKeys(), replicaPartition.getValues()));
ColumnStatistics sourcePartitionStatistics = new ColumnStatistics(columnStatisticsDesc, columnStatisticsObjs);
ReplicaTableFactory factory = new ReplicaTableFactory(SOURCE_META_STORE_URIS, TableTransformation.IDENTITY,
PartitionTransformation.IDENTITY, COLUMN_STATISTICS_TRANSFORMATION);
ColumnStatistics replicaPartitionStatistics = factory.newReplicaPartitionStatistics(sourceTable, replicaPartition,
sourcePartitionStatistics);
assertThat(replicaPartitionStatistics.getStatsDesc().getDbName(), is("new_db"));
assertThat(replicaPartitionStatistics.getStatsDesc().getTableName(), is("new_table"));
assertThat(replicaPartitionStatistics.getStatsDesc().getPartName(), is("part=newPart"));
assertThat(replicaPartitionStatistics.getStatsObj().size(), is(2));
assertThat(replicaPartitionStatistics.getStatsObj().get(0), is(columnStatisticsObj1));
assertThat(replicaPartitionStatistics.getStatsObj().get(1), is(columnStatisticsObj2));
}
示例5: newReplicaPartitionStatistics
import org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc; //导入方法依赖的package包/类
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()));
}
示例6: newReplicaPartitionStatistics
import org.apache.hadoop.hive.metastore.api.ColumnStatisticsDesc; //导入方法依赖的package包/类
@Test
public void newReplicaPartitionStatistics() throws MetaException {
sourceTable.setPartitionKeys(
Arrays.asList(new FieldSchema("one", "string", null), new FieldSchema("two", "string", null)));
Partition replicaPartition = new Partition(sourcePartition);
replicaPartition.setDbName(MAPPED_DB_NAME);
replicaPartition.setTableName(MAPPED_TABLE_NAME);
replicaPartition.setValues(Arrays.asList("A", "B"));
ColumnStatisticsObj columnStatisticsObj1 = new ColumnStatisticsObj();
ColumnStatisticsObj columnStatisticsObj2 = new ColumnStatisticsObj();
List<ColumnStatisticsObj> columnStatisticsObjs = Arrays.asList(columnStatisticsObj1, columnStatisticsObj2);
ColumnStatisticsDesc columnStatisticsDesc = new ColumnStatisticsDesc(false, DB_NAME, TABLE_NAME);
columnStatisticsDesc
.setPartName(Warehouse.makePartName(sourceTable.getPartitionKeys(), replicaPartition.getValues()));
ColumnStatistics sourcePartitionStatistics = new ColumnStatistics(columnStatisticsDesc, columnStatisticsObjs);
ColumnStatistics replicaPartitionStatistics = factory.newReplicaPartitionStatistics(sourceTable, replicaPartition,
sourcePartitionStatistics);
assertThat(replicaPartitionStatistics.getStatsDesc().getDbName(), is(MAPPED_DB_NAME));
assertThat(replicaPartitionStatistics.getStatsDesc().getTableName(), is(MAPPED_TABLE_NAME));
assertThat(replicaPartitionStatistics.getStatsDesc().getPartName(), is("one=A/two=B"));
assertThat(replicaPartitionStatistics.getStatsObj().size(), is(2));
assertThat(replicaPartitionStatistics.getStatsObj().get(0), is(columnStatisticsObj1));
assertThat(replicaPartitionStatistics.getStatsObj().get(1), is(columnStatisticsObj2));
}