当前位置: 首页>>代码示例>>Java>>正文


Java HiveConf.getBoolVar方法代码示例

本文整理汇总了Java中org.apache.hadoop.hive.conf.HiveConf.getBoolVar方法的典型用法代码示例。如果您正苦于以下问题:Java HiveConf.getBoolVar方法的具体用法?Java HiveConf.getBoolVar怎么用?Java HiveConf.getBoolVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hive.conf.HiveConf的用法示例。


在下文中一共展示了HiveConf.getBoolVar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HiveAuthorizationHelper

import org.apache.hadoop.hive.conf.HiveConf; //导入方法依赖的package包/类
public HiveAuthorizationHelper(final IMetaStoreClient mClient, final HiveConf hiveConf, final String user) {
  authzEnabled = hiveConf.getBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED);
  if (!authzEnabled) {
    authorizerV2 = null;
    return;
  }

  try {
    final HiveConf hiveConfCopy = new HiveConf(hiveConf);
    hiveConfCopy.set("user.name", user);

    final HiveAuthenticationProvider authenticator = HiveUtils.getAuthenticator(hiveConfCopy,
        HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER);
    SessionState ss = new SessionState(hiveConfCopy, user);
    SessionState.start(ss);

    authenticator.setSessionState(ss);

    HiveAuthorizerFactory authorizerFactory =
        HiveUtils.getAuthorizerFactory(hiveConfCopy, HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER);

    HiveAuthzSessionContext.Builder authzContextBuilder = new HiveAuthzSessionContext.Builder();
    authzContextBuilder.setClientType(CLIENT_TYPE.HIVESERVER2); // Drill is emulating HS2 here

    authorizerV2 = authorizerFactory.createHiveAuthorizer(
        new HiveMetastoreClientFactory() {
          @Override
          public IMetaStoreClient getHiveMetastoreClient() throws HiveAuthzPluginException {
            return mClient;
          }
        },
        hiveConf, authenticator, authzContextBuilder.build());

    authorizerV2.applyAuthorizationConfigPolicy(hiveConfCopy);
  } catch (final HiveException e) {
    throw new DrillRuntimeException("Failed to initialize Hive authorization components: " + e.getMessage(), e);
  }

  logger.trace("Hive authorization enabled");
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:41,代码来源:HiveAuthorizationHelper.java

示例2: HiveSchemaFactory

import org.apache.hadoop.hive.conf.HiveConf; //导入方法依赖的package包/类
public HiveSchemaFactory(HiveStoragePlugin plugin, String name, Map<String, String> hiveConfigOverride) throws ExecutionSetupException {
  this.schemaName = name;
  this.plugin = plugin;

  this.hiveConfigOverride = hiveConfigOverride;
  hiveConf = new HiveConf();
  if (hiveConfigOverride != null) {
    for (Map.Entry<String, String> entry : hiveConfigOverride.entrySet()) {
      final String property = entry.getKey();
      final String value = entry.getValue();
      hiveConf.set(property, value);
      logger.trace("HiveConfig Override {}={}", property, value);
    }
  }

  isHS2DoAsSet = hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS);
  isDrillImpersonationEnabled = plugin.getContext().getConfig().getBoolean(ExecConstants.IMPERSONATION_ENABLED);

  try {
    processUserMetastoreClient =
        DrillHiveMetaStoreClient.createNonCloseableClientWithCaching(hiveConf, hiveConfigOverride);
  } catch (MetaException e) {
    throw new ExecutionSetupException("Failure setting up Hive metastore client.", e);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:26,代码来源:HiveSchemaFactory.java

示例3: HiveAuthorizationHelper

import org.apache.hadoop.hive.conf.HiveConf; //导入方法依赖的package包/类
public HiveAuthorizationHelper(final IMetaStoreClient mClient, final HiveConf hiveConf, final String user) {
  authzEnabled = hiveConf.getBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED);
  if (!authzEnabled) {
    authorizerV2 = null;
    return;
  }

  try {
    final HiveConf hiveConfCopy = new HiveConf(hiveConf);
    hiveConfCopy.set("user.name", user);

    final HiveAuthenticationProvider authenticator = HiveUtils.getAuthenticator(hiveConfCopy,
        HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER);
    SessionState ss = new SessionState(hiveConfCopy, user);
    SessionState.start(ss);

    authenticator.setSessionState(ss);

    HiveAuthorizerFactory authorizerFactory =
        HiveUtils.getAuthorizerFactory(hiveConfCopy, HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER);

    HiveAuthzSessionContext.Builder authzContextBuilder = new HiveAuthzSessionContext.Builder();
    authzContextBuilder.setClientType(CLIENT_TYPE.HIVESERVER2); // Dremio is emulating HS2 here

    authorizerV2 = authorizerFactory.createHiveAuthorizer(
        new HiveMetastoreClientFactory() {
          @Override
          public IMetaStoreClient getHiveMetastoreClient() throws HiveAuthzPluginException {
            return mClient;
          }
        },
        hiveConf, authenticator, authzContextBuilder.build());

    authorizerV2.applyAuthorizationConfigPolicy(hiveConfCopy);
  } catch (final HiveException e) {
    throw new RuntimeException("Failed to initialize Hive authorization components: " + e.getMessage(), e);
  }

  logger.trace("Hive authorization enabled");
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:41,代码来源:HiveAuthorizationHelper.java

示例4: HiveStoragePlugin2

import org.apache.hadoop.hive.conf.HiveConf; //导入方法依赖的package包/类
public HiveStoragePlugin2(HiveStoragePluginConfig config, final String name, final HiveConf hiveConf, SabotConfig sabotConfig, boolean isCoordinator) throws ExecutionSetupException{
  this.hiveConf = hiveConf;
  this.name = name;
  this.sabotConfig = sabotConfig;
  this.config = config;
  this.isCoordinator = true;
  storageImpersonationEnabled = hiveConf.getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS);

  // Hive Metastore impersonation is enabled if:
  // - "hive.security.authorization.enabled" is set to true,
  // - "hive.metastore.execute.setugi" is set to true (in SASL disabled scenarios) or
  // - "hive.metastore.sasl.enabled" is set to true in which case all metastore calls are impersonated as
  //     the authenticated user.
  this.metastoreImpersonationEnabled =
    hiveConf.getBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED) ||
      hiveConf.getBoolVar(ConfVars.METASTORE_EXECUTE_SET_UGI) ||
      hiveConf.getBoolVar(ConfVars.METASTORE_USE_THRIFT_SASL);

  if (isCoordinator) {
    try {
      processUserMetastoreClient = HiveClient.createClient(hiveConf);
    } catch (MetaException e) {
      throw new ExecutionSetupException("Failure setting up Hive metastore client.", e);
    }

    clientsByUser = CacheBuilder
      .newBuilder()
      .expireAfterAccess(10, TimeUnit.MINUTES)
      .maximumSize(5) // Up to 5 clients for impersonation-enabled.
      .removalListener(new RemovalListener<String, HiveClient>() {
        @Override
        public void onRemoval(RemovalNotification<String, HiveClient> notification) {
          HiveClient client = notification.getValue();
          client.close();
        }
      })
      .build(new CacheLoader<String, HiveClient>() {
        @Override
        public HiveClient load(String userName) throws Exception {
          return HiveClient.createClientWithAuthz(processUserMetastoreClient, hiveConf, userName);
        }
      });
  } else {
    processUserMetastoreClient = null;
    clientsByUser = null;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:48,代码来源:HiveStoragePlugin2.java


注:本文中的org.apache.hadoop.hive.conf.HiveConf.getBoolVar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。