use of org.apache.hadoop.hive.ql.IDriver in project hive by apache.
the class TestCounterMapping method testMappingJoinLookup.
@Test
@Ignore("needs HiveFilter mapping")
public void testMappingJoinLookup() throws ParseException {
IDriver driver = createDriver();
PlanMapper pm0 = getMapperForQuery(driver, "select sum(tu.id_uv),sum(u) from tu join tv on (tu.id_uv = tv.id_uv) where u>1 and v>1");
Iterator<LinkGroup> itG = pm0.iterateGroups();
int checkedOperators = 0;
while (itG.hasNext()) {
LinkGroup g = itG.next();
List<HiveFilter> hfs = g.getAll(HiveFilter.class);
List<OperatorStats> oss = g.getAll(OperatorStats.class);
List<FilterOperator> fos = g.getAll(FilterOperator.class);
if (fos.size() > 0 && oss.size() > 0) {
if (hfs.size() == 0) {
fail("HiveFilter is not connected?");
}
OperatorStats os = oss.get(0);
if (!(os.getOutputRecords() == 3 || os.getOutputRecords() == 6)) {
fail("nonexpected number of records produced");
}
checkedOperators++;
}
}
assertEquals(2, checkedOperators);
}
use of org.apache.hadoop.hive.ql.IDriver in project hive by apache.
the class TestOperatorCmp method testDifferentFiltersAreNotMatched1.
@Test
public void testDifferentFiltersAreNotMatched1() 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 u from tu where id_uv = 2 group by u");
assertHelper(AssertHelperOp.SAME, pm0, pm1, TableScanOperator.class);
assertHelper(AssertHelperOp.NOT_SAME, pm0, pm1, FilterOperator.class);
}
use of org.apache.hadoop.hive.ql.IDriver in project hive by apache.
the class TestOperatorCmp method testUnrelatedFiltersAreNotMatched0.
@Test
public void testUnrelatedFiltersAreNotMatched0() throws ParseException {
IDriver driver = createDriver();
String query = "select u from tu where id_uv = 1 union all select v from tv where id_uv = 1";
PlanMapper pm = getMapperForQuery(driver, query);
Iterator<LinkGroup> itG = pm.iterateGroups();
List<FilterOperator> fos = pm.getAll(FilterOperator.class);
assertEquals(2, fos.size());
assertFalse("logicalEquals", compareOperators(fos.get(0), fos.get(1)));
}
use of org.apache.hadoop.hive.ql.IDriver in project hive by apache.
the class TestOperatorCmp method testSameFiltersMatched1.
@Test
public void testSameFiltersMatched1() throws ParseException, Exception {
IDriver driver = createDriver();
PlanMapper pm0 = getMapperForQuery(driver, "select u from tu where id_uv = 1 group by u");
PlanMapper pm1 = getMapperForQuery(driver, "select u from tu where id_uv = 1 group by u");
assertHelper(AssertHelperOp.SAME, pm0, pm1, FilterOperator.class);
assertHelper(AssertHelperOp.SAME, pm0, pm1, TableScanOperator.class);
}
use of org.apache.hadoop.hive.ql.IDriver 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)));
}
Aggregations