Package org.apache.hadoop.hive.conf

Examples of org.apache.hadoop.hive.conf.HiveConf


import org.apache.hadoop.hive.ql.session.SessionState.LogHelper;

public class MapJoinCounterHook implements ExecuteWithHookContext {

  public void run(HookContext hookContext) {
    HiveConf conf = hookContext.getConf();
    boolean enableConvert = HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVECONVERTJOIN);
    if (!enableConvert) {
      return;
    }
View Full Code Here


      return threadLocalId.get();
    }

    public HMSHandler(String name) throws MetaException {
      super(name);
      hiveConf = new HiveConf(this.getClass());
      init();
    }
View Full Code Here

  public static void main(String[] args) {

    SessionState.initHiveLog4j();

    CliSessionState ss = new CliSessionState(new HiveConf(SessionState.class));
    ss.in = System.in;
    try {
      ss.out = new PrintStream(System.out, true, "UTF-8");
      ss.err = new PrintStream(System.err, true, "UTF-8");
    } catch (UnsupportedEncodingException e) {
      System.exit(1);
    }

    HiveConf conf = ss.getConf();

    HiveConf.setVar(conf, ConfVars.SEMANTIC_ANALYZER_HOOK, HowlSemanticAnalyzer.class.getName());

    SessionState.start(ss);

    DefaultOptionBuilder builder = new DefaultOptionBuilder("-", "--", false);
    ArgumentBuilder argBuilder = new ArgumentBuilder();
    // -e
    Option execOption = createOptionWithArg(builder, "exec", "e", "execute the following command",argBuilder.withMinimum(1).withMaximum(1).create());
    // -f
    Option fileOption = createOptionWithArg(builder, "file", "f","execute commands from the following file", argBuilder.withMinimum(1).withMaximum(1).create());
    // -g
    Option grpOption = createOptionWithArg(builder, "group", "g","group for the db/table specified in CREATE statement", argBuilder.withMinimum(1).withMaximum(1).create());
    // -p
    Option permOption = createOptionWithArg(builder, "perms", "p","permissions for the db/table specified in CREATE statement",
        argBuilder.withMinimum(1).withMaximum(1).create());

    builder.reset();
    Option isHelpOption =  builder.withShortName("h").withLongName("help").withDescription("help").create();
    new PropertyOption();
    Group allOptions = new GroupBuilder().withOption(isHelpOption).withOption(execOption).withOption(fileOption).withOption(grpOption).withOption(permOption).create();

    Parser parser = new Parser();
    parser.setGroup(allOptions);
    CommandLine cmdLine = null;

    try {
      cmdLine  = parser.parse(args);

    } catch (OptionException e1) {
      printErrString(null, System.err);
      System.exit(1);
    }
    // -e
    String execString = (String) cmdLine.getValue(execOption);
    // -f
    String fileName = (String) cmdLine.getValue(fileOption);
    // -h
    if (cmdLine.hasOption(isHelpOption)) {
      printErrString(null, System.out);
      System.exit(1);
    }

    if (execString != null && fileName != null) {
      printErrString("Please specify either -e or -f option.", System.err);
      System.exit(1);
    }

    // -p
    String perms = (String) cmdLine.getValue(permOption);
    if(perms != null){
      validatePermissions(ss, conf, perms);
    }

    // -g
    String grp = (String) cmdLine.getValue(grpOption);
    if(grp != null){
      conf.set(HowlConstants.HOWL_GROUP, grp);
    }

    if (execString != null) {
      System.exit(processLine(execString));
    }
View Full Code Here

  private static HiveMetaStoreClient createHiveMetaClient(String serverUri,
      String serverKerberosPrincipal, Class clazz) throws Exception {
    if (client != null){
      return client;
    }
    HiveConf hiveConf = new HiveConf(clazz);

    if (serverUri != null){
/*
      hiveConf.setBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL, true);
      hiveConf.setVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL, serverKerberosPrincipal);
*/
      hiveConf.set("hive.metastore.local", "false");
      hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, serverUri.trim());
    }
    try {
      client = new HiveMetaStoreClient(hiveConf,null);
    } catch (Exception e){
      throw new Exception("Could not instantiate a HiveMetaStoreClient connecting to server uri:["+serverUri+"]",e);
View Full Code Here

  public static void startMetaStore(int port, HadoopThriftAuthBridge bridge)
  throws Throwable {
    try {

      HMSHandler handler = new HMSHandler("new db based metaserver");
      HiveConf conf = handler.getHiveConf();

      // Server will create new threads up to max as necessary. After an idle
      // period, it will destory threads to keep the number of threads in the
      // pool to min.
      int minWorkerThreads = conf.getIntVar(HiveConf.ConfVars.METASTORESERVERMINTHREADS);
      int maxWorkerThreads = conf.getIntVar(HiveConf.ConfVars.METASTORESERVERMAXTHREADS);
      boolean tcpKeepAlive = conf.getBoolVar(HiveConf.ConfVars.METASTORE_TCP_KEEP_ALIVE);
      boolean useSasl = conf.getBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL);

      TServerTransport serverTransport = tcpKeepAlive ?
          new TServerSocketKeepAlive(port) : new TServerSocket(port);

      TProcessor processor = new ThriftHiveMetastore.Processor(handler);
      TTransportFactory transFactory;
      if (useSasl) {
         saslServer = bridge.createServer(
           conf.getVar(HiveConf.ConfVars.METASTORE_KERBEROS_KEYTAB_FILE),
           conf.getVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL));

        // start delegation token manager
        saslServer.startDelegationTokenSecretManager(conf);
        transFactory = saslServer.createTransportFactory();
        processor = saslServer.wrapProcessor(processor);
View Full Code Here

  public QTestUtil(String outDir, String logDir, boolean miniMr, String hadoopVer)
    throws Exception {
    this.outDir = outDir;
    this.logDir = logDir;
    conf = new HiveConf(Driver.class);
    this.miniMr = miniMr;
    this.hadoopVer = getHadoopMainVersion(hadoopVer);
    qMap = new TreeMap<String, String>();
    qSkipSet = new HashSet<String>();
View Full Code Here

      for (String roleName : roleNames) {
        db.dropRole(roleName);
    }
    // allocate and initialize a new conf since a test can
    // modify conf by using 'set' commands
    conf = new HiveConf (Driver.class);
    initConf();
    setup.preTest(conf);
  }
View Full Code Here

            throw new HowlException(ErrorType.ERROR_INIT_STORAGE_DRIVER, e);
        }
    }

    static HiveMetaStoreClient createHiveClient(String url, Configuration conf) throws IOException, MetaException {
      HiveConf hiveConf = new HiveConf(HowlOutputFormat.class);

      if( url != null ) {
        //User specified a thrift url
/*
        hiveConf.setBoolean(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL.varname, true);

        hiveConf.set(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL.varname, conf.get(HowlConstants.HOWL_METASTORE_PRINCIPAL));
*/
        hiveConf.set("hive.metastore.local", "false");
        hiveConf.set(HiveConf.ConfVars.METASTOREURIS.varname, url);
        if(conf.get(HOWL_KEY_TOKEN_SIGNATURE) != null) {
          hiveConf.set("hive.metastore.token.signature", conf.get(HOWL_KEY_TOKEN_SIGNATURE));
        }
      } else {
        //Thrift url is null, copy the hive conf into the job conf and restore it
        //in the backend context

        if( conf.get(HOWL_KEY_HIVE_CONF) == null ) {
          conf.set(HOWL_KEY_HIVE_CONF, HowlUtil.serialize(hiveConf.getAllProperties()));
        } else {
          //Copy configuration properties into the hive conf
          Properties properties = (Properties) HowlUtil.deserialize(conf.get(HOWL_KEY_HIVE_CONF));

          for(Map.Entry<Object, Object> prop : properties.entrySet() ) {
            if( prop.getValue() instanceof String ) {
              hiveConf.set((String) prop.getKey(), (String) prop.getValue());
            } else if( prop.getValue() instanceof Integer ) {
              hiveConf.setInt((String) prop.getKey(), (Integer) prop.getValue());
            } else if( prop.getValue() instanceof Boolean ) {
              hiveConf.setBoolean((String) prop.getKey(), (Boolean) prop.getValue());
            } else if( prop.getValue() instanceof Long ) {
              hiveConf.setLong((String) prop.getKey(), (Long) prop.getValue());
            } else if( prop.getValue() instanceof Float ) {
              hiveConf.setFloat((String) prop.getKey(), (Float) prop.getValue());
            }
          }
        }

      }
View Full Code Here

  private static final String TEST_DB1_NAME = "testdb1";
  private static final String TEST_DB2_NAME = "testdb2";

  @Override
  protected void setUp() throws Exception {
    hiveConf = new HiveConf(this.getClass());
    warehouse = new Warehouse(hiveConf);

    // set some values to use for getting conf. vars
    hiveConf.set("hive.key1", "value1");
    hiveConf.set("hive.key2", "http://www.example.com");
View Full Code Here

     */
    public HiveServerHandler() throws MetaException {
      super(HiveServer.class.getName());

      isHiveQuery = false;
      SessionState session = new SessionState(new HiveConf(SessionState.class));
      SessionState.start(session);
      session.in = null;
      session.out = null;
      session.err = null;
      driver = new Driver();
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hive.conf.HiveConf

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.