org.apache.hadoop.hive.metastore.api.Table.addToPartitionKeys()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(70)

本文整理了Java中org.apache.hadoop.hive.metastore.api.Table.addToPartitionKeys()方法的一些代码示例,展示了Table.addToPartitionKeys()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.addToPartitionKeys()方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Table
类名称:Table
方法名:addToPartitionKeys

Table.addToPartitionKeys介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-gobblin

public Table createTestAvroTable(String dbName, String tableName, String tableSdLoc,
  Optional<String> partitionFieldName, boolean ignoreDbCreation) throws Exception {
 if (!ignoreDbCreation) {
  createTestDb(dbName);
 }
 Table tbl = org.apache.hadoop.hive.ql.metadata.Table.getEmptyTable(dbName, tableName);
 tbl.getSd().setLocation(tableSdLoc);
 tbl.getSd().getSerdeInfo().setSerializationLib(AvroSerDe.class.getName());
 tbl.getSd().getSerdeInfo().setParameters(ImmutableMap.of(HiveAvroSerDeManager.SCHEMA_URL, "/tmp/dummy"));
 if (partitionFieldName.isPresent()) {
  tbl.addToPartitionKeys(new FieldSchema(partitionFieldName.get(), "string", "some comment"));
 }
 this.localMetastoreClient.createTable(tbl);
 return tbl;
}

代码示例来源:origin: apache/hive

@Test(expected = InvalidOperationException.class)
public void testAlterTableInvalidStorageDescriptorAddPartitionColumns() throws Exception {
 Table originalTable = testTables[0];
 Table newTable = originalTable.deepCopy();
 newTable.addToPartitionKeys(new FieldSchema("new_part", "int", "comment"));
 client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable);
}

代码示例来源:origin: apache/incubator-gobblin

public Table createTestAvroTable(String dbName, String tableName, String tableSdLoc,
  List<String> partitionFieldNames, boolean ignoreDbCreation)
  throws Exception {
 if (!ignoreDbCreation) {
  createTestDb(dbName);
 }
 Table tbl = org.apache.hadoop.hive.ql.metadata.Table.getEmptyTable(dbName, tableName);
 tbl.getSd().setLocation(tableSdLoc);
 tbl.getSd().getSerdeInfo().setParameters(ImmutableMap.of(HiveAvroSerDeManager.SCHEMA_URL, "/tmp/dummy"));
 for (String partitionFieldName : partitionFieldNames) {
  tbl.addToPartitionKeys(new FieldSchema(partitionFieldName, "string", "some comment"));
 }
 this.localMetastoreClient.createTable(tbl);
 return tbl;
}

相关文章

微信公众号

最新文章

更多

Table类方法