Search in sources :

Example 26 with IDriver

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

the class TestCounterMapping method afterClass.

@AfterClass
public static void afterClass() throws Exception {
    IDriver driver = createDriver();
    dropTables(driver);
}
Also used : IDriver(org.apache.hadoop.hive.ql.IDriver) AfterClass(org.junit.AfterClass)

Example 27 with IDriver

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

the class TestOperatorCmp method afterClass.

@AfterClass
public static void afterClass() throws Exception {
    IDriver driver = createDriver();
    dropTables(driver);
}
Also used : IDriver(org.apache.hadoop.hive.ql.IDriver) AfterClass(org.junit.AfterClass)

Example 28 with IDriver

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

the class TestOperatorCmp method createDriver.

private static IDriver createDriver() {
    HiveConf conf = env_setup.getTestCtx().hiveConf;
    conf.setBoolVar(ConfVars.HIVE_QUERY_REEXECUTION_ENABLED, true);
    conf.setBoolVar(ConfVars.HIVE_QUERY_REEXECUTION_ALWAYS_COLLECT_OPERATOR_STATS, true);
    conf.setVar(ConfVars.HIVE_QUERY_REEXECUTION_STRATEGIES, "reoptimize");
    conf.set("zzz", "1");
    conf.set("reexec.overlay.zzz", "2000");
    // 
    conf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
    HiveConf.setBoolVar(conf, HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    HiveConf.setVar(conf, HiveConf.ConfVars.POSTEXECHOOKS, OperatorStatsReaderHook.class.getName());
    SessionState.start(conf);
    IDriver driver = DriverFactory.newDriver(conf);
    return driver;
}
Also used : IDriver(org.apache.hadoop.hive.ql.IDriver) HiveConf(org.apache.hadoop.hive.conf.HiveConf) OperatorStatsReaderHook(org.apache.hadoop.hive.ql.stats.OperatorStatsReaderHook)

Example 29 with IDriver

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

the class TestReOptimization method testExplainSupport.

@Test
public void testExplainSupport() throws Exception {
    IDriver driver = createDriver("overlay,reoptimize");
    String query = "explain reoptimization select 1 from tu join tv on (tu.id_uv=tv.id_uv) where u<10 and v>1";
    PlanMapper pm = getMapperForQuery(driver, query);
    List<String> res = new ArrayList<>();
    List<String> res1 = new ArrayList<>();
    while (driver.getResults(res1)) {
        res.addAll(res1);
    }
    assertEquals("2TS", 2, res.stream().filter(line -> line.contains("TS_")).count());
    assertEquals("2TS(runtime)", 2, res.stream().filter(line -> line.contains("TS") && line.contains("runtime")).count());
}
Also used : PlanMapper(org.apache.hadoop.hive.ql.plan.mapper.PlanMapper) ArrayList(java.util.ArrayList) IDriver(org.apache.hadoop.hive.ql.IDriver) Test(org.junit.Test)

Aggregations

IDriver (org.apache.hadoop.hive.ql.IDriver)29 Test (org.junit.Test)11 PlanMapper (org.apache.hadoop.hive.ql.plan.mapper.PlanMapper)10 HiveConf (org.apache.hadoop.hive.conf.HiveConf)7 FilterOperator (org.apache.hadoop.hive.ql.exec.FilterOperator)5 CommandProcessorResponse (org.apache.hadoop.hive.ql.processors.CommandProcessorResponse)4 AfterClass (org.junit.AfterClass)4 BeforeClass (org.junit.BeforeClass)4 PrintStream (java.io.PrintStream)3 ArrayList (java.util.ArrayList)3 CliSessionState (org.apache.hadoop.hive.cli.CliSessionState)3 LinkGroup (org.apache.hadoop.hive.ql.plan.mapper.PlanMapper.LinkGroup)3 OperatorStatsReaderHook (org.apache.hadoop.hive.ql.stats.OperatorStatsReaderHook)3 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 LogInitializationException (org.apache.hadoop.hive.common.LogUtils.LogInitializationException)2 OperatorStats (org.apache.hadoop.hive.ql.stats.OperatorStats)2 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 SQLException (java.sql.SQLException)1