use of org.apache.hadoop.hive.ql.IDriver in project hive by apache.
the class TestOperatorCmp method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
IDriver driver = createDriver();
dropTables(driver);
String[] cmds = { // @formatter:off
"create table tu(id_uv int,id_uw int,u int)", "create table tv(id_uv int,v int)", "create table tw(id_uw int,w int)", "insert into tu values (10,10,10),(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),(6,6,6)", "insert into tv values (10,10),(1,1),(2,2),(3,3)", "insert into tw values (10,10),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9)" // @formatter:on
};
for (String cmd : cmds) {
int ret = driver.run(cmd).getResponseCode();
assertEquals("Checking command success", 0, ret);
}
}
use of org.apache.hadoop.hive.ql.IDriver in project hive by apache.
the class TestReOptimization method afterClass.
@AfterClass
public static void afterClass() throws Exception {
IDriver driver = createDriver("");
dropTables(driver);
}
use of org.apache.hadoop.hive.ql.IDriver 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.IDriver 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.IDriver 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());
}
Aggregations