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

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

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

Table.getDbName介绍

暂无

代码示例

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

  1. private Scenario scenarioType(org.apache.hadoop.hive.metastore.api.Table before,
  2. org.apache.hadoop.hive.metastore.api.Table after) {
  3. if (before.getDbName().equals(after.getDbName())
  4. && before.getTableName().equals(after.getTableName())) {
  5. return isTruncateOp ? Scenario.TRUNCATE : Scenario.ALTER;
  6. } else {
  7. return Scenario.RENAME;
  8. }
  9. }

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

  1. public T onTable(Table table) {
  2. this.catName = table.getCatName();
  3. this.dbName = table.getDbName();
  4. this.tableName = table.getTableName();
  5. return child;
  6. }

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

  1. public HiveObjectRef buildPartitionColumnReference(Table table, String columnName,
  2. List<String> partValues) {
  3. return new HiveObjectRef(HiveObjectType.COLUMN, table.getDbName(), table.getTableName(),
  4. partValues, columnName);
  5. }
  6. }

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

  1. public JSONCreateTableMessage(String server, String servicePrincipal, Table tableObj,
  2. Iterator<String> fileIter, Long timestamp) {
  3. this(server, servicePrincipal, tableObj.getDbName(), tableObj.getTableName(),
  4. tableObj.getTableType(), timestamp);
  5. try {
  6. this.tableObjJson = MessageBuilder.createTableObjJson(tableObj);
  7. } catch (TException e) {
  8. throw new IllegalArgumentException("Could not serialize: ", e);
  9. }
  10. this.files = (fileIter != null) ? Lists.newArrayList(fileIter) : Lists.newArrayList();
  11. }

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

  1. /**
  2. * Get table name in cat.db.table format.
  3. * @param table table object
  4. * @return fully qualified name.
  5. */
  6. public static String getCatalogQualifiedTableName(Table table) {
  7. return TableName.getQualified(table.getCatName(), table.getDbName(), table.getTableName());
  8. }

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

  1. private static void removeTempTable(org.apache.hadoop.hive.metastore.api.Table t) {
  2. String qualifiedTableName = Warehouse.
  3. getQualifiedName(t.getDbName().toLowerCase(), t.getTableName().toLowerCase());
  4. SessionState ss = SessionState.get();
  5. if (ss == null) {
  6. LOG.warn("No current SessionState, skipping temp partitions for " + qualifiedTableName);
  7. return;
  8. }
  9. ss.getTempPartitions().remove(Warehouse.getQualifiedName(t));
  10. }
  11. private static void createTempTable(org.apache.hadoop.hive.metastore.api.Table t) {

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

  1. @Override
  2. public CreateTableMessage buildCreateTableMessage(Table table) {
  3. return new JSONCreateTableMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, table.getDbName(),
  4. table.getTableName(), table.getTableType(), now());
  5. }

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

  1. @Override
  2. public DropTableMessage buildDropTableMessage(Table table) {
  3. return new JSONDropTableMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, table.getDbName(),
  4. table.getTableName(), table.getTableType(), now());
  5. }

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

  1. @Override
  2. public InsertMessage buildInsertMessage(String db, Table table, Map<String,String> partKeyVals,
  3. List<String> files) {
  4. return new JSONInsertMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, table.getDbName(),
  5. table.getTableName(), table.getTableType(), partKeyVals, files, now());
  6. }

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

  1. @Test(expected = MetaException.class)
  2. public void testExchangePartitionsNonExistingValuesInPartSpec() throws Exception {
  3. Map<String, String> partitionSpecs = new HashMap<>();
  4. partitionSpecs.put("ev", "2017");
  5. partitionSpecs.put("honap", "march");
  6. partitionSpecs.put("nap", "22");
  7. client.exchange_partitions(partitionSpecs, sourceTable.getDbName(),
  8. sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName());
  9. }

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

  1. @Override
  2. public DropPartitionMessage buildDropPartitionMessage(Table table, Iterator<Partition> partitions) {
  3. return new JSONDropPartitionMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, table.getDbName(),
  4. table.getTableName(), table.getTableType(),
  5. MessageBuilder.getPartitionKeyValues(table, partitions), now());
  6. }

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

  1. @Override
  2. public AddPartitionMessage buildAddPartitionMessage(Table table, Iterator<Partition> partitionsIterator) {
  3. return new JSONAddPartitionMessage(HCAT_SERVER_URL, HCAT_SERVICE_PRINCIPAL, table.getDbName(),
  4. table.getTableName(), table.getTableType(),
  5. MessageBuilder.getPartitionKeyValues(table, partitionsIterator), now());
  6. }

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

  1. @Test
  2. public void testExchangePartitionsDifferentValuesInPartSpec() throws Exception {
  3. Map<String, String> partitionSpecs = new HashMap<>();
  4. partitionSpecs.put(YEAR_COL_NAME, "2017");
  5. partitionSpecs.put("honap", "march");
  6. partitionSpecs.put("nap", "22");
  7. client.exchange_partitions(partitionSpecs, sourceTable.getDbName(),
  8. sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName());
  9. checkExchangedPartitions(sourceTable, destTable,
  10. Lists.newArrayList(partitions[0], partitions[1], partitions[2], partitions[3]));
  11. checkRemainingPartitions(sourceTable, destTable, Lists.newArrayList(partitions[4]));
  12. }

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

  1. @Test
  2. public void testExchangePartitionDifferentValuesInPartSpec() throws Exception {
  3. Map<String, String> partitionSpecs = new HashMap<>();
  4. partitionSpecs.put(YEAR_COL_NAME, "2017");
  5. partitionSpecs.put("honap", "march");
  6. partitionSpecs.put("nap", "22");
  7. client.exchange_partition(partitionSpecs, sourceTable.getDbName(),
  8. sourceTable.getTableName(), destTable.getDbName(), destTable.getTableName());
  9. checkExchangedPartitions(sourceTable, destTable,
  10. Lists.newArrayList(partitions[0], partitions[1], partitions[2], partitions[3]));
  11. checkRemainingPartitions(sourceTable, destTable, Lists.newArrayList(partitions[4]));
  12. }

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

  1. @Test(expected = MetaException.class)
  2. public void testAppendPartitionToView() throws Exception {
  3. List<String> partitionValues = Lists.newArrayList("2017", "may");
  4. Table table = tableView;
  5. client.appendPartition(table.getDbName(), table.getTableName(), partitionValues);
  6. }

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

  1. @Test(expected = AlreadyExistsException.class)
  2. public void testAppendPartitionAlreadyExists() throws Exception {
  3. List<String> partitionValues = Lists.newArrayList("2017", "april");
  4. Table table = tableWithPartitions;
  5. client.appendPartition(table.getDbName(), table.getTableName(), partitionValues);
  6. }

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

  1. @Test(expected = MetaException.class)
  2. public void testAppendPartitionEmptyPartValues() throws Exception {
  3. Table table = tableWithPartitions;
  4. client.appendPartition(table.getDbName(), table.getTableName(), new ArrayList<>());
  5. }

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

  1. @Test(expected = MetaException.class)
  2. public void testAppendPartToTableWithoutPartCols() throws Exception {
  3. String partitionName = "year=2017/month=may";
  4. Table table = tableNoPartColumns;
  5. client.appendPartition(table.getDbName(), table.getTableName(), partitionName);
  6. }

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

  1. @Test(expected = MetaException.class)
  2. public void testAppendPartEmptyPartName() throws Exception {
  3. Table table = tableWithPartitions;
  4. client.appendPartition(table.getDbName(), table.getTableName(), "");
  5. }

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

  1. private void verifyPartitionNames(Table table, List<String> expectedPartNames) throws Exception {
  2. List<String> partitionNames =
  3. client.listPartitionNames(table.getDbName(), table.getTableName(), (short) -1);
  4. Assert.assertEquals(expectedPartNames.size(), partitionNames.size());
  5. Assert.assertTrue(partitionNames.containsAll(expectedPartNames));
  6. }
  7. }

相关文章

Table类方法