use of org.apache.hadoop.hive.ql.plan.mapper.PlanMapper in project hive by apache.
the class TestOperatorCmp method testUnrelatedFiltersAreNotMatched1.
@Test
public void testUnrelatedFiltersAreNotMatched1() throws ParseException {
IDriver driver = createDriver();
PlanMapper pm0 = getMapperForQuery(driver, "select u from tu where id_uv = 1 group by u");
PlanMapper pm1 = getMapperForQuery(driver, "select v from tv where id_uv = 1 group by v");
List<FilterOperator> fos0 = pm0.getAll(FilterOperator.class);
List<FilterOperator> fos1 = pm1.getAll(FilterOperator.class);
assertEquals(1, fos0.size());
assertEquals(1, fos1.size());
assertFalse("logicalEquals", compareOperators(fos0.get(0), fos1.get(0)));
}
use of org.apache.hadoop.hive.ql.plan.mapper.PlanMapper in project hive by apache.
the class TestReOptimization method testReExecutedIfMapJoinError.
@Test
public void testReExecutedIfMapJoinError() throws Exception {
IDriver driver = createDriver("overlay,reoptimize");
String query = "select assert_true_oom(${hiveconf:zzz}>sum(1)) from tu join tv on (tu.id_uv=tv.id_uv) where u<10 and v>1";
PlanMapper pm = getMapperForQuery(driver, query);
}
use of org.apache.hadoop.hive.ql.plan.mapper.PlanMapper in project hive by apache.
the class TestReOptimization method testStatsAreSetInReopt.
@Test
public void testStatsAreSetInReopt() throws Exception {
IDriver driver = createDriver("overlay,reoptimize");
String query = "select assert_true_oom(${hiveconf:zzz} > sum(u*v)) from tu join tv on (tu.id_uv=tv.id_uv) where u<10 and v>1";
PlanMapper pm = getMapperForQuery(driver, query);
Iterator<LinkGroup> itG = pm.iterateGroups();
int checkedOperators = 0;
while (itG.hasNext()) {
LinkGroup g = itG.next();
List<FilterOperator> fos = g.getAll(FilterOperator.class);
List<OperatorStats> oss = g.getAll(OperatorStats.class);
if (fos.size() > 0 && oss.size() > 0) {
fos.sort(TestCounterMapping.OPERATOR_ID_COMPARATOR.reversed());
FilterOperator fo = fos.get(0);
OperatorStats os = oss.get(0);
Statistics stats = fo.getStatistics();
assertEquals(os.getOutputRecords(), stats.getNumRows());
if (!(os.getOutputRecords() == 3 || os.getOutputRecords() == 6)) {
fail("nonexpected number of records produced");
}
checkedOperators++;
}
}
assertEquals(2, checkedOperators);
}
use of org.apache.hadoop.hive.ql.plan.mapper.PlanMapper in project hive by apache.
the class TestReOptimization method testNotReExecutedIfAssertionError.
@Test(expected = CommandProcessorResponse.class)
public void testNotReExecutedIfAssertionError() throws Exception {
IDriver driver = createDriver("reoptimize");
String query = "select assert_true(${hiveconf:zzz}>sum(1)) from tu join tv on (tu.id_uv=tv.id_uv) where u<10 and v>1";
PlanMapper pm = getMapperForQuery(driver, query);
assertEquals(1, driver.getContext().getExecutionIndex());
}
use of org.apache.hadoop.hive.ql.plan.mapper.PlanMapper in project hive by apache.
the class TestReOptimization method getMapperForQuery.
private PlanMapper getMapperForQuery(IDriver driver, String query) throws CommandProcessorResponse {
CommandProcessorResponse res = driver.run(query);
if (res.getResponseCode() != 0) {
throw res;
}
PlanMapper pm0 = driver.getContext().getPlanMapper();
return pm0;
}
Aggregations