private void setupSessionIO(SessionState sessionState) {
    try {
      sessionState.in = null; // hive server's session input stream is not used
      sessionState.out =
          new SessionStream(System.out, true, StandardCharsets.UTF_8.name());
      sessionState.info =
          new SessionStream(System.err, true, StandardCharsets.UTF_8.name());
      sessionState.err =
          new SessionStream(System.err, true, StandardCharsets.UTF_8.name());
    } catch (UnsupportedEncodingException e) {
      log.error("Error creating PrintStream", e);
        sessionState.out = null;
        sessionState.info = null;
        sessionState.err = null;
      }
    }
A map to track query count running by each user
service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java