Search in sources :

Example 1 with QueryProfileTmpl

use of org.apache.hive.tmpl.QueryProfileTmpl in project hive by apache.

the class QueryProfileServlet method doGet.

@Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String opId = (String) request.getParameter("operationId");
    ServletContext ctx = getServletContext();
    SessionManager sessionManager = (SessionManager) ctx.getAttribute("hive.sm");
    OperationManager opManager = sessionManager.getOperationManager();
    SQLOperationDisplay sod = opManager.getSQLOperationDisplay(opId);
    if (sod == null) {
        LOG.debug("No display object found for operation {} ", opId);
        return;
    }
    new QueryProfileTmpl().render(response.getWriter(), sod);
}
Also used : SQLOperationDisplay(org.apache.hive.service.cli.operation.SQLOperationDisplay) SessionManager(org.apache.hive.service.cli.session.SessionManager) QueryProfileTmpl(org.apache.hive.tmpl.QueryProfileTmpl) ServletContext(javax.servlet.ServletContext) OperationManager(org.apache.hive.service.cli.operation.OperationManager)

Example 2 with QueryProfileTmpl

use of org.apache.hive.tmpl.QueryProfileTmpl in project hive by apache.

the class TestQueryDisplay method verifyDDLHtml.

/**
   * Sanity check if basic information is delivered in this html.  Let's not go too crazy and
   * assert each element, to make it easier to add UI improvements.
   */
private void verifyDDLHtml(String stmt, String opHandle) throws Exception {
    StringWriter sw = new StringWriter();
    SQLOperationDisplay sod = sessionManager.getOperationManager().getSQLOperationDisplay(opHandle);
    new QueryProfileTmpl().render(sw, sod);
    String html = sw.toString();
    Assert.assertTrue(html.contains(stmt));
    Assert.assertTrue(html.contains("testuser"));
}
Also used : SQLOperationDisplay(org.apache.hive.service.cli.operation.SQLOperationDisplay) StringWriter(java.io.StringWriter) QueryProfileTmpl(org.apache.hive.tmpl.QueryProfileTmpl)

Aggregations

SQLOperationDisplay (org.apache.hive.service.cli.operation.SQLOperationDisplay)2 QueryProfileTmpl (org.apache.hive.tmpl.QueryProfileTmpl)2 StringWriter (java.io.StringWriter)1 ServletContext (javax.servlet.ServletContext)1 OperationManager (org.apache.hive.service.cli.operation.OperationManager)1 SessionManager (org.apache.hive.service.cli.session.SessionManager)1