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

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

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

Table.unsetId介绍

暂无

代码示例

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

@Test(expected = AlreadyExistsException.class)
public void testCreateTableAlreadyExists() throws Exception {
 Table table = testTables[0];
 table.unsetId();
 client.createTable(table);
}

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

tbl.getTTable().unsetId();

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

@Test
public void testDropTableCaseInsensitive() throws Exception {
 Table table = testTables[0];
 // Test in upper case
 client.dropTable(table.getDbName().toUpperCase(), table.getTableName().toUpperCase());
 try {
  client.getTable(table.getDbName(), table.getTableName());
  Assert.fail("Expected a NoSuchObjectException to be thrown");
 } catch (NoSuchObjectException exception) {
  // Expected exception
 }
 table.unsetId();
 // Test in mixed case
 client.createTable(table);
 client.dropTable("DeFaUlt", "TeST_tAbLE");
 try {
  client.getTable(table.getDbName(), table.getTableName());
  Assert.fail("Expected a NoSuchObjectException to be thrown");
 } catch (NoSuchObjectException exception) {
  // Expected exception
 }
}

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

table.getTTable().unsetId();

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

table.unsetId();
createdTable.unsetId();
Assert.assertEquals("create/get table data", table, createdTable);

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

tbl.unsetId();

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

@Test
public void testDropTableDeleteDir() throws Exception {
 Table table = testTables[0];
 Partition externalPartition = client.getPartition(partitionedTable.getDbName(),
   partitionedTable.getTableName(), "test_part_col=a2");
 client.dropTable(table.getDbName(), table.getTableName(), true, false);
 Assert.assertFalse("Table path should be removed",
   metaStore.isPathExists(new Path(table.getSd().getLocation())));
 table.unsetId();
 client.createTable(table);
 client.dropTable(table.getDbName(), table.getTableName(), false, false);
 Assert.assertTrue("Table path should be kept",
   metaStore.isPathExists(new Path(table.getSd().getLocation())));
 // Drop table with partitions
 client.dropTable(partitionedTable.getDbName(), partitionedTable.getTableName(), true, false);
 Assert.assertFalse("Table path should be removed",
   metaStore.isPathExists(new Path(partitionedTable.getSd().getLocation())));
 Assert.assertFalse("Extra partition path should be removed",
   metaStore.isPathExists(new Path(externalPartition.getSd().getLocation())));
}

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

ft.getTTable().unsetId();
tbl.getTTable().unsetId();
assertTrue("Tables  doesn't match: " + tableName + " (" + ft.getTTable()
  + "; " + tbl.getTTable() + ")", ft.getTTable().equals(tbl.getTTable()));

代码示例来源: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

private Table createTestTable() throws HiveException, AlreadyExistsException {
 Database db = new Database();
 db.setName(dbName);
 hive.createDatabase(db, true);
 Table table = new Table(dbName, tableName);
 table.setDbName(dbName);
 table.setInputFormatClass(TextInputFormat.class);
 table.setOutputFormatClass(HiveIgnoreKeyTextOutputFormat.class);
 table.setPartCols(partCols);
 hive.createTable(table);
 table = hive.getTable(dbName, tableName);
 Assert.assertTrue(table.getTTable().isSetId());
 table.getTTable().unsetId();
 for (Map<String, String> partSpec : parts) {
  hive.createPartition(table, partSpec);
 }
 return table;
}

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

tbl2.unsetId();
client.createTable(tbl2);
if (isThriftClient) {

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

Table table = hmsc.getTable(dbName, tableName);
Assert.assertTrue(table.isSetId());
table.unsetId();
populatePartitions(hmsc, table, Arrays.asList("isLocatedInTablePath", "isLocatedOutsideTablePath"));

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

case ID:
 if (value == null) {
  unsetId();
 } else {
  setId((Long)value);

相关文章

Table类方法