-
Notifications
You must be signed in to change notification settings - Fork 28.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-4103][SQL] Clean up SessionState in HiveContext by using ThreadLocal varaible in Hive #2967
Closed
Closed
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ba14f28
test
zhzhan f6a8a40
revert
zhzhan cb53a2c
Merge branch 'master' of https://github.com/apache/spark
zhzhan 789ea21
Merge branch 'master' of https://github.com/apache/spark
zhzhan 921e914
Merge branch 'master' of https://github.com/apache/spark
zhzhan e4c1982
Merge branch 'master' of https://github.com/apache/spark
zhzhan af9feb9
Merge branch 'master' of https://github.com/apache/spark
zhzhan 1ccd7cc
Merge branch 'master' of https://github.com/apache/spark
zhzhan 2b0d513
Merge branch 'master' of https://github.com/apache/spark
zhzhan 3ee3b2b
Merge branch 'master' of https://github.com/apache/spark
zhzhan 68deb11
Merge branch 'master' of https://github.com/apache/spark
zhzhan 7e0cc36
Merge branch 'master' of https://github.com/apache/spark
zhzhan d10bf00
Merge branch 'master' of https://github.com/apache/spark
zhzhan adf4924
Merge branch 'master' of https://github.com/apache/spark
zhzhan cedcc6f
Merge branch 'master' of https://github.com/apache/spark
zhzhan 301eb4a
Merge branch 'master' of https://github.com/apache/spark
zhzhan a72c0d4
Merge branch 'master' of https://github.com/apache/spark
zhzhan 4a2e36d
Merge branch 'master' of https://github.com/apache/spark
zhzhan 497b0f4
Merge branch 'master' of https://github.com/apache/spark
zhzhan a00f60f
Merge branch 'master' of https://github.com/apache/spark
zhzhan a9d372b
Merge branch 'master' of https://github.com/zhzhan/spark
zhzhan 3764505
Merge branch 'master' of https://github.com/apache/spark
zhzhan 93f3081
Merge branch 'master' of https://github.com/apache/spark
zhzhan ce0ca7b
Merge branch 'master' of https://github.com/apache/spark
zhzhan 12e1be5
Merge branch 'master' of https://github.com/apache/spark
zhzhan 53a26ae
clean up session state in HiveContext. Currently the sessionState in …
zhzhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use lazy eval, we have to relies on SessionState.start(sessionState) to initialize it. It may be invoked multiple times in various locations. Here we relies on checking ThreadLocal variable and initialize it at the first call to avoid this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several comments here:
HiveContext.hiveconf
should be retrieved from the currentSessionState
ifSessionState.get()
is non-null. That's whyhiveconf
andsessionState
are always initialized together in #2887SessionState.get()
returns a non-nullSessionState
started elsewhere. This is required by Spark SQL CLI sinceSparkSQLCLIDriver
creates aCliSessionState
beforeHiveContext
initialization.HiveContext
play well with multi-session scenarios by introducinggetSessionState()
here? I had also considered this issue earlier, but unfortunately IMO proper multiple Hive session support may require major refactoring overHiveContext
(e.g. make it absolutely thread safe). Also, Spark SQL Hive support will probably be reimplemented against the up coming foreign data source API. So I'd rather defer this major task later.(As a globally used thread local object, Hive
SessionState
is really annoying...)