Search in sources :

Example 76 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class TestHiveMetaStorePartitionSpecs method startMetaStoreServer.

@BeforeClass
public static void startMetaStoreServer() throws Exception {
    HiveConf metastoreConf = new HiveConf();
    metastoreConf.setClass(HiveConf.ConfVars.METASTORE_EXPRESSION_PROXY_CLASS.varname, MockPartitionExpressionForMetastore.class, PartitionExpressionProxy.class);
    msPort = MetaStoreUtils.startMetaStore(metastoreConf);
    securityManager = System.getSecurityManager();
    System.setSecurityManager(new NoExitSecurityManager());
    hiveConf = new HiveConf(TestHiveMetaStorePartitionSpecs.class);
    hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + msPort);
    hiveConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
    hiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
    hiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
    hiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    hiveConf.set(HiveConf.ConfVars.METASTORE_EXPRESSION_PROXY_CLASS.name(), MockPartitionExpressionForMetastore.class.getCanonicalName());
    System.setProperty(HiveConf.ConfVars.PREEXECHOOKS.varname, " ");
    System.setProperty(HiveConf.ConfVars.POSTEXECHOOKS.varname, " ");
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) BeforeClass(org.junit.BeforeClass)

Example 77 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class TestHiveMetaStoreTimeout method setUp.

@BeforeClass
public static void setUp() throws Exception {
    HiveMetaStore.TEST_TIMEOUT_ENABLED = true;
    hiveConf = new HiveConf(TestHiveMetaStoreTimeout.class);
    hiveConf.setBoolean(HiveConf.ConfVars.HIVE_WAREHOUSE_SUBDIR_INHERIT_PERMS.varname, true);
    hiveConf.set(HiveConf.ConfVars.METASTORE_EXPRESSION_PROXY_CLASS.varname, MockPartitionExpressionForMetastore.class.getCanonicalName());
    hiveConf.setTimeVar(HiveConf.ConfVars.METASTORE_CLIENT_SOCKET_TIMEOUT, 10 * 1000, TimeUnit.MILLISECONDS);
    warehouse = new Warehouse(hiveConf);
    try {
        client = new HiveMetaStoreClient(hiveConf);
    } catch (Throwable e) {
        System.err.println("Unable to open the metastore");
        System.err.println(StringUtils.stringifyException(e));
        throw e;
    }
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) BeforeClass(org.junit.BeforeClass)

Example 78 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class TestHiveMetastoreCli method testOverriddenCliPortValue.

@Test
public void testOverriddenCliPortValue() {
    HiveConf configuration = new HiveConf();
    HiveMetaStore.HiveMetastoreCli cli = new HiveMetaStore.HiveMetastoreCli(configuration);
    cli.parse(TestHiveMetastoreCli.CLI_ARGUMENTS);
    assert (cli.getPort() == 9999);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) Test(org.junit.Test)

Example 79 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class TestHiveMetastoreCli method testDefaultCliPortValue.

@Test
public void testDefaultCliPortValue() {
    HiveConf configuration = new HiveConf();
    HiveMetaStore.HiveMetastoreCli cli = new HiveMetaStore.HiveMetastoreCli(configuration);
    assert (cli.getPort() == HiveConf.getIntVar(configuration, HiveConf.ConfVars.METASTORE_SERVER_PORT));
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) Test(org.junit.Test)

Example 80 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class ExplainTask method outputPlanVectorization.

private ImmutablePair<Boolean, JSONObject> outputPlanVectorization(PrintStream out, boolean jsonOutput) throws Exception {
    if (out != null) {
        out.println("PLAN VECTORIZATION:");
    }
    JSONObject json = jsonOutput ? new JSONObject(new LinkedHashMap<>()) : null;
    HiveConf hiveConf = queryState.getConf();
    boolean isVectorizationEnabled = HiveConf.getBoolVar(hiveConf, HiveConf.ConfVars.HIVE_VECTORIZATION_ENABLED);
    String isVectorizationEnabledCondName = (isVectorizationEnabled ? trueCondNameVectorizationEnabled : falseCondNameVectorizationEnabled);
    List<String> isVectorizationEnabledCondList = Arrays.asList(isVectorizationEnabledCondName);
    if (out != null) {
        out.print(indentString(2));
        out.print("enabled: ");
        out.println(isVectorizationEnabled);
        out.print(indentString(2));
        if (!isVectorizationEnabled) {
            out.print("enabledConditionsNotMet: ");
        } else {
            out.print("enabledConditionsMet: ");
        }
        out.println(isVectorizationEnabledCondList);
    }
    if (jsonOutput) {
        json.put("enabled", isVectorizationEnabled);
        if (!isVectorizationEnabled) {
            json.put("enabledConditionsNotMet", isVectorizationEnabledCondList);
        } else {
            json.put("enabledConditionsMet", isVectorizationEnabledCondList);
        }
    }
    return new ImmutablePair<Boolean, JSONObject>(isVectorizationEnabled, jsonOutput ? json : null);
}
Also used : JSONObject(org.json.JSONObject) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) HiveConf(org.apache.hadoop.hive.conf.HiveConf) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

HiveConf (org.apache.hadoop.hive.conf.HiveConf)404 BeforeClass (org.junit.BeforeClass)73 Test (org.junit.Test)66 Path (org.apache.hadoop.fs.Path)54 Before (org.junit.Before)50 Driver (org.apache.hadoop.hive.ql.Driver)46 CliSessionState (org.apache.hadoop.hive.cli.CliSessionState)44 IOException (java.io.IOException)39 ArrayList (java.util.ArrayList)37 File (java.io.File)31 HashMap (java.util.HashMap)26 FileSystem (org.apache.hadoop.fs.FileSystem)26 SessionState (org.apache.hadoop.hive.ql.session.SessionState)22 LinkedHashMap (java.util.LinkedHashMap)17 List (java.util.List)16 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)15 MiniHS2 (org.apache.hive.jdbc.miniHS2.MiniHS2)14 Map (java.util.Map)12 HiveMetaStoreClient (org.apache.hadoop.hive.metastore.HiveMetaStoreClient)12 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)12