本文整理了Java中org.apache.hadoop.hive.metastore.api.Table.setCreationMetadata()
方法的一些代码示例,展示了Table.setCreationMetadata()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.setCreationMetadata()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Table
类名称:Table
方法名:setCreationMetadata
暂无
代码示例来源:origin: apache/hive
/**
* @param creationMetadata
* the creation metadata (only for materialized views)
*/
public void setCreationMetadata(CreationMetadata creationMetadata) {
tTable.setCreationMetadata(creationMetadata);
}
代码示例来源:origin: apache/hive
tbl.setCreationMetadata(
convertToCreationMetadata(
getCreationMetadata(tbl.getCatName(), tbl.getDbName(), tbl.getTableName())));
代码示例来源:origin: apache/hive
public Table build(Configuration conf) throws MetaException {
if (tableName == null) {
throw new MetaException("You must set the table name");
}
if (ownerType == null) {
ownerType = PrincipalType.USER;
}
if (owner == null) {
try {
owner = SecurityUtils.getUser();
} catch (IOException e) {
throw MetaStoreUtils.newMetaException(e);
}
}
if (catName == null) catName = MetaStoreUtils.getDefaultCatalog(conf);
Table t = new Table(tableName, dbName, owner, createTime, lastAccessTime, retention, buildSd(),
partCols, tableParams, viewOriginalText, viewExpandedText, type);
if (rewriteEnabled) t.setRewriteEnabled(true);
if (temporary) t.setTemporary(temporary);
t.setCatName(catName);
if (!mvReferencedTables.isEmpty()) {
CreationMetadata cm = new CreationMetadata(catName, dbName, tableName, mvReferencedTables);
if (mvValidTxnList != null) cm.setValidTxnList(mvValidTxnList);
t.setCreationMetadata(cm);
}
return t;
}
代码示例来源:origin: apache/hive
tbl.setCreationMetadata(
convertToCreationMetadata(getCreationMetadata(catName, dbName, tableName)));
代码示例来源:origin: apache/hive
private Table createTable(String dbName, String tableName, TableType type)
throws Exception {
TableBuilder builder = new TableBuilder()
.setCatName("hive")
.setDbName(dbName)
.setTableName(tableName)
.addCol("id", "int")
.addCol("name", "string")
.setType(type.name());
Table table = builder.build(metaStore.getConf());
if (type == TableType.MATERIALIZED_VIEW) {
CreationMetadata cm = new CreationMetadata(
MetaStoreUtils.getDefaultCatalog(metaStore.getConf()), dbName, tableName, ImmutableSet.of());
table.setCreationMetadata(cm);
}
if (type == TableType.EXTERNAL_TABLE) {
table.getParameters().put("EXTERNAL", "true");
}
return table;
}
代码示例来源:origin: apache/hive
@Test
public void testAlterTable() throws Exception {
Table originalTable = testTables[2];
String originalTableName = originalTable.getTableName();
String originalDatabase = originalTable.getDbName();
Table newTable = getTableWithAllParametersSet();
newTable.setTableName(originalTableName);
newTable.setDbName(originalDatabase);
// Partition keys can not be set, but getTableWithAllParametersSet is added one, so remove for
// this test
newTable.setPartitionKeys(originalTable.getPartitionKeys());
client.alter_table(originalDatabase, originalTableName, newTable);
Table alteredTable = client.getTable(originalDatabase, originalTableName);
// The extra parameters will be added on server side, so check that the required ones are
// present
for(String key: newTable.getParameters().keySet()) {
Assert.assertEquals("parameters are present", newTable.getParameters().get(key),
alteredTable.getParameters().get(key));
}
// The parameters are checked manually, so do not check them
newTable.setParameters(alteredTable.getParameters());
// Some of the data is set on the server side, so reset those
newTable.setCreateTime(alteredTable.getCreateTime());
newTable.setCreationMetadata(alteredTable.getCreationMetadata());
newTable.setWriteId(alteredTable.getWriteId());
Assert.assertTrue(alteredTable.isSetId());
alteredTable.unsetId();
Assert.assertEquals("The table data should be the same", newTable, alteredTable);
}
代码示例来源:origin: apache/hive
table.setCreationMetadata(createdTable.getCreationMetadata());
table.setWriteId(createdTable.getWriteId());
代码示例来源:origin: apache/hive
tbl.getTableName(), ImmutableSet.copyOf(crtView.getTablesUsed()));
cm.setValidTxnList(conf.get(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY));
tbl.getTTable().setCreationMetadata(cm);
代码示例来源:origin: apache/hive
unsetCreationMetadata();
} else {
setCreationMetadata((CreationMetadata)value);
代码示例来源:origin: org.apache.hive/hive-standalone-metastore
@Override
public Table getTable(String catName, String dbName, String tableName) throws MetaException {
boolean commited = false;
Table tbl = null;
try {
openTransaction();
tbl = convertToTable(getMTable(catName, dbName, tableName));
// Retrieve creation metadata if needed
if (tbl != null && TableType.MATERIALIZED_VIEW.toString().equals(tbl.getTableType())) {
tbl.setCreationMetadata(
convertToCreationMetadata(getCreationMetadata(catName, dbName, tableName)));
}
commited = commitTransaction();
} finally {
if (!commited) {
rollbackTransaction();
}
}
return tbl;
}
代码示例来源:origin: org.apache.hive/hive-standalone-metastore
tbl.setCreationMetadata(
convertToCreationMetadata(
getCreationMetadata(tbl.getCatName(), tbl.getDbName(), tbl.getTableName())));
代码示例来源:origin: org.apache.hive/hive-standalone-metastore
public Table build(Configuration conf) throws MetaException {
if (tableName == null) {
throw new MetaException("You must set the table name");
}
if (owner == null) {
try {
owner = SecurityUtils.getUser();
} catch (IOException e) {
throw MetaStoreUtils.newMetaException(e);
}
}
if (catName == null) catName = MetaStoreUtils.getDefaultCatalog(conf);
Table t = new Table(tableName, dbName, owner, createTime, lastAccessTime, retention, buildSd(),
partCols, tableParams, viewOriginalText, viewExpandedText, type);
if (rewriteEnabled) t.setRewriteEnabled(true);
if (temporary) t.setTemporary(temporary);
t.setCatName(catName);
if (!mvReferencedTables.isEmpty()) {
CreationMetadata cm = new CreationMetadata(catName, dbName, tableName, mvReferencedTables);
if (mvValidTxnList != null) cm.setValidTxnList(mvValidTxnList);
t.setCreationMetadata(cm);
}
return t;
}
代码示例来源:origin: org.apache.hive/hive-standalone-metastore
unsetCreationMetadata();
} else {
setCreationMetadata((CreationMetadata)value);
内容来源于网络,如有侵权,请联系作者删除!