use of org.apache.hadoop.hive.ql.QueryDisplay in project hive by apache.
the class TestQueryDisplay method verifyDDL.
private void verifyDDL(SQLOperationDisplay display, String stmt, String handle, boolean finished) {
Assert.assertEquals(display.getUserName(), "testuser");
Assert.assertEquals(display.getExecutionEngine(), "mr");
Assert.assertEquals(display.getOperationId(), handle);
Assert.assertTrue(display.getBeginTime() > 0 && display.getBeginTime() <= System.currentTimeMillis());
if (finished) {
Assert.assertTrue(display.getEndTime() > 0 && display.getEndTime() >= display.getBeginTime() && display.getEndTime() <= System.currentTimeMillis());
Assert.assertTrue(display.getRuntime() > 0);
} else {
Assert.assertNull(display.getEndTime());
//For runtime, query may have finished.
}
QueryDisplay qDisplay1 = display.getQueryDisplay();
Assert.assertNotNull(qDisplay1);
Assert.assertEquals(qDisplay1.getQueryString(), stmt);
Assert.assertNotNull(qDisplay1.getExplainPlan());
Assert.assertNull(qDisplay1.getErrorMessage());
Assert.assertTrue(qDisplay1.getHmsTimings(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertTrue(qDisplay1.getHmsTimings(QueryDisplay.Phase.EXECUTION).size() > 0);
Assert.assertTrue(qDisplay1.getPerfLogStarts(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertTrue(qDisplay1.getPerfLogEnds(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertTrue(qDisplay1.getPerfLogStarts(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertTrue(qDisplay1.getPerfLogEnds(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertEquals(qDisplay1.getTaskDisplays().size(), 1);
QueryDisplay.TaskDisplay tInfo1 = qDisplay1.getTaskDisplays().get(0);
Assert.assertEquals(tInfo1.getTaskId(), "Stage-0");
Assert.assertEquals(tInfo1.getTaskType(), StageType.DDL);
Assert.assertTrue(tInfo1.getBeginTime() > 0 && tInfo1.getBeginTime() <= System.currentTimeMillis());
Assert.assertTrue(tInfo1.getEndTime() > 0 && tInfo1.getEndTime() >= tInfo1.getBeginTime() && tInfo1.getEndTime() <= System.currentTimeMillis());
Assert.assertEquals(tInfo1.getStatus(), "Success, ReturnVal 0");
}
use of org.apache.hadoop.hive.ql.QueryDisplay in project hive by apache.
the class TestQueryDisplay method verifyDDL.
private void verifyDDL(QueryInfo queryInfo, String stmt, String handle, boolean finished) {
Assert.assertEquals(queryInfo.getUserName(), "testuser");
Assert.assertEquals(queryInfo.getExecutionEngine(), "mr");
Assert.assertEquals(queryInfo.getOperationId(), handle);
Assert.assertTrue(queryInfo.getBeginTime() > 0 && queryInfo.getBeginTime() <= System.currentTimeMillis());
if (finished) {
Assert.assertTrue(queryInfo.getEndTime() > 0 && queryInfo.getEndTime() >= queryInfo.getBeginTime() && queryInfo.getEndTime() <= System.currentTimeMillis());
Assert.assertTrue(queryInfo.getRuntime() > 0);
} else {
Assert.assertNull(queryInfo.getEndTime());
// For runtime, query may have finished.
}
QueryDisplay qDisplay1 = queryInfo.getQueryDisplay();
Assert.assertNotNull(qDisplay1);
Assert.assertEquals(qDisplay1.getQueryString(), stmt);
Assert.assertNotNull(qDisplay1.getExplainPlan());
Assert.assertNull(qDisplay1.getErrorMessage());
Assert.assertTrue(qDisplay1.getHmsTimings(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertTrue(qDisplay1.getHmsTimings(QueryDisplay.Phase.EXECUTION).size() > 0);
Assert.assertTrue(qDisplay1.getPerfLogStarts(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertTrue(qDisplay1.getPerfLogEnds(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertTrue(qDisplay1.getPerfLogStarts(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertTrue(qDisplay1.getPerfLogEnds(QueryDisplay.Phase.COMPILATION).size() > 0);
Assert.assertEquals(qDisplay1.getTaskDisplays().size(), 1);
QueryDisplay.TaskDisplay tInfo1 = qDisplay1.getTaskDisplays().get(0);
Assert.assertEquals(tInfo1.getTaskId(), "Stage-0");
Assert.assertEquals(tInfo1.getTaskType(), StageType.DDL);
Assert.assertTrue(tInfo1.getBeginTime() > 0 && tInfo1.getBeginTime() <= System.currentTimeMillis());
Assert.assertTrue(tInfo1.getEndTime() > 0 && tInfo1.getEndTime() >= tInfo1.getBeginTime() && tInfo1.getEndTime() <= System.currentTimeMillis());
Assert.assertEquals(tInfo1.getStatus(), "Success, ReturnVal 0");
}
Aggregations