use of org.apache.hadoop.hive.ql.reexec.ReExecDriver 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());
}
Aggregations