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

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

本文整理了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

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

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

  1. tbl.getTTable().unsetId();

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

  1. @Test
  2. public void testDropTableCaseInsensitive() throws Exception {
  3. Table table = testTables[0];
  4. // Test in upper case
  5. client.dropTable(table.getDbName().toUpperCase(), table.getTableName().toUpperCase());
  6. try {
  7. client.getTable(table.getDbName(), table.getTableName());
  8. Assert.fail("Expected a NoSuchObjectException to be thrown");
  9. } catch (NoSuchObjectException exception) {
  10. // Expected exception
  11. }
  12. table.unsetId();
  13. // Test in mixed case
  14. client.createTable(table);
  15. client.dropTable("DeFaUlt", "TeST_tAbLE");
  16. try {
  17. client.getTable(table.getDbName(), table.getTableName());
  18. Assert.fail("Expected a NoSuchObjectException to be thrown");
  19. } catch (NoSuchObjectException exception) {
  20. // Expected exception
  21. }
  22. }

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

  1. table.getTTable().unsetId();

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

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

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

  1. tbl.unsetId();

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

  1. @Test
  2. public void testDropTableDeleteDir() throws Exception {
  3. Table table = testTables[0];
  4. Partition externalPartition = client.getPartition(partitionedTable.getDbName(),
  5. partitionedTable.getTableName(), "test_part_col=a2");
  6. client.dropTable(table.getDbName(), table.getTableName(), true, false);
  7. Assert.assertFalse("Table path should be removed",
  8. metaStore.isPathExists(new Path(table.getSd().getLocation())));
  9. table.unsetId();
  10. client.createTable(table);
  11. client.dropTable(table.getDbName(), table.getTableName(), false, false);
  12. Assert.assertTrue("Table path should be kept",
  13. metaStore.isPathExists(new Path(table.getSd().getLocation())));
  14. // Drop table with partitions
  15. client.dropTable(partitionedTable.getDbName(), partitionedTable.getTableName(), true, false);
  16. Assert.assertFalse("Table path should be removed",
  17. metaStore.isPathExists(new Path(partitionedTable.getSd().getLocation())));
  18. Assert.assertFalse("Extra partition path should be removed",
  19. metaStore.isPathExists(new Path(externalPartition.getSd().getLocation())));
  20. }

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

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

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

  1. @Test
  2. public void testAlterTable() throws Exception {
  3. Table originalTable = testTables[2];
  4. String originalTableName = originalTable.getTableName();
  5. String originalDatabase = originalTable.getDbName();
  6. Table newTable = getTableWithAllParametersSet();
  7. newTable.setTableName(originalTableName);
  8. newTable.setDbName(originalDatabase);
  9. // Partition keys can not be set, but getTableWithAllParametersSet is added one, so remove for
  10. // this test
  11. newTable.setPartitionKeys(originalTable.getPartitionKeys());
  12. client.alter_table(originalDatabase, originalTableName, newTable);
  13. Table alteredTable = client.getTable(originalDatabase, originalTableName);
  14. // The extra parameters will be added on server side, so check that the required ones are
  15. // present
  16. for(String key: newTable.getParameters().keySet()) {
  17. Assert.assertEquals("parameters are present", newTable.getParameters().get(key),
  18. alteredTable.getParameters().get(key));
  19. }
  20. // The parameters are checked manually, so do not check them
  21. newTable.setParameters(alteredTable.getParameters());
  22. // Some of the data is set on the server side, so reset those
  23. newTable.setCreateTime(alteredTable.getCreateTime());
  24. newTable.setCreationMetadata(alteredTable.getCreationMetadata());
  25. newTable.setWriteId(alteredTable.getWriteId());
  26. Assert.assertTrue(alteredTable.isSetId());
  27. alteredTable.unsetId();
  28. Assert.assertEquals("The table data should be the same", newTable, alteredTable);
  29. }

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

  1. private Table createTestTable() throws HiveException, AlreadyExistsException {
  2. Database db = new Database();
  3. db.setName(dbName);
  4. hive.createDatabase(db, true);
  5. Table table = new Table(dbName, tableName);
  6. table.setDbName(dbName);
  7. table.setInputFormatClass(TextInputFormat.class);
  8. table.setOutputFormatClass(HiveIgnoreKeyTextOutputFormat.class);
  9. table.setPartCols(partCols);
  10. hive.createTable(table);
  11. table = hive.getTable(dbName, tableName);
  12. Assert.assertTrue(table.getTTable().isSetId());
  13. table.getTTable().unsetId();
  14. for (Map<String, String> partSpec : parts) {
  15. hive.createPartition(table, partSpec);
  16. }
  17. return table;
  18. }

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

  1. tbl2.unsetId();
  2. client.createTable(tbl2);
  3. if (isThriftClient) {

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

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

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

  1. case ID:
  2. if (value == null) {
  3. unsetId();
  4. } else {
  5. setId((Long)value);

相关文章

Table类方法