org.apache.hadoop.hive.ql.metadata.Hive.getWithFastCheck()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(153)

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

Hive.getWithFastCheck介绍

[英]Same as #get(HiveConf), except that it checks only the object identity of existing MS client, assuming the relevant settings would be unchanged within the same conf object.
[中]与#get(HiveConf)相同,只是它只检查现有MS客户端的对象标识,假设在同一个conf对象中相关设置不变。

代码示例

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

/**
 * Same as {@link #get(HiveConf)}, except that it checks only the object identity of existing
 * MS client, assuming the relevant settings would be unchanged within the same conf object.
 */
public static Hive getWithFastCheck(HiveConf c) throws HiveException {
 return getWithFastCheck(c, true);
}

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

/**
 * Same as {@link #get(HiveConf)}, except that it checks only the object identity of existing
 * MS client, assuming the relevant settings would be unchanged within the same conf object.
 */
public static Hive getWithFastCheck(HiveConf c) throws HiveException {
 return getWithFastCheck(c, true);
}

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

protected Hive getHive() {
 try {
  return Hive.getWithFastCheck(conf);
 } catch (HiveException e) {
  LOG.error(StringUtils.stringifyException(e));
  throw new RuntimeException(e);
 }
}

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

@Override
 public ExternalFooterCachesByConf.Cache getCache(HiveConf conf) throws IOException {
  // TODO: we wish we could cache the Hive object, but it's not thread safe, and each
  //       threadlocal we "cache" would need to be reinitialized for every query. This is
  //       a huge PITA. Hive object will be cached internally, but the compat check will be
  //       done every time inside get().
  try {
   return new HBaseCache(Hive.getWithFastCheck(conf));
  } catch (HiveException e) {
   throw new IOException(e);
  }
 }
}

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

protected Hive getHive() {
 try {
  return Hive.getWithFastCheck(conf);
 } catch (HiveException e) {
  LOG.error(StringUtils.stringifyException(e));
  throw new RuntimeException(e);
 }
}

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

@Override
 public ExternalFooterCachesByConf.Cache getCache(HiveConf conf) throws IOException {
  // TODO: we wish we could cache the Hive object, but it's not thread safe, and each
  //       threadlocal we "cache" would need to be reinitialized for every query. This is
  //       a huge PITA. Hive object will be cached internally, but the compat check will be
  //       done every time inside get().
  try {
   return new HBaseCache(Hive.getWithFastCheck(conf));
  } catch (HiveException e) {
   throw new IOException(e);
  }
 }
}

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

@Override
public void dropRole(String roleName) throws HiveAuthzPluginException, HiveAccessControlException {
 try {
  Hive hive = Hive.getWithFastCheck(this.conf);
  hive.dropRole(roleName);
 } catch (HiveException e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

@Override
public List<String> getAllRoles() throws HiveAuthzPluginException, HiveAccessControlException {
 try {
  Hive hive = Hive.getWithFastCheck(this.conf);
  return hive.getAllRoleNames();
 } catch (HiveException e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

@Override
public List<String> getAllRoles() throws HiveAuthzPluginException, HiveAccessControlException {
 try {
  Hive hive = Hive.getWithFastCheck(this.conf);
  return hive.getAllRoleNames();
 } catch (HiveException e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

@Override
public void dropRole(String roleName) throws HiveAuthzPluginException, HiveAccessControlException {
 try {
  Hive hive = Hive.getWithFastCheck(this.conf);
  hive.dropRole(roleName);
 } catch (HiveException e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

@Override
public void createRole(String roleName, HivePrincipal adminGrantor) throws HiveAuthzPluginException, HiveAccessControlException {
 try {
  Hive hive = Hive.getWithFastCheck(this.conf);
  hive.createRole(roleName, adminGrantor == null ? null : adminGrantor.getName());
 } catch (HiveException e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

@Override
public List<HiveRoleGrant> getPrincipalGrantInfoForRole(String roleName) throws HiveAuthzPluginException, HiveAccessControlException {
 try {
  Hive hive = Hive.getWithFastCheck(this.conf);
  return SQLStdHiveAccessController.getHiveRoleGrants(hive.getMSC(), roleName);
 } catch (Exception e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

@Override
public void createRole(String roleName, HivePrincipal adminGrantor) throws HiveAuthzPluginException, HiveAccessControlException {
 try {
  Hive hive = Hive.getWithFastCheck(this.conf);
  hive.createRole(roleName, adminGrantor == null ? null : adminGrantor.getName());
 } catch (HiveException e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

@Override
public List<HiveRoleGrant> getPrincipalGrantInfoForRole(String roleName) throws HiveAuthzPluginException, HiveAccessControlException {
 try {
  Hive hive = Hive.getWithFastCheck(this.conf);
  return SQLStdHiveAccessController.getHiveRoleGrants(hive.getMSC(), roleName);
 } catch (Exception e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

@Override
public List<HiveRoleGrant> getRoleGrantInfoForPrincipal(HivePrincipal principal) throws HiveAuthzPluginException, HiveAccessControlException {
 PrincipalType type = AuthorizationUtils.getThriftPrincipalType(principal.getType());
 try {
  List<HiveRoleGrant> grants = new ArrayList<HiveRoleGrant>();
  Hive hive = Hive.getWithFastCheck(this.conf);
  for (RolePrincipalGrant grant : hive.getRoleGrantInfoForPrincipal(principal.getName(), type)) {
   grants.add(new HiveRoleGrant(grant));
  }
  return grants;
 } catch (HiveException e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

@Override
public List<HiveRoleGrant> getRoleGrantInfoForPrincipal(HivePrincipal principal) throws HiveAuthzPluginException, HiveAccessControlException {
 PrincipalType type = AuthorizationUtils.getThriftPrincipalType(principal.getType());
 try {
  List<HiveRoleGrant> grants = new ArrayList<HiveRoleGrant>();
  Hive hive = Hive.getWithFastCheck(this.conf);
  for (RolePrincipalGrant grant : hive.getRoleGrantInfoForPrincipal(principal.getName(), type)) {
   grants.add(new HiveRoleGrant(grant));
  }
  return grants;
 } catch (HiveException e) {
  throw new HiveAuthzPluginException(e);
 }
}

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

public Database getDatabase(String dbName) throws HiveException {
 if (!isRunFromMetaStore()) {
  return Hive.getWithFastCheck(conf).getDatabase(dbName);
 } else {
  try {
   return handler.get_database_core(dbName);
  } catch (NoSuchObjectException e) {
   throw new HiveException(e);
  } catch (MetaException e) {
   throw new HiveException(e);
  }
 }
}

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

public PrincipalPrivilegeSet get_privilege_set(HiveObjectType column, String dbName,
  String tableName, List<String> partValues, String col, String userName,
  List<String> groupNames) throws HiveException {
 if (!isRunFromMetaStore()) {
  return Hive.getWithFastCheck(conf).get_privilege_set(
    column, dbName, tableName, partValues, col, userName, groupNames);
 } else {
  HiveObjectRef hiveObj = new HiveObjectRef(column, dbName,
    tableName, partValues, col);
  try {
   return handler.get_privilege_set(hiveObj, userName, groupNames);
  } catch (MetaException e) {
   throw new HiveException(e);
  } catch (TException e) {
   throw new HiveException(e);
  }
 }
}

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

private void grantOrRevokePrivs(List<HivePrincipal> principals, PrivilegeBag privBag,
  boolean isGrant, boolean grantOption) throws HiveException {
 for (HivePrincipal principal : principals) {
  PrincipalType type = AuthorizationUtils.getThriftPrincipalType(principal.getType());
  for (HiveObjectPrivilege priv : privBag.getPrivileges()) {
   priv.setPrincipalName(principal.getName());
   priv.setPrincipalType(type);
  }
  Hive hive = Hive.getWithFastCheck(this.conf);
  if (isGrant) {
   hive.grantPrivileges(privBag);
  } else {
   hive.revokePrivileges(privBag, grantOption);
  }
 }
}

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

private void grantOrRevokeRole(List<HivePrincipal> principals, List<String> roles,
  boolean grantOption, HivePrincipal grantor, boolean isGrant) throws HiveException {
 PrincipalType grantorType = AuthorizationUtils.getThriftPrincipalType(grantor.getType());
 Hive hive = Hive.getWithFastCheck(this.conf);
 for (HivePrincipal principal : principals) {
  PrincipalType principalType = AuthorizationUtils.getThriftPrincipalType(principal.getType());
  String userName = principal.getName();
  for (String roleName : roles) {
   if (isGrant) {
    hive.grantRole(roleName, userName, principalType,
      grantor.getName(), grantorType, grantOption);
   } else {
    hive.revokeRole(roleName, userName, principalType, grantOption);
   }
  }
 }
}

相关文章

Hive类方法