owenmonn commented on code in PR #6657:
URL: https://github.com/apache/hive/pull/6657#discussion_r3674158027


##########
service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java:
##########
@@ -549,7 +549,7 @@ private SessionHandle getSessionHandle(TOpenSessionReq req, 
TOpenSessionResp res
       throws HiveSQLException, IOException {
     final String ipAddress = getIpAddress();
 
-    LOG.info("Creating Hive session handle for user [{}] from IP {}", 
req.getUsername(), ipAddress);
+    LOG.info("Creating Hive session handle for user [{}] from IP {}", 
userName, ipAddress);

Review Comment:
   That fallback already exists in 
[`getUserName()`](https://github.com/apache/hive/blob/rel/release-4.2.0/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java#L508-L510),
 in the opposite direction:
   ```java
   if (userName == null) {
     userName = req.getUsername();
   }
   ```
   
   So adding a null check would only change behaviour when both are set, and 
there the raw value wins and we lose the [shortname handling and the 
`getProxyUser()`](https://github.com/apache/hive/blob/rel/release-4.2.0/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java#L512-L517)
 result.
   
   Whereas `getUserName()` is documented as "Returns the effective username", 
and that value is what the [session is opened 
with](https://github.com/apache/hive/blob/rel/release-4.2.0/service/src/java/org/apache/hive/service/cli/thrift/ThriftCLIService.java#L559-L564).



-- 
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]

Reply via email to