Search in sources :

Example 6 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestExplainTask method testOutputPlanVectorizationJsonShouldMatch.

@Test
public void testOutputPlanVectorizationJsonShouldMatch() throws Exception {
    QueryState qs = mock(QueryState.class);
    when(qs.getHiveOperation()).thenReturn(HiveOperation.EXPLAIN);
    HiveConf hiveConf = new HiveConf();
    hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_VECTORIZATION_ENABLED, true);
    when(qs.getConf()).thenReturn(hiveConf);
    uut.queryState = qs;
    JsonNode result = objectMapper.readTree(uut.outputPlanVectorization(null, true).getRight().toString());
    JsonNode expected = objectMapper.readTree("{\"enabled\":true,\"enabledConditionsMet\":[\"hive.vectorized.execution.enabled IS true\"]}");
    assertEquals(expected, result);
    hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_VECTORIZATION_ENABLED, false);
    result = objectMapper.readTree(uut.outputPlanVectorization(null, true).getRight().toString());
    expected = objectMapper.readTree("{\"enabled\":false,\"enabledConditionsNotMet\":[\"hive.vectorized.execution.enabled IS false\"]}");
    assertEquals(expected, result);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) JsonNode(com.fasterxml.jackson.databind.JsonNode) QueryState(org.apache.hadoop.hive.ql.QueryState) Test(org.junit.Test)

Example 7 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestQBJoinTreeApplyPredicate method initialize.

@BeforeClass
public static void initialize() {
    queryState = new QueryState.Builder().withHiveConf(new HiveConf(SemanticAnalyzer.class)).build();
    conf = queryState.getConf();
    SessionState.start(conf);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) QueryState(org.apache.hadoop.hive.ql.QueryState) BeforeClass(org.junit.BeforeClass)

Example 8 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestQBSubQuery method initialize.

@BeforeClass
public static void initialize() {
    queryState = new QueryState.Builder().withHiveConf(new HiveConf(SemanticAnalyzer.class)).build();
    conf = queryState.getConf();
    SessionState.start(conf);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) QueryState(org.apache.hadoop.hive.ql.QueryState) BeforeClass(org.junit.BeforeClass)

Example 9 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestUpdateDeleteSemanticAnalyzer method setup.

@Before
public void setup() {
    queryState = new QueryState(null);
    conf = queryState.getConf();
    conf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
    conf.setVar(HiveConf.ConfVars.DYNAMICPARTITIONINGMODE, "nonstrict");
    conf.setVar(HiveConf.ConfVars.HIVEMAPREDMODE, "nonstrict");
    conf.setVar(HiveConf.ConfVars.HIVE_TXN_MANAGER, "org.apache.hadoop.hive.ql.lockmgr.DbTxnManager");
}
Also used : QueryState(org.apache.hadoop.hive.ql.QueryState) Before(org.junit.Before)

Example 10 with QueryState

use of org.apache.hadoop.hive.ql.QueryState in project hive by apache.

the class TestSemanticAnalyzerFactory method setup.

@Before
public void setup() throws Exception {
    queryState = new QueryState(null);
    conf = queryState.getConf();
}
Also used : QueryState(org.apache.hadoop.hive.ql.QueryState) Before(org.junit.Before)

Aggregations

QueryState (org.apache.hadoop.hive.ql.QueryState)15 HiveConf (org.apache.hadoop.hive.conf.HiveConf)9 ArrayList (java.util.ArrayList)3 Context (org.apache.hadoop.hive.ql.Context)3 Before (org.junit.Before)3 BeforeClass (org.junit.BeforeClass)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 IOException (java.io.IOException)2 Path (org.apache.hadoop.fs.Path)2 CompilationOpContext (org.apache.hadoop.hive.ql.CompilationOpContext)2 Hive (org.apache.hadoop.hive.ql.metadata.Hive)2 CalciteSemanticException (org.apache.hadoop.hive.ql.optimizer.calcite.CalciteSemanticException)2 ASTNode (org.apache.hadoop.hive.ql.parse.ASTNode)2 CalcitePlanner (org.apache.hadoop.hive.ql.parse.CalcitePlanner)2 SerDeException (org.apache.hadoop.hive.serde2.SerDeException)2 Test (org.junit.Test)2 PrintStream (java.io.PrintStream)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 List (java.util.List)1