本文整理了Java中org.apache.hadoop.hive.metastore.api.Table.setTableName()
方法的一些代码示例,展示了Table.setTableName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Table.setTableName()
方法的具体详情如下:
包路径:org.apache.hadoop.hive.metastore.api.Table
类名称:Table
方法名:setTableName
暂无
代码示例来源:origin: apache/hive
public void setTableName(String tableName) {
tTable.setTableName(tableName);
}
代码示例来源:origin: prestodb/presto
@Override
public void renameTable(String databaseName, String tableName, String newDatabaseName, String newTableName)
{
Optional<org.apache.hadoop.hive.metastore.api.Table> source = delegate.getTable(databaseName, tableName);
if (!source.isPresent()) {
throw new TableNotFoundException(new SchemaTableName(databaseName, tableName));
}
org.apache.hadoop.hive.metastore.api.Table table = source.get();
table.setDbName(newDatabaseName);
table.setTableName(newTableName);
alterTable(databaseName, tableName, table);
}
代码示例来源:origin: apache/hive
private org.apache.hadoop.hive.metastore.api.Table deepCopyAndLowerCaseTable(
org.apache.hadoop.hive.metastore.api.Table tbl) {
org.apache.hadoop.hive.metastore.api.Table newCopy = deepCopy(tbl);
newCopy.setDbName(newCopy.getDbName().toLowerCase());
newCopy.setTableName(newCopy.getTableName().toLowerCase());
return newCopy;
}
代码示例来源:origin: apache/drill
private org.apache.hadoop.hive.metastore.api.Table deepCopyAndLowerCaseTable(
org.apache.hadoop.hive.metastore.api.Table tbl) {
org.apache.hadoop.hive.metastore.api.Table newCopy = deepCopy(tbl);
newCopy.setDbName(newCopy.getDbName().toLowerCase());
newCopy.setTableName(newCopy.getTableName().toLowerCase());
return newCopy;
}
代码示例来源:origin: apache/hive
private void addTable(String databaseName, String tableName, Set<Table> tables) {
checkNotNullOrEmpty(databaseName);
checkNotNullOrEmpty(tableName);
Table table = new Table();
table.setDbName(databaseName);
table.setTableName(tableName);
tables.add(table);
}
代码示例来源:origin: apache/hive
private static List<Table> createTable() {
Table table = new Table();
table.setDbName("DB");
table.setTableName("TABLE");
return Arrays.asList(table);
}
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidObjectException.class)
public void testCreateTableInvalidTableName() throws Exception {
Table table = testTables[0];
table.setTableName("test_table;");
client.createTable(table);
}
代码示例来源:origin: apache/hive
private static Table createTable(String databaseName, String tableName) {
Table table = new Table();
table.setDbName(databaseName);
table.setTableName(tableName);
return table;
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidObjectException.class)
public void testCreateTableEmptyName() throws Exception {
Table table = testTables[0];
table.setTableName("");
client.createTable(table);
}
代码示例来源:origin: apache/hive
@Test(expected = MetaException.class)
public void testCreateTableNullTableName() throws Exception {
Table table = testTables[0];
table.setTableName(null);
client.createTable(table);
}
代码示例来源:origin: prestodb/presto
public static org.apache.hadoop.hive.metastore.api.Table toMetastoreApiTable(Table table, PrincipalPrivileges privileges)
{
org.apache.hadoop.hive.metastore.api.Table result = new org.apache.hadoop.hive.metastore.api.Table();
result.setDbName(table.getDatabaseName());
result.setTableName(table.getTableName());
result.setOwner(table.getOwner());
result.setTableType(table.getTableType());
result.setParameters(table.getParameters());
result.setPartitionKeys(table.getPartitionColumns().stream().map(ThriftMetastoreUtil::toMetastoreApiFieldSchema).collect(toList()));
result.setSd(makeStorageDescriptor(table.getTableName(), table.getDataColumns(), table.getStorage()));
result.setPrivileges(toMetastoreApiPrincipalPrivilegeSet(table.getOwner(), privileges));
result.setViewOriginalText(table.getViewOriginalText().orElse(null));
result.setViewExpandedText(table.getViewExpandedText().orElse(null));
return result;
}
代码示例来源:origin: apache/hive
public TableBuilder name(String name) {
sd.setLocation(database.getLocationUri() + Path.SEPARATOR + name);
table.setTableName(name);
serDeInfo.setName(name);
return this;
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testAlterTableInvalidTableNameInNew() throws Exception {
Table originalTable = testTables[0];
Table newTable = originalTable.deepCopy();
newTable.setTableName("test_table;");
client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable);
}
代码示例来源:origin: apache/hive
@Test(expected = InvalidOperationException.class)
public void testAlterTableEmptyTableNameInNew() throws Exception {
Table originalTable = testTables[0];
Table newTable = originalTable.deepCopy();
newTable.setTableName("");
client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable);
}
代码示例来源:origin: apache/hive
@Test
public void testAlterTableNullTableNameInNew() throws Exception {
Table originalTable = testTables[0];
Table newTable = originalTable.deepCopy();
newTable.setTableName(null);
try {
client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable);
Assert.fail("Expected exception");
} catch (MetaException | TProtocolException ex) {
// Expected.
}
}
代码示例来源:origin: apache/hive
@Test
public void testAlterTableAlreadyExists() throws Exception {
Table originalTable = testTables[0];
Table newTable = originalTable.deepCopy();
newTable.setTableName(testTables[2].getTableName());
try {
// Already existing table
client.alter_table(originalTable.getDbName(), originalTable.getTableName(), newTable);
// TODO: Maybe throw AlreadyExistsException.
Assert.fail("Expected an InvalidOperationException to be thrown");
} catch (InvalidOperationException exception) {
// Expected exception
}
}
代码示例来源:origin: apache/incubator-gobblin
public static Table getTestTable(String dbName, String tableName) {
Table table = new Table();
table.setDbName(dbName);
table.setTableName(tableName);
table.setTableType(TableType.EXTERNAL_TABLE.name());
StorageDescriptor sd = new StorageDescriptor();
sd.setLocation("/tmp/test");
table.setSd(sd);
return table;
}
代码示例来源:origin: apache/hive
@Test
public void testCreateTable() throws IOException {
Table t = new Table();
t.setDbName("testdb");
t.setTableName("testtable");
NotificationEvent event = new NotificationEvent(getEventId(), getTime(),
HCatConstants.HCAT_CREATE_TABLE_EVENT, msgFactory.buildCreateTableMessage(t).toString());
event.setDbName(t.getDbName());
event.setTableName(t.getTableName());
HCatNotificationEvent hev = new HCatNotificationEvent(event);
ReplicationTask rtask = ReplicationTask.create(client,hev);
assertEquals(hev.toString(), rtask.getEvent().toString());
verifyCreateTableReplicationTask(rtask);
}
代码示例来源:origin: apache/hive
@Test
public void testDropTable() throws IOException {
Table t = new Table();
t.setDbName("testdb");
t.setTableName("testtable");
NotificationEvent event = new NotificationEvent(getEventId(), getTime(),
HCatConstants.HCAT_DROP_TABLE_EVENT, msgFactory.buildDropTableMessage(t).toString());
event.setDbName(t.getDbName());
event.setTableName(t.getTableName());
HCatNotificationEvent hev = new HCatNotificationEvent(event);
ReplicationTask rtask = ReplicationTask.create(client,hev);
assertEquals(hev.toString(), rtask.getEvent().toString());
verifyDropTableReplicationTask(rtask);
}
代码示例来源:origin: apache/hive
@Test
public void testAlterTable() throws IOException {
Table t = new Table();
t.setDbName("testdb");
t.setTableName("testtable");
NotificationEvent event = new NotificationEvent(getEventId(), getTime(),
HCatConstants.HCAT_ALTER_TABLE_EVENT,
msgFactory.buildAlterTableMessage(t, t, t.getWriteId()).toString());
event.setDbName(t.getDbName());
event.setTableName(t.getTableName());
HCatNotificationEvent hev = new HCatNotificationEvent(event);
ReplicationTask rtask = ReplicationTask.create(client,hev);
assertEquals(hev.toString(), rtask.getEvent().toString());
verifyAlterTableReplicationTask(rtask);
}
内容来源于网络,如有侵权,请联系作者删除!