Search in sources :

Example 1 with SimpleRuntimeStatsSource

use of org.apache.hadoop.hive.ql.plan.mapper.SimpleRuntimeStatsSource in project hive by apache.

the class ReOptimizePlugin method prepareToReExecute.

@Override
public void prepareToReExecute() {
    statsReaderHook.setCollectOnSuccess(true);
    PlanMapper pm = coreDriver.getContext().getPlanMapper();
    coreDriver.setRuntimeStatsSource(new SimpleRuntimeStatsSource(pm));
    retryPossible = false;
}
Also used : SimpleRuntimeStatsSource(org.apache.hadoop.hive.ql.plan.mapper.SimpleRuntimeStatsSource) PlanMapper(org.apache.hadoop.hive.ql.plan.mapper.PlanMapper)

Example 2 with SimpleRuntimeStatsSource

use of org.apache.hadoop.hive.ql.plan.mapper.SimpleRuntimeStatsSource in project hive by apache.

the class TestCounterMapping method testUsageOfRuntimeInfo.

@Test
public void testUsageOfRuntimeInfo() throws ParseException {
    IDriver driver = createDriver();
    String query = "select sum(u) from tu where u>1";
    PlanMapper pm1 = getMapperForQuery(driver, query);
    List<FilterOperator> filters1 = pm1.getAll(FilterOperator.class);
    filters1.sort(OPERATOR_ID_COMPARATOR.reversed());
    FilterOperator filter1 = filters1.get(0);
    driver = createDriver();
    ((ReExecDriver) driver).setRuntimeStatsSource(new SimpleRuntimeStatsSource(pm1));
    PlanMapper pm2 = getMapperForQuery(driver, query);
    List<FilterOperator> filters2 = pm2.getAll(FilterOperator.class);
    filters2.sort(OPERATOR_ID_COMPARATOR.reversed());
    FilterOperator filter2 = filters2.get(0);
    assertEquals("original check", 7, filter1.getStatistics().getNumRows());
    assertEquals("optimized check", 6, filter2.getStatistics().getNumRows());
}
Also used : FilterOperator(org.apache.hadoop.hive.ql.exec.FilterOperator) SimpleRuntimeStatsSource(org.apache.hadoop.hive.ql.plan.mapper.SimpleRuntimeStatsSource) PlanMapper(org.apache.hadoop.hive.ql.plan.mapper.PlanMapper) IDriver(org.apache.hadoop.hive.ql.IDriver) ReExecDriver(org.apache.hadoop.hive.ql.reexec.ReExecDriver) Test(org.junit.Test)

Aggregations

PlanMapper (org.apache.hadoop.hive.ql.plan.mapper.PlanMapper)2 SimpleRuntimeStatsSource (org.apache.hadoop.hive.ql.plan.mapper.SimpleRuntimeStatsSource)2 IDriver (org.apache.hadoop.hive.ql.IDriver)1 FilterOperator (org.apache.hadoop.hive.ql.exec.FilterOperator)1 ReExecDriver (org.apache.hadoop.hive.ql.reexec.ReExecDriver)1 Test (org.junit.Test)1