hive
hive copied to clipboard
HIVE-26467: SessionState should be accessible inside ThreadPool
What changes were proposed in this pull request?
Change ThreadLocal Variable to Inheritable ThreadLocal variable
Why are the changes needed?
Currently SessionState.get() returns null if it is called inside a ThreadPool. If there is any custom third party component leverages SessionState.get() for some operations like getting the session state or session config inside a thread pool it will result in null since session state is thread local (https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java#L622) and ThreadLocal variable are not inheritable to child threads / thread pools.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Unit Test was added to test the feature
@pvary @kgyrtkirk could you please review the PR?
Looks like failing tests are unstable and not related to the changes!
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Feel free to reach out on the [email protected] list if the patch is in need of reviews.