saihemanth-cloudera commented on code in PR #5319: URL: https://github.com/apache/hive/pull/5319#discussion_r1737272612
########## service/src/java/org/apache/hive/service/cli/operation/HiveCommandOperation.java: ########## @@ -124,14 +139,45 @@ public void runInternal() throws HiveSQLException { } } catch (CommandProcessorException e) { setState(OperationState.ERROR); - throw toSQLException("Error while processing statement", e); + throw toSQLException("Error while processing statement: " + e.toString(), e); } catch (Exception e) { setState(OperationState.ERROR); throw new HiveSQLException("Error running query: " + e.toString(), e); } setState(OperationState.FINISHED); } + private List<ProcessListInfo> getLiveQueryInfos(HiveSession parentSession) { + SessionManager sessionManager = parentSession.getSessionManager(); + if (sessionManager == null) { + return null; + } + long currentTime = System.currentTimeMillis(); + Collection<Operation> operations = sessionManager.getOperations(); + return operations.stream() + .filter(op -> op instanceof SQLOperation) // Filter for SQLOperation instances + .map(op -> { + HiveSession session = op.getParentSession(); + QueryInfo query = sessionManager.getOperationManager() + .getQueryInfo(op.getHandle().getHandleIdentifier().toString()); + + return new ProcessListInfo.Builder() + .setUserName(session.getUserName()) + .setIpAddr(session.getIpAddress()) + .setSessionId(session.getSessionHandle().getHandleIdentifier().toString()) + .setSessionActiveTime((currentTime - session.getCreationTime()) / 1000) + .setSessionIdleTime((currentTime - session.getLastAccessTime()) / 1000) + .setQueryId(op.getQueryId()) + .setExecutionEngine(query.getExecutionEngine()) + .setBeginTime(query.getBeginTime()) Review Comment: Nit: Can we make this timestamp human readable? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org For additional commands, e-mail: gitbox-h...@hive.apache.org