@Override public void updateQueryTag(String queryId, String queryTag) throws HiveSQLException { sessionManager.getOperationManager().updateQueryTag(queryId, queryTag); }
@Override public void cancelOperation(OperationHandle opHandle) throws HiveSQLException { sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().cancelOperation(opHandle); LOG.debug(opHandle + ": cancelOperation()"); }
@Override public void closeOperation(OperationHandle opHandle) throws HiveSQLException { sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().closeOperation(opHandle); LOG.debug(opHandle + ": closeOperation"); }
@Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { TableSchema tableSchema = sessionManager.getOperationManager() .getOperation(opHandle).getParentSession().getResultSetMetadata(opHandle); LOG.debug(opHandle + ": getResultSetMetadata()"); return tableSchema; }
@Override public String getQueryId(TOperationHandle opHandle) throws HiveSQLException { Operation operation = sessionManager.getOperationManager().getOperation( new OperationHandle(opHandle)); final String queryId = operation.getQueryId(); LOG.debug(opHandle + ": getQueryId() " + queryId); return queryId; }
@Override public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows, FetchType fetchType) throws HiveSQLException { RowSet rowSet = sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().fetchResults(opHandle, orientation, maxRows, fetchType); LOG.debug(opHandle + ": fetchResults()"); return rowSet; }
@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(); QueryInfo queryInfo = opManager.getQueryInfo(opId); HiveConf hiveConf = opManager.getHiveConf(); if (queryInfo == null) { LOG.debug("No display object found for operation {} ", opId); return; } new QueryProfileTmpl().render(response.getWriter(), queryInfo, hiveConf); } }
@Override public void cancelOperation(OperationHandle opHandle) throws HiveSQLException { acquire(true, false); try { sessionManager.getOperationManager().cancelOperation(opHandle); } finally { release(true, false); } }
@Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { acquire(true, true); try { return sessionManager.getOperationManager().getOperationResultSetSchema(opHandle); } finally { release(true, true); } }
private double getProgressedPercentage(OperationHandle opHandle) throws HiveSQLException { checkArgument(OperationType.EXECUTE_STATEMENT.equals(opHandle.getOperationType())); Operation operation = cliService.getSessionManager().getOperationManager().getOperation(opHandle); SessionState state = operation.getParentSession().getSessionState(); ProgressMonitor monitor = state.getProgressMonitor(); return monitor == null ? 0.0 : monitor.progressedPercentage(); }
@Override public OperationStatus getOperationStatus(OperationHandle opHandle, boolean getProgressUpdate) throws HiveSQLException { Operation operation = sessionManager.getOperationManager().getOperation(opHandle);
/** * create session, and fetch the property set in global init file. Test if * the global init file .hiverc is loaded correctly by checking the expected * setting property. */ private void doTestSessionGlobalInitFile() throws Exception { OperationManager operationManager = service.getService().getSessionManager() .getOperationManager(); SessionHandle sessionHandle = client.openSession(null, null, null); // ensure there is no operation related object leak Assert.assertEquals("Verifying all operations used for init file are closed", 0, operationManager.getOperations().size()); verifyInitProperty("a", "1", sessionHandle); verifyInitProperty("b", "1", sessionHandle); verifyInitProperty("c", "1", sessionHandle); verifyInitProperty("hivevar:c", "1", sessionHandle); verifyInitProperty("d", "1", sessionHandle); /** * TODO: client.executeStatement do not support listing resources command * (beeline> list jar) */ // Assert.assertEquals("expected uri", api.getAddedResource("jar")); Assert.assertEquals("Verifying all operations used for checks are closed", 0, operationManager.getOperations().size()); client.closeSession(sessionHandle); }
Collection<QueryInfo> operations = sessionManager.getOperationManager().getLiveQueryInfos(); for (QueryInfo operation : operations) { if (!HttpServer.hasAccess(remoteUser, operation.getUserName(), ctx, request)) { operations = sessionManager.getOperationManager().getHistoricalQueryInfos(); for (QueryInfo operation : operations) { if (!HttpServer.hasAccess(remoteUser, operation.getUserName(), ctx, request)) {
@Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { TableSchema tableSchema = sessionManager.getOperationManager() .getOperation(opHandle).getParentSession().getResultSetMetadata(opHandle); LOG.debug(opHandle + ": getResultSetMetadata()"); return tableSchema; }
@Override public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows, FetchType fetchType) throws HiveSQLException { RowSet rowSet = sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().fetchResults(opHandle, orientation, maxRows, fetchType); LOG.debug(opHandle + ": fetchResults()"); return rowSet; }
@Override public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows, FetchType fetchType) throws HiveSQLException { RowSet rowSet = sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().fetchResults(opHandle, orientation, maxRows, fetchType); LOG.debug(opHandle + ": fetchResults()"); return rowSet; }
@Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { acquire(true, true); try { return sessionManager.getOperationManager().getOperationResultSetSchema(opHandle); } finally { release(true, true); } }
@Override public void cancelOperation(OperationHandle opHandle) throws HiveSQLException { acquire(true); try { sessionManager.getOperationManager().cancelOperation(opHandle); } finally { release(true); } }
@Override public String getQueryId(TOperationHandle opHandle) throws HiveSQLException { Operation operation = sessionManager.getOperationManager().getOperation( new OperationHandle(opHandle)); final String queryId = operation.getParentSession().getHiveConf().getVar(ConfVars.HIVEQUERYID); LOG.debug(opHandle + ": getQueryId() " + queryId); return queryId; }
private double getProgressedPercentage(OperationHandle opHandle) throws HiveSQLException { checkArgument(OperationType.EXECUTE_STATEMENT.equals(opHandle.getOperationType())); Operation operation = cliService.getSessionManager().getOperationManager().getOperation(opHandle); SessionState state = operation.getParentSession().getSessionState(); ProgressMonitor monitor = state.getProgressMonitor(); return monitor == null ? 0.0 : monitor.progressedPercentage(); }