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

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

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

private Scenario scenarioType(org.apache.hadoop.hive.metastore.api.Table before,
  org.apache.hadoop.hive.metastore.api.Table after) {
 if (before.getDbName().equals(after.getDbName())
   && before.getTableName().equals(after.getTableName())) {
  return isTruncateOp ? Scenario.TRUNCATE : Scenario.ALTER;
 } else {
  return Scenario.RENAME;
 }
}

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

public T onTable(Table table) {
 this.catName = table.getCatName();
 this.dbName = table.getDbName();
 this.tableName = table.getTableName();
 return child;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章

Table类方法