Currently i have logged in with the user testuser1.
I need to get the Current user in my hive query (Apache hive). But hive default current_user function is returning user as a 'HIVE' user.
select current_user() - hive
How can i get an current_user as - testuser1.
You can use logged_in_user()
which returns current user name from the session state. This is the username provided when connecting to Hive. This function was added in Hive 2.2.0.
current_user()
returns current user name from the configured authenticator manager (as of Hive 1.2.0).
Source: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF
On Cloudera CDH 5.8 I get "Cloudera" when I run select current_user().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With