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


Java SessionState.getConf方法代码示例

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


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

示例1: getSessionSpecifiedClassLoader

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
/**
 * get session specified class loader and get current class loader if fall
 *
 * @return
 */
public static ClassLoader getSessionSpecifiedClassLoader() {
  SessionState state = SessionState.get();
  if (state == null || state.getConf() == null) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Hive Conf not found or Session not initiated, use thread based class loader instead");
    }
    return JavaUtils.getClassLoader();
  }
  ClassLoader sessionCL = state.getConf().getClassLoader();
  if (sessionCL != null) {
    if (LOG.isTraceEnabled()) {
      LOG.trace("Use session specified class loader");  //it's normal case
    }
    return sessionCL;
  }
  if (LOG.isDebugEnabled()) {
    LOG.debug("Session specified class loader not found, use thread based class loader");
  }
  return JavaUtils.getClassLoader();
}
 
开发者ID:mini666,项目名称:hive-phoenix-handler,代码行数:26,代码来源:Utilities.java

示例2: EmbeddedHive

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
/**
 * Create embedded Hive
 *
 * @param properties - Properties
 */
public EmbeddedHive(Properties properties) {
    HiveConf conf = new HiveConf();
    if (properties.get(PropertyNames.HIVE_JAR.toString()) != null) {
        //this line may be required so that the embedded derby works well
        //refers to dependencies containing ExecDriver class
        conf.setVar(HiveConf.ConfVars.HIVEJAR, properties.get(PropertyNames.HIVE_JAR.toString()).toString());
    }
    //this property is required so that every test runs on a different warehouse location.
    // This way we avoid conflicting scripts or dirty reexecutions
    File tmpDir = new File(System.getProperty(JAVA_IO_TMPDIR));
    warehouseDir = new File(tmpDir, UUID.randomUUID().toString());
    warehouseDir.mkdir();
    conf.setVar(HiveConf.ConfVars.METASTOREWAREHOUSE, warehouseDir.getAbsolutePath());

    ss = new SessionState(new HiveConf(conf, EmbeddedHive.class));
    SessionState.start(ss);
    c = ss.getConf();
}
 
开发者ID:jmrozanec,项目名称:hive-unit,代码行数:24,代码来源:EmbeddedHive.java

示例3: verifyLocalQuery

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
public void verifyLocalQuery(String queryStr) throws Exception {
  // setup Hive driver
  SessionState session = new SessionState(getHiveConf());
  SessionState.start(session);
  Driver driver = new Driver(session.getConf(), getUser());

  // compile the query
  CommandProcessorResponse compilerStatus = driver
      .compileAndRespond(queryStr);
  if (compilerStatus.getResponseCode() != 0) {
    String errMsg = compilerStatus.getErrorMessage();
    if (errMsg.contains(HiveAuthzConf.HIVE_SENTRY_PRIVILEGE_ERROR_MESSAGE)) {
      printMissingPerms(getHiveConf().get(
          HiveAuthzConf.HIVE_SENTRY_AUTH_ERRORS));
    }
    throw new SemanticException("Compilation error: "
        + compilerStatus.getErrorMessage());
  }
  driver.close();
  System.out
      .println("User " + getUser() + " has privileges to run the query");
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:23,代码来源:SentryConfigTool.java

示例4: HiveAuthzBindingHook

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
public HiveAuthzBindingHook() throws Exception {
  SessionState session = SessionState.get();
  if(session == null) {
    throw new IllegalStateException("Session has not been started");
  }
  // HACK: set a random classname to force the Auth V2 in Hive
  SessionState.get().setAuthorizer(null);

  HiveConf hiveConf = session.getConf();
  if(hiveConf == null) {
    throw new IllegalStateException("Session HiveConf is null");
  }
  authzConf = loadAuthzConf(hiveConf);
  hiveAuthzBinding = new HiveAuthzBinding(hiveConf, authzConf);

  String serdeWhiteLists = authzConf.get(HiveAuthzConf.HIVE_SENTRY_SERDE_WHITELIST,
      HiveAuthzConf.HIVE_SENTRY_SERDE_WHITELIST_DEFAULT);
  serdeWhiteList = Arrays.asList(serdeWhiteLists.split(","));
  serdeURIPrivilegesEnabled = authzConf.getBoolean(HiveAuthzConf.HIVE_SENTRY_SERDE_URI_PRIVILIEGES_ENABLED,
      HiveAuthzConf.HIVE_SENTRY_SERDE_URI_PRIVILIEGES_ENABLED_DEFAULT);

  FunctionRegistry.setupPermissionsForBuiltinUDFs("", HiveAuthzConf.HIVE_UDF_BLACK_LIST);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:24,代码来源:HiveAuthzBindingHook.java

示例5: restoreSessionSpecifiedClassLoader

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
public static void restoreSessionSpecifiedClassLoader(ClassLoader prev) {
  SessionState state = SessionState.get();
  if (state != null && state.getConf() != null) {
    ClassLoader current = state.getConf().getClassLoader();
    if (current != prev && JavaUtils.closeClassLoadersTo(current, prev)) {
      Thread.currentThread().setContextClassLoader(prev);
      state.getConf().setClassLoader(prev);
    }
  }
}
 
开发者ID:mini666,项目名称:hive-phoenix-handler,代码行数:11,代码来源:Utilities.java

示例6: SessionStateLite

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
/**
 * Creates a lightweight representation of the session state.
 *
 * @param plan The Hive query plan
 */
public SessionStateLite(QueryPlan plan) {

  SessionState sessionState = SessionState.get();

  this.conf = new HiveConf(sessionState.getConf());
  this.cmd = plan.getQueryStr();
  this.commandType = plan.getOperationName();
  this.queryId = plan.getQueryId();
  this.mapRedStats = new HashMap<>(sessionState.getMapRedStats());
}
 
开发者ID:airbnb,项目名称:reair,代码行数:16,代码来源:SessionStateLite.java

示例7: setUp

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
public void setUp() throws Exception {
    super.setUp();
    //SessionState.initHiveLog4j();
    ss = new SessionState(new HiveConf(HiveTestEmbedded.class));
    SessionState.start(ss);
    c = (HiveConf) ss.getConf();
}
 
开发者ID:jmrozanec,项目名称:hive-unit,代码行数:8,代码来源:HiveTestEmbedded.java

示例8: get

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
public static CommandProcessor get(String cmd, HiveConf conf) {
  String cmdl = cmd.toLowerCase();

  if ("set".equals(cmdl)) {
    return new SetProcessor();
  } else if ("reset".equals(cmdl)) {
    return new ResetProcessor();
  } else if ("dfs".equals(cmdl)) {
    SessionState ss = SessionState.get();
    return new DfsProcessor(ss.getConf());
  } else if ("add".equals(cmdl)) {
    return new AddResourceProcessor();
  } else if ("delete".equals(cmdl)) {
    return new DeleteResourceProcessor();
  } else if (!isBlank(cmd)) {
    if (conf == null) {
      return new SkinDriver();
    }

    SkinDriver drv = (SkinDriver) mapDrivers.get(conf);
    if (drv == null) {
      drv = new SkinDriver();
      mapDrivers.put(conf, drv);
    }
    drv.init();
    return drv;
  }

  return null;
}
 
开发者ID:adrian-wang,项目名称:project-panthera-skin,代码行数:31,代码来源:PantheraProcessorFactory.java

示例9: HiveAuthzBindingHookV2

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
public HiveAuthzBindingHookV2() throws Exception {
  SessionState session = SessionState.get();
  if(session == null) {
    throw new IllegalStateException("Session has not been started");
  }

  HiveConf hiveConf = session.getConf();
  if(hiveConf == null) {
    throw new IllegalStateException("Session HiveConf is null");
  }
  authzConf = HiveAuthzBindingHook.loadAuthzConf(hiveConf);
  hiveAuthzBinding = new HiveAuthzBinding(hiveConf, authzConf);
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:14,代码来源:HiveAuthzBindingHookV2.java

示例10: PantheraCliDriver

import org.apache.hadoop.hive.ql.session.SessionState; //导入方法依赖的package包/类
public PantheraCliDriver() {
  SessionState ss = SessionState.get();
  conf = (ss != null) ? ss.getConf() : new Configuration();
  Log LOG = LogFactory.getLog("PantheraCliDriver");
  console = new LogHelper(LOG);
}
 
开发者ID:adrian-wang,项目名称:project-panthera-skin,代码行数:7,代码来源:PantheraCliDriver.java


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