本文整理了Java中org.apache.hadoop.hive.metastore.api.Partition.setValues()
方法的一些代码示例,展示了Partition.setValues()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Partition.setValues()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Partition
类名称:Partition
方法名:setValues
暂无
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testRenamePartitionTargetAlreadyExisting() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
client.renamePartition(DB_NAME, TABLE_NAME, oldValues.get(3), oldParts.get(2));
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testAlterPartitionsChangeValues() throws Exception {
createTable4PartColsParts(client);
List<Partition> partitions = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition p = partitions.get(3);
p.setValues(Lists.newArrayList("1", "2", "3"));
client.alter_partitions(DB_NAME, TABLE_NAME, Lists.newArrayList(p));
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testRenamePartitionBogusCatalogName() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
client.renamePartition("nosuch", DB_NAME, TABLE_NAME, oldValues.get(3), partToRename, null);
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testRenamePartitionNoDbName() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
client.renamePartition("", TABLE_NAME, oldValues.get(3), partToRename);
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testRenamePartitionNoTblName() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
client.renamePartition(DB_NAME, "", oldValues.get(3), partToRename);
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testRenamePartitionEmptyOldPartList() throws Exception {
createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
client.renamePartition(DB_NAME, TABLE_NAME, Lists.newArrayList(), partToRename);
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testRenamePartitionNoSuchOldPartition() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
client.renamePartition(DB_NAME, TABLE_NAME, Lists.newArrayList("1", "2", ""), partToRename);
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testAlterPartitionsWithEnvironmentCtxChangeValues() throws Exception {
createTable4PartColsParts(client);
List<Partition> partitions = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition p = partitions.get(3);
p.setValues(Lists.newArrayList("1", "2", "3"));
client.alter_partitions(DB_NAME, TABLE_NAME, Lists.newArrayList(p), new EnvironmentContext());
}
代码示例来源:origin: apache/hive
@Test
public void testRenamePartitionNullTblName() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
try {
client.renamePartition(DB_NAME, null, oldValues.get(3), partToRename);
Assert.fail("should throw");
} catch (MetaException | TProtocolException ex) {
}
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testAlterPartitionChangeValues() throws Exception {
createTable4PartColsParts(client);
List<Partition> partitions = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partition = partitions.get(3);
partition.setValues(Lists.newArrayList("1", "2", "3"));
client.alter_partition(DB_NAME, TABLE_NAME, partition);
}
代码示例来源:origin: apache/hive
@Test(expected = MetaException.class)
public void testRenamePartitionChangeTblName() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
partToRename.setTableName(TABLE_NAME + "_2");
client.renamePartition(DB_NAME, TABLE_NAME, oldValues.get(3), partToRename);
}
代码示例来源:origin: apache/hive
@Test(expected = MetaException.class)
public void testRenamePartitionNullTableInPartition() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
partToRename.setTableName(null);
client.renamePartition(DB_NAME, TABLE_NAME, Lists.newArrayList("2017", "11", "27"),
partToRename);
}
代码示例来源:origin: apache/hive
@Test(expected = MetaException.class)
public void testRenamePartitionNullDbInPartition() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
partToRename.setDbName(null);
client.renamePartition(DB_NAME, TABLE_NAME, Lists.newArrayList("2017", "11", "27"),
partToRename);
}
代码示例来源:origin: apache/hive
@Test(expected = MetaException.class)
public void testRenamePartitionChangeDbName() throws Exception {
List<List<String>> oldValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partToRename = oldParts.get(3);
partToRename.setValues(Lists.newArrayList("2018", "01", "16"));
partToRename.setDbName(DB_NAME + "_2");
client.renamePartition(DB_NAME, TABLE_NAME, oldValues.get(3), partToRename);
}
代码示例来源:origin: apache/hive
@Test(expected = MetaException.class)
public void testAddPartitionSpecNullValues() throws Exception {
createTable();
Partition partition = buildPartition(DB_NAME, TABLE_NAME, null);
partition.setValues(null);
PartitionSpecProxy partitionSpecProxy =
buildPartitionSpec(DB_NAME, TABLE_NAME, null, Lists.newArrayList(partition));
client.add_partitions_pspec(partitionSpecProxy);
}
代码示例来源: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
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/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);
}
代码示例来源:origin: apache/hive
private void addPartition(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<String, String>());
part.setSd(table.getSd().deepCopy());
part.getSd().setSerdeInfo(table.getSd().getSerdeInfo());
part.getSd().setLocation(table.getSd().getLocation() + location);
client.add_partition(part);
}
}
内容来源于网络,如有侵权,请联系作者删除!