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

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

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

Utilities.isDefaultNameNode介绍

[英]Checks if current hive script was executed with non-default namenode
[中]检查当前配置单元脚本是否使用非默认名称节点执行

代码示例

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

if (!Utilities.isDefaultNameNode(conf)) {

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

if (!Utilities.isDefaultNameNode(conf) && DDLTask.doesTableNeedLocation(tbl)) {

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

private int createIndex(Hive db, CreateIndexDesc crtIndex) throws HiveException {
 if (HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_EXECUTION_ENGINE).equals("tez")) {
  throw new UnsupportedOperationException("Indexes unsupported for Tez execution engine");
 }
 if( crtIndex.getSerde() != null) {
  validateSerDe(crtIndex.getSerde());
 }
 String indexTableName = crtIndex.getIndexTableName();
 if (!Utilities.isDefaultNameNode(conf)) {
  // If location is specified - ensure that it is a full qualified name
  makeLocationQualified(crtIndex, indexTableName);
 }
 db
 .createIndex(
   crtIndex.getTableName(), crtIndex.getIndexName(), crtIndex.getIndexTypeHandlerClass(),
   crtIndex.getIndexedCols(), crtIndex.getIndexTableName(), crtIndex.getDeferredRebuild(),
   crtIndex.getInputFormat(), crtIndex.getOutputFormat(), crtIndex.getSerde(),
   crtIndex.getStorageHandler(), crtIndex.getLocation(), crtIndex.getIdxProps(), crtIndex.getTblProps(),
   crtIndex.getSerdeProps(), crtIndex.getCollItemDelim(), crtIndex.getFieldDelim(), crtIndex.getFieldEscape(),
   crtIndex.getLineDelim(), crtIndex.getMapKeyDelim(), crtIndex.getIndexComment()
   );
 if (HiveUtils.getIndexHandler(conf, crtIndex.getIndexTypeHandlerClass()).usesIndexTable()) {
    Table indexTable = db.getTable(indexTableName);
    addIfAbsentByName(new WriteEntity(indexTable, WriteEntity.WriteType.DDL_NO_LOCK));
 }
 return 0;
}

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

/**
 * Create a Database
 * @param db
 * @param crtDb
 * @return Always returns 0
 * @throws HiveException
 */
private int createDatabase(Hive db, CreateDatabaseDesc crtDb)
  throws HiveException {
 Database database = new Database();
 database.setName(crtDb.getName());
 database.setDescription(crtDb.getComment());
 database.setLocationUri(crtDb.getLocationUri());
 database.setParameters(crtDb.getDatabaseProperties());
 database.setOwnerName(SessionState.getUserFromAuthenticator());
 database.setOwnerType(PrincipalType.USER);
 try {
  if (!Utilities.isDefaultNameNode(conf)) {
   makeLocationQualified(database);
  }
  db.createDatabase(database, crtDb.getIfNotExists());
 }
 catch (AlreadyExistsException ex) {
  //it would be better if AlreadyExistsException had an errorCode field....
  throw new HiveException(ex, ErrorMsg.DATABSAE_ALREADY_EXISTS, crtDb.getName());
 }
 return 0;
}

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

Path location = addSpec.getLocation() != null
  ? new Path(tbl.getPath(), addSpec.getLocation()) : null;
if (location !=null && !Utilities.isDefaultNameNode(conf)) {

代码示例来源:origin: com.facebook.presto.hive/hive-apache

if (!Utilities.isDefaultNameNode(conf)) {

代码示例来源:origin: com.facebook.presto.hive/hive-apache

if (!Utilities.isDefaultNameNode(conf) && doesTableNeedLocation(tbl)) {

代码示例来源:origin: com.facebook.presto.hive/hive-apache

/**
 * Create a Database
 * @param db
 * @param crtDb
 * @return Always returns 0
 * @throws HiveException
 */
private int createDatabase(Hive db, CreateDatabaseDesc crtDb)
  throws HiveException {
 Database database = new Database();
 database.setName(crtDb.getName());
 database.setDescription(crtDb.getComment());
 database.setLocationUri(crtDb.getLocationUri());
 database.setParameters(crtDb.getDatabaseProperties());
 database.setOwnerName(SessionState.getUserFromAuthenticator());
 database.setOwnerType(PrincipalType.USER);
 try {
  if (!Utilities.isDefaultNameNode(conf)) {
   makeLocationQualified(database);
  }
  db.createDatabase(database, crtDb.getIfNotExists());
 }
 catch (AlreadyExistsException ex) {
  //it would be better if AlreadyExistsException had an errorCode field....
  throw new HiveException(ex, ErrorMsg.DATABSAE_ALREADY_EXISTS, crtDb.getName());
 }
 return 0;
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

private int createIndex(Hive db, CreateIndexDesc crtIndex) throws HiveException {
 if( crtIndex.getSerde() != null) {
  validateSerDe(crtIndex.getSerde());
 }
 String indexTableName = crtIndex.getIndexTableName();
 if (!Utilities.isDefaultNameNode(conf)) {
  // If location is specified - ensure that it is a full qualified name
  makeLocationQualified(crtIndex, indexTableName);
 }
 db
 .createIndex(
   crtIndex.getTableName(), crtIndex.getIndexName(), crtIndex.getIndexTypeHandlerClass(),
   crtIndex.getIndexedCols(), crtIndex.getIndexTableName(), crtIndex.getDeferredRebuild(),
   crtIndex.getInputFormat(), crtIndex.getOutputFormat(), crtIndex.getSerde(),
   crtIndex.getStorageHandler(), crtIndex.getLocation(), crtIndex.getIdxProps(), crtIndex.getTblProps(),
   crtIndex.getSerdeProps(), crtIndex.getCollItemDelim(), crtIndex.getFieldDelim(), crtIndex.getFieldEscape(),
   crtIndex.getLineDelim(), crtIndex.getMapKeyDelim(), crtIndex.getIndexComment()
   );
 if (HiveUtils.getIndexHandler(conf, crtIndex.getIndexTypeHandlerClass()).usesIndexTable()) {
    Table indexTable = db.getTable(indexTableName);
    work.getOutputs().add(new WriteEntity(indexTable, WriteEntity.WriteType.DDL_NO_LOCK));
 }
 return 0;
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

Path location = addSpec.getLocation() != null
  ? new Path(tbl.getPath(), addSpec.getLocation()) : null;
if (location !=null && !Utilities.isDefaultNameNode(conf)) {

相关文章

微信公众号

最新文章

更多

Utilities类方法