cnauroth commented on code in PR #3813:
URL: https://github.com/apache/hive/pull/3813#discussion_r1035232269
##########
service/src/java/org/apache/hive/service/cli/operation/SQLOperation.java:
##########
@@ -328,7 +328,8 @@ public Object run() throws HiveSQLException {
if (!embedded) {
LogUtils.registerLoggingContext(queryState.getConf());
}
-
ShimLoader.getHadoopShims().setHadoopQueryContext(queryState.getQueryId());
+ ShimLoader.getHadoopShims()
+ .setHadoopQueryContext(queryState.getQueryId() + " User:" +
parentSessionState.getUserName());
Review Comment:
For consistency with the other call sites setting query context, please add
a space after the colon:
```
... + " User: " + ...`
```
(However, also see my other comment about whether or not we should use
spaces. Whatever is decided for the format should be consistent at all call
sites.)
##########
service/src/java/org/apache/hive/service/cli/operation/Operation.java:
##########
@@ -237,7 +238,9 @@ protected void createOperationLog() {
* Set up some preconditions, or configurations.
*/
protected void beforeRun() {
- ShimLoader.getHadoopShims().setHadoopQueryContext(queryState.getQueryId());
+ CallerContext.setCurrent(new CallerContext.Builder("Check").build());
Review Comment:
Should this line be removed? Unless I'm mistaken, the call to
`setHadoopQueryContext` on the next line will overwrite the value set by this
line.
##########
cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java:
##########
@@ -250,7 +250,8 @@ CommandProcessorResponse processLocalCmd(String cmd,
CommandProcessor proc, CliS
}
// Set HDFS CallerContext to queryId and reset back to sessionId after
the query is done
-
ShimLoader.getHadoopShims().setHadoopQueryContext(qp.getQueryState().getQueryId());
+ ShimLoader.getHadoopShims()
+ .setHadoopQueryContext(qp.getQueryState().getQueryId() + " User: "
+ ss.getUserName());
Review Comment:
I wonder if we should avoid embedding spaces in the format. Prior usage of
caller context that I've seen uses an underscore-delimited format. The Hadoop
compatibility guidelines state that the HDFS audit log format should be
considered public and stable:
https://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-common/Compatibility.html#Audit_Log_Output
Embedding spaces could break existing scripts that perform positional
parsing using utilities like `cut` and `awk`.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]