當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。