-
Notifications
You must be signed in to change notification settings - Fork 28.9k
SPARK-18086: Add support for Hive session vars. #15738
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
Conversation
|
How are the session vars different from our configs? Can't we just use that? |
|
The purpose of this is to ensure the same behavior as Hive so users can move to SparkSQL without rewriting queries. That's why I'm trying to keep behavior as close as possible to the behavior of Hive (and Spark 1.6.1). Session vars are kept in a different namespace, so collisions should not overwrite configs and session vars take precedence in Hive (actually, conf substitution requires the "hiveconf:" prefix, otherwise values are only taken from session vars). Because we still use a Hive SessionState and pass some commands to Hive, I thought it was also important to store the hive variables in the session state like Hive would. That way any command that are passed to Hive that have variable references work as well. |
|
Test build #68004 has finished for PR 15738 at commit
|
8c1b7b4 to
45a4cee
Compare
45a4cee to
78a95fa
Compare
|
Test build #68301 has finished for PR 15738 at commit
|
|
Test build #68303 has finished for PR 15738 at commit
|
|
Thanks - merging in master/branch-2.1! |
## What changes were proposed in this pull request? This adds support for Hive variables: * Makes values set via `spark-sql --hivevar name=value` accessible * Adds `getHiveVar` and `setHiveVar` to the `HiveClient` interface * Adds a SessionVariables trait for sessions like Hive that support variables (including Hive vars) * Adds SessionVariables support to variable substitution * Adds SessionVariables support to the SET command ## How was this patch tested? * Adds a test to all supported Hive versions for accessing Hive variables * Adds HiveVariableSubstitutionSuite Author: Ryan Blue <[email protected]> Closes #15738 from rdblue/SPARK-18086-add-hivevar-support. (cherry picked from commit 9b0593d) Signed-off-by: Reynold Xin <[email protected]>
|
Thanks for reviewing @rxin! |
## What changes were proposed in this pull request? This adds support for Hive variables: * Makes values set via `spark-sql --hivevar name=value` accessible * Adds `getHiveVar` and `setHiveVar` to the `HiveClient` interface * Adds a SessionVariables trait for sessions like Hive that support variables (including Hive vars) * Adds SessionVariables support to variable substitution * Adds SessionVariables support to the SET command ## How was this patch tested? * Adds a test to all supported Hive versions for accessing Hive variables * Adds HiveVariableSubstitutionSuite Author: Ryan Blue <[email protected]> Closes apache#15738 from rdblue/SPARK-18086-add-hivevar-support.
What changes were proposed in this pull request?
This adds support for Hive variables:
spark-sql --hivevar name=valueaccessiblegetHiveVarandsetHiveVarto theHiveClientinterfaceHow was this patch tested?