There are two changes
1. Pass username when SessionState is created from HiveSessionImpl.
2. Pass HiveConf from SessionManager to HiveSessionImplwithUGI/HiveSessionImpl, and in HiveSessionImplwithUGI/HiveSessionImpl to create a HiveConf that is a copy of the passed HiveConf. This was made to be able to test the SQL std auth with HS2 properly. This will help in general with testing and with embedded HS2, as you want to be able to set the default configuration for a session. This is not an issue with standalone HS2 as HiveSessionImpl as both HS2 configuration and HiveSessionImpl would pick conf from hive-site.xml . See the new TestMiniHS2 test for example of use case.