本文整理了Java中org.apache.hadoop.hive.metastore.api.Partition.<init>()
方法的一些代码示例,展示了Partition.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partition.<init>()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Partition
类名称:Partition
方法名:<init>
[英]Performs a deep copy on other.
[中]在其他计算机上执行深度复制。
代码示例来源:origin: apache/hive
@Override
public Partition exchange_partition(Map<String, String> partitionSpecs,
String sourceDbName, String sourceTableName, String destDbName,
String destTableName) throws TException {
exchange_partitions(partitionSpecs, sourceDbName, sourceTableName, destDbName, destTableName);
// Wouldn't it make more sense to return the first element of the list returned by the
// previous call?
return new Partition();
}
代码示例来源:origin: apache/hive
/**
* Performs a deep copy on <i>other</i>.
*/
public DropPartitionsResult(DropPartitionsResult other) {
if (other.isSetPartitions()) {
List<Partition> __this__partitions = new ArrayList<Partition>(other.partitions.size());
for (Partition other_element : other.partitions) {
__this__partitions.add(new Partition(other_element));
}
this.partitions = __this__partitions;
}
}
代码示例来源:origin: apache/hive
/**
* Performs a deep copy on <i>other</i>.
*/
public PartitionListComposingSpec(PartitionListComposingSpec other) {
if (other.isSetPartitions()) {
List<Partition> __this__partitions = new ArrayList<Partition>(other.partitions.size());
for (Partition other_element : other.partitions) {
__this__partitions.add(new Partition(other_element));
}
this.partitions = __this__partitions;
}
}
代码示例来源:origin: apache/hive
/**
* Performs a deep copy on <i>other</i>.
*/
public GetPartitionsByNamesResult(GetPartitionsByNamesResult other) {
if (other.isSetPartitions()) {
List<Partition> __this__partitions = new ArrayList<Partition>(other.partitions.size());
for (Partition other_element : other.partitions) {
__this__partitions.add(new Partition(other_element));
}
this.partitions = __this__partitions;
}
}
代码示例来源:origin: prestodb/presto
@Override
public Partition getPartition(String dbName, String tableName, List<String> partitionValues)
throws TException
{
accessCount.incrementAndGet();
if (throwException) {
throw new RuntimeException();
}
if (!dbName.equals(TEST_DATABASE) || !tableName.equals(TEST_TABLE) || !ImmutableSet.of(TEST_PARTITION_VALUES1, TEST_PARTITION_VALUES2).contains(partitionValues)) {
throw new NoSuchObjectException();
}
return new Partition(null, TEST_DATABASE, TEST_TABLE, 0, 0, DEFAULT_STORAGE_DESCRIPTOR, ImmutableMap.of());
}
代码示例来源:origin: prestodb/presto
@Override
public List<Partition> getPartitionsByNames(String dbName, String tableName, List<String> names)
throws TException
{
accessCount.incrementAndGet();
if (throwException) {
throw new RuntimeException();
}
if (!dbName.equals(TEST_DATABASE) || !tableName.equals(TEST_TABLE) || !ImmutableSet.of(TEST_PARTITION1, TEST_PARTITION2).containsAll(names)) {
throw new NoSuchObjectException();
}
return Lists.transform(names, name -> {
try {
return new Partition(ImmutableList.copyOf(Warehouse.getPartValuesFromPartName(name)), TEST_DATABASE, TEST_TABLE, 0, 0, DEFAULT_STORAGE_DESCRIPTOR, ImmutableMap.of());
}
catch (MetaException e) {
throw new RuntimeException(e);
}
});
}
代码示例来源:origin: apache/hive
public Object call() {
Partition ptn = new Partition(Arrays.asList(ptnVal), dbNames.get(0), tblName, 0, 0,
tbl.getSd(), partParams);
sharedCache.addPartitionToCache(DEFAULT_CATALOG_NAME, dbNames.get(0), tblName, ptn);
return null;
}
};
代码示例来源:origin: apache/hive
public Object call() {
Partition ptn = new Partition(Arrays.asList(ptnVal), dbNames.get(0), tblName, 0, 0,
tbl.getSd(), partParams);
sharedCache.addPartitionToCache(DEFAULT_CATALOG_NAME, dbNames.get(0), tblName, ptn);
return null;
}
};
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testRenamePartitionNoTable() throws Exception {
client.renamePartition(DB_NAME, TABLE_NAME, Lists.newArrayList("2018", "01", "16"),
new Partition());
}
代码示例来源:origin: apache/hive
public Partition build(Configuration conf) throws MetaException {
if (tableName == null) {
throw new MetaException("table name must be provided");
}
if (values == null) throw new MetaException("You must provide partition values");
if (catName == null) catName = MetaStoreUtils.getDefaultCatalog(conf);
Partition p = new Partition(values, dbName, tableName, createTime, lastAccessTime, buildSd(),
partParams);
p.setCatName(catName);
return p;
}
代码示例来源:origin: apache/hive
/**
* create an empty partition.
* SemanticAnalyzer code requires that an empty partition when the table is not partitioned.
*/
public Partition(Table tbl) throws HiveException {
org.apache.hadoop.hive.metastore.api.Partition tPart =
new org.apache.hadoop.hive.metastore.api.Partition();
if (!tbl.isView()) {
tPart.setSd(tbl.getTTable().getSd().deepCopy());
}
initialize(tbl, tPart);
}
代码示例来源:origin: apache/hive
private static void populatePartitions(HiveMetaStoreClient hmsc, Table table, List<String> blurbs) throws Exception {
for (int i=0; i< nDates; ++i) {
for (String blurb : blurbs) {
StorageDescriptor sd = new StorageDescriptor(table.getSd());
// Add partitions located in the table-directory (i.e. default).
List<String> values = Arrays.asList(datePrefix + i, blurb);
sd.setLocation(getPartitionPath(table, values));
hmsc.add_partition(new Partition(values, dbName, tableName, 0, 0, sd, null));
}
}
}
代码示例来源:origin: prestodb/presto
public static org.apache.hadoop.hive.metastore.api.Partition toMetastoreApiPartition(Partition partition)
{
org.apache.hadoop.hive.metastore.api.Partition result = new org.apache.hadoop.hive.metastore.api.Partition();
result.setDbName(partition.getDatabaseName());
result.setTableName(partition.getTableName());
result.setValues(partition.getValues());
result.setSd(makeStorageDescriptor(partition.getTableName(), partition.getColumns(), partition.getStorage()));
result.setParameters(partition.getParameters());
return result;
}
代码示例来源:origin: apache/hive
@Test
public void testExchangePartitionYearSet() throws Exception {
Map<String, String> partitionSpecs = getPartitionSpec(Lists.newArrayList("2017", "", ""));
Partition exchangedPartition =
client.exchange_partition(partitionSpecs, sourceTable.getDbName(),
sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName());
Assert.assertEquals(new Partition(), exchangedPartition);
checkExchangedPartitions(sourceTable, destTable,
Lists.newArrayList(partitions[0], partitions[1], partitions[2], partitions[3]));
checkRemainingPartitions(sourceTable, destTable, Lists.newArrayList(partitions[4]));
}
代码示例来源:origin: apache/hive
private Partition convertToPart(String catName, String dbName, String tblName, MPartition mpart)
throws MetaException {
if (mpart == null) {
return null;
}
Partition p = new Partition(convertList(mpart.getValues()), dbName, tblName,
mpart.getCreateTime(), mpart.getLastAccessTime(),
convertToStorageDescriptor(mpart.getSd(), false), convertMap(mpart.getParameters()));
p.setCatName(catName);
p.setWriteId(mpart.getWriteId());
return p;
}
代码示例来源:origin: apache/hive
private static Partition createPtn(Table t, List<String> pvals) {
Partition ptn = new Partition();
ptn.setDbName(t.getDbName());
ptn.setTableName(t.getTableName());
ptn.setValues(pvals);
return ptn;
}
代码示例来源:origin: apache/hive
@Test
public void isFastStatsSameWithNullPartitions() {
Partition partition = new Partition();
assertFalse(MetaStoreServerUtils.isFastStatsSame(null, null));
assertFalse(MetaStoreServerUtils.isFastStatsSame(null, partition));
assertFalse(MetaStoreServerUtils.isFastStatsSame(partition, null));
}
代码示例来源:origin: apache/hive
protected Partition newPartition(Table t, String value, List<Order> sortCols) throws Exception {
Partition part = new Partition();
part.addToValues(value);
part.setDbName(t.getDbName());
part.setTableName(t.getTableName());
part.setSd(newStorageDescriptor(getLocation(t.getTableName(), value), sortCols));
part.setParameters(new HashMap<String, String>());
ms.add_partition(part);
return part;
}
代码示例来源:origin: apache/storm
private static void addPartition(IMetaStoreClient client, Table tbl
, List<String> partValues)
throws IOException, TException {
Partition part = new Partition();
part.setDbName(tbl.getDbName());
part.setTableName(tbl.getTableName());
StorageDescriptor sd = new StorageDescriptor(tbl.getSd());
sd.setLocation(sd.getLocation() + Path.SEPARATOR + makePartPath(tbl.getPartitionKeys(), partValues));
part.setSd(sd);
part.setValues(partValues);
client.add_partition(part);
}
代码示例来源:origin: apache/hive
private void add_partition(HiveMetaStoreClient client, Table table,
List<String> vals, String location) throws TException {
Partition part = new Partition();
part.setDbName(table.getDbName());
part.setTableName(table.getTableName());
part.setValues(vals);
part.setParameters(new HashMap<>());
part.setSd(table.getSd().deepCopy());
part.getSd().setSerdeInfo(table.getSd().getSerdeInfo());
part.getSd().setLocation(table.getSd().getLocation() + location);
client.add_partition(part);
}
内容来源于网络,如有侵权,请联系作者删除!