hive icon indicating copy to clipboard operation
hive copied to clipboard

HIVE-26467: SessionState should be accessible inside ThreadPool

Open shameersss1 opened this issue 2 years ago • 3 comments

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

shameersss1 avatar Aug 12 '22 10:08 shameersss1

@pvary @kgyrtkirk could you please review the PR?

shameersss1 avatar Aug 17 '22 04:08 shameersss1

Looks like failing tests are unstable and not related to the changes!

shameersss1 avatar Aug 18 '22 05:08 shameersss1

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug C 1 Bug
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Sep 16 '22 05:09 sonarqubecloud[bot]

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.

github-actions[bot] avatar Nov 16 '22 00:11 github-actions[bot]