Java Code Examples for org.apache.hadoop.hive.conf.HiveConf#setBoolean()

The following examples show how to use org.apache.hadoop.hive.conf.HiveConf#setBoolean() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HiveConnectorClientConfig.java    From metacat with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
private HiveConf getDefaultConf(
    final ConnectorContext connectorContext
) {
    final HiveConf result = new HiveConf();
    result.setBoolean(HiveConfigConstants.USE_METASTORE_LOCAL, true);

    final int dataStoreTimeout = getDataStoreTimeout(connectorContext);
    result.setInt(HiveConfigConstants.JAVAX_JDO_DATASTORETIMEOUT, dataStoreTimeout);
    result.setInt(HiveConfigConstants.JAVAX_JDO_DATASTOREREADTIMEOUT, dataStoreTimeout);
    result.setInt(HiveConfigConstants.JAVAX_JDO_DATASTOREWRITETIMEOUT, getDataStoreWriteTimeout(connectorContext));
    result.setInt(HiveConfigConstants.HIVE_METASTORE_DS_RETRY, 0);
    result.setInt(HiveConfigConstants.HIVE_HMSHANDLER_RETRY, 0);
    result.set(
        HiveConfigConstants.JAVAX_JDO_PERSISTENCEMANAGER_FACTORY_CLASS,
        HiveConfigConstants.JAVAX_JDO_PERSISTENCEMANAGER_FACTORY
    );
    result.setBoolean(HiveConfigConstants.HIVE_STATS_AUTOGATHER, false);
    return result;
}
 
Example 2
Source File: TestHiveCatalogStore.java    From tajo with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void setUp() throws Exception {
  formatFactory = new StorageFormatFactory();
  Path testPath = CommonTestingUtil.getTestDir();
  warehousePath = new Path(testPath, "warehouse");

  //create local hiveMeta
  HiveConf conf = new HiveConf();
  String jdbcUri = "jdbc:derby:;databaseName="+testPath.toUri().getPath()+"metastore_db;create=true";
  conf.set(HiveConf.ConfVars.METASTOREWAREHOUSE.varname, warehousePath.toUri().toString());
  conf.set(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname, jdbcUri);
  conf.set(TajoConf.ConfVars.WAREHOUSE_DIR.varname, warehousePath.toUri().toString());
  conf.setBoolean("datanucleus.schema.autoCreateAll", true);

  // create local HiveCatalogStore.
  TajoConf tajoConf = new TajoConf(conf);
  store = new HiveCatalogStore(tajoConf);
  store.createDatabase(DB_NAME, null);
}
 
Example 3
Source File: StandaloneHiveServerContext.java    From HiveRunner with Apache License 2.0 6 votes vote down vote up
protected void configureTezExecutionEngine(HiveConf conf) {
    /*
    Tez local mode settings
     */
    conf.setBoolean(TezConfiguration.TEZ_LOCAL_MODE, true);
    conf.set("fs.defaultFS", "file:///");
    conf.setBoolean(TezRuntimeConfiguration.TEZ_RUNTIME_OPTIMIZE_LOCAL_FETCH, true);

    /*
    Set to be able to run tests offline
     */
    conf.set(TezConfiguration.TEZ_AM_DISABLE_CLIENT_VERSION_CHECK, "true");

    /*
    General attempts to strip of unnecessary functionality to speed up test execution and increase stability
     */
    conf.set(TezConfiguration.TEZ_AM_USE_CONCURRENT_DISPATCHER, "false");
    conf.set(TezConfiguration.TEZ_AM_CONTAINER_REUSE_ENABLED, "false");
    conf.set(TezConfiguration.DAG_RECOVERY_ENABLED, "false");
    conf.set(TezConfiguration.TEZ_TASK_GET_TASK_SLEEP_INTERVAL_MS_MAX, "1");
    conf.set(TezConfiguration.TEZ_AM_WEBSERVICE_ENABLE, "false");
    conf.set(TezConfiguration.DAG_RECOVERY_ENABLED, "false");
    conf.set(TezConfiguration.TEZ_AM_NODE_BLACKLISTING_ENABLED, "false");
}
 
Example 4
Source File: HiveAuthzBindingSessionHookV2.java    From incubator-sentry with Apache License 2.0 5 votes vote down vote up
/**
 * The session hook for sentry authorization that sets the required session level configuration 1.
 * Setup the sentry hooks - semantic, exec and filter hooks 2. Set additional config properties
 * required for auth set HIVE_EXTENDED_ENITITY_CAPTURE = true set SCRATCHDIRPERMISSION = 700 3.
 * Add sensitive config parameters to the config restrict list so that they can't be overridden by
 * users
 */
@Override
public void run(HiveSessionHookContext sessionHookContext) throws HiveSQLException {
  // Add sentry hooks to the session configuration
  HiveConf sessionConf = sessionHookContext.getSessionConf();

  appendConfVar(sessionConf, ConfVars.SEMANTIC_ANALYZER_HOOK.varname, SEMANTIC_HOOK);
  // enable sentry authorization V2
  sessionConf.setBoolean(HiveConf.ConfVars.HIVE_AUTHORIZATION_ENABLED.varname, true);
  sessionConf.setBoolean(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS.varname, false);
  sessionConf.set(HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER.varname,
      "org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator");

  // grant all privileges for table to its owner
  sessionConf.setVar(ConfVars.HIVE_AUTHORIZATION_TABLE_OWNER_GRANTS, "");

  // Enable compiler to capture transform URI referred in the query
  sessionConf.setBoolVar(ConfVars.HIVE_CAPTURE_TRANSFORM_ENTITY, true);

  // set security command list
  HiveAuthzConf authzConf = HiveAuthzBindingHook.loadAuthzConf(sessionConf);
  String commandWhitelist =
      authzConf.get(HiveAuthzConf.HIVE_SENTRY_SECURITY_COMMAND_WHITELIST,
          HiveAuthzConf.HIVE_SENTRY_SECURITY_COMMAND_WHITELIST_DEFAULT);
  sessionConf.setVar(ConfVars.HIVE_SECURITY_COMMAND_WHITELIST, commandWhitelist);

  // set additional configuration properties required for auth
  sessionConf.setVar(ConfVars.SCRATCHDIRPERMISSION, SCRATCH_DIR_PERMISSIONS);

  // setup restrict list
  sessionConf.addToRestrictList(ACCESS_RESTRICT_LIST);

  // set user name
  sessionConf.set(HiveAuthzConf.HIVE_ACCESS_SUBJECT_NAME, sessionHookContext.getSessionUser());
  sessionConf.set(HiveAuthzConf.HIVE_SENTRY_SUBJECT_NAME, sessionHookContext.getSessionUser());

  // Set MR ACLs to session user
  appendConfVar(sessionConf, JobContext.JOB_ACL_VIEW_JOB, sessionHookContext.getSessionUser());
  appendConfVar(sessionConf, JobContext.JOB_ACL_MODIFY_JOB, sessionHookContext.getSessionUser());
}
 
Example 5
Source File: HiveConfFactory.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
private void setConf(HiveConf hiveConf, String propertyName, boolean booleanValue) {
  hiveConf.setBoolean(propertyName, booleanValue);
}
 
Example 6
Source File: HiveConfFactory.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
private void setConf(HiveConf hiveConf, String propertyName, boolean booleanValue) {
  hiveConf.setBoolean(propertyName, booleanValue);
}