org.apache.hadoop.hive.ql.exec.Utilities.getDbTableName()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(143)

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

Utilities.getDbTableName介绍

[英]Extract db and table name from dbtable string, where db and table are separated by "." If there is no db name part, set the current sessions default db
[中]从dbtable字符串中提取db和表名,其中db和表之间用“.”分隔如果没有db名称部分,则将当前会话设置为默认db

代码示例

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

/**
 * @param oldName
 *          the oldName to set
 */
public void setOldName(String oldName) throws SemanticException {
 // Make sure we qualify the name from the outset so there's no ambiguity.
 this.oldName = String.join(".", Utilities.getDbTableName(oldName));
}

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

public void alterTable(String fullyQlfdTblName, Table newTbl, boolean cascade,
  EnvironmentContext environmentContext, boolean transactional)
  throws HiveException {
 String[] names = Utilities.getDbTableName(fullyQlfdTblName);
 alterTable(null, names[0], names[1], newTbl, cascade, environmentContext, transactional);
}

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

public boolean dropPartition(String tblName, List<String> part_vals, boolean deleteData)
  throws HiveException {
 String[] names = Utilities.getDbTableName(tblName);
 return dropPartition(names[0], names[1], part_vals, deleteData);
}

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

public Table newTable(String tableName) throws HiveException {
 String[] names = Utilities.getDbTableName(tableName);
 return new Table(names[0], names[1]);
}

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

/**
 * Returns metadata for the table named tableName
 * @param tableName the name of the table
 * @param throwException controls whether an exception is thrown or a returns a null
 * @return the table metadata
 * @throws HiveException if there's an internal error or if the
 * table doesn't exist
 */
public Table getTable(final String tableName, boolean throwException) throws HiveException {
 String[] names = Utilities.getDbTableName(tableName);
 return this.getTable(names[0], names[1], throwException);
}

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

public List<Partition> dropPartitions(String tblName, List<DropTableDesc.PartSpec> partSpecs,
  boolean deleteData, boolean ifExists) throws HiveException {
 String[] names = Utilities.getDbTableName(tblName);
 return dropPartitions(names[0], names[1], partSpecs, deleteData, ifExists);
}

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

public List<Partition> dropPartitions(String tblName, List<DropTableDesc.PartSpec> partSpecs,
                   PartitionDropOptions dropOptions) throws HiveException {
 String[] names = Utilities.getDbTableName(tblName);
 return dropPartitions(names[0], names[1], partSpecs, dropOptions);
}

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

public List<String> getPartitionNames(String tblName, short max) throws HiveException {
 String[] names = Utilities.getDbTableName(tblName);
 return getPartitionNames(names[0], names[1], max);
}

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

public boolean dropPartition(String tblName, List<String> part_vals, boolean deleteData)
  throws HiveException {
 String[] names = Utilities.getDbTableName(tblName);
 return dropPartition(names[0], names[1], part_vals, deleteData);
}

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

public boolean dropIndex(String baseTableName, String index_name,
  boolean throwException, boolean deleteData) throws HiveException {
 String[] names = Utilities.getDbTableName(baseTableName);
 return dropIndex(names[0], names[1], index_name, throwException, deleteData);
}

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

/**
 * Returns metadata for the table named tableName
 * @param tableName the name of the table
 * @param throwException controls whether an exception is thrown or a returns a null
 * @return the table metadata
 * @throws HiveException if there's an internal error or if the
 * table doesn't exist
 */
public Table getTable(final String tableName, boolean throwException) throws HiveException {
 String[] names = Utilities.getDbTableName(tableName);
 return this.getTable(names[0], names[1], throwException);
}

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

public List<Partition> dropPartitions(String tblName, List<DropTableDesc.PartSpec> partSpecs,
                   PartitionDropOptions dropOptions) throws HiveException {
 String[] names = Utilities.getDbTableName(tblName);
 return dropPartitions(names[0], names[1], partSpecs, dropOptions);
}

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

public Index getIndex(String baseTableName, String indexName) throws HiveException {
 String[] names = Utilities.getDbTableName(baseTableName);
 return this.getIndex(names[0], names[1], indexName);
}

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

public List<Partition> dropPartitions(String tblName, List<DropTableDesc.PartSpec> partSpecs,
  boolean deleteData, boolean ifExists) throws HiveException {
 String[] names = Utilities.getDbTableName(tblName);
 return dropPartitions(names[0], names[1], partSpecs, deleteData, ifExists);
}

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

/**
 * Extract db and table name from dbtable string, where db and table are separated by "."
 * If there is no db name part, set the current sessions default db
 * @param dbtable
 * @return String array with two elements, first is db name, second is table name
 * @throws HiveException
 */
public static String[] getDbTableName(String dbtable) throws SemanticException {
 return getDbTableName(SessionState.get().getCurrentDatabase(), dbtable);
}

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

/**
 * Extract db and table name from dbtable string, where db and table are separated by "."
 * If there is no db name part, set the current sessions default db
 * @param dbtable
 * @return String array with two elements, first is db name, second is table name
 * @throws HiveException
 */
public static String[] getDbTableName(String dbtable) throws SemanticException {
 return getDbTableName(SessionState.get().getCurrentDatabase(), dbtable);
}

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

public String getTableName() throws SemanticException {
 switch (getDescType()) {
  case TABLE:
   return createTblDesc.getTableName();
  case VIEW:
   String dbDotView = createViewDesc.getViewName();
   String[] names = Utilities.getDbTableName(dbDotView);
   return names[1]; // names[0] have the Db name and names[1] have the view name
 }
 return null;
}

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

private boolean containsPartition(Index index, Map<String, String> partSpec)
   throws HiveException {
  String[] qualified = Utilities.getDbTableName(index.getDbName(), index.getIndexTableName());
  Table indexTable = hive.getTable(qualified[0], qualified[1]);
  List<Partition> parts = hive.getPartitions(indexTable, partSpec);
  return (parts == null || parts.size() == 0);
 }
}

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

public String getTableName() throws SemanticException {
 switch (getTableType()) {
  case TABLE:
   return createTblDesc.getTableName();
  case VIEW:
   String dbDotView = createViewDesc.getViewName();
   String[] names = Utilities.getDbTableName(dbDotView);
   return names[1]; // names[0] have the Db name and names[1] have the view name
 }
 return null;
}

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

public static Table getTable(ASTNode tree, BaseSemanticAnalyzer sa) throws SemanticException {
 String tableName = ColumnStatsSemanticAnalyzer.getUnescapedName((ASTNode) tree.getChild(0).getChild(0));
 String currentDb = SessionState.get().getCurrentDatabase();
 String [] names = Utilities.getDbTableName(currentDb, tableName);
 return sa.getTable(names[0], names[1], true);
}

相关文章

微信公众号

最新文章

更多

Utilities类方法