Support Questions

Find answers, ask questions, and share your expertise

How to determine who ran query if Hive Impersonations = False?

avatar
Master Guru

I have hive impersonations set to false. Is there a simple way of determining who ran the job/query?

1 ACCEPTED SOLUTION

avatar
Contributor

Hi Sunile,

You can use a Hive hook to determine who submitted the query, even with doAs=false. As an example you can even use that to direct the query to an specific YARN queue. See the following for more info:

https://github.com/beto983/Hive-Utils/blob/master/README.md

View solution in original post

4 REPLIES 4

avatar
Contributor

Hi Sunile,

You can use a Hive hook to determine who submitted the query, even with doAs=false. As an example you can even use that to direct the query to an specific YARN queue. See the following for more info:

https://github.com/beto983/Hive-Utils/blob/master/README.md

avatar

@Alberto Romero

Notice that if you are re-using initialized sessions (hive.server2.tez.initialize.default.sessions) this solution will not work, because the properties are created only when the AM starts. When you use default sessions the AM will be created before your hook can define a custom property.

The hook solution work for non-default tez sessions and also for map-reduce.

Find here some rest calls to RM API that works for all Tez scenarios (but not for map-reduce engine).

avatar
Contributor

@Guilherme Braccialli Indeed, the hook is for not reusing initialised sessions.

Thanks very much for sharing the REST calls. Look quite useful to have handy.