-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-19664][SQL]put hive.metastore.warehouse.dir in hadoopconf to overwrite its original value #16996
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-19664][SQL]put hive.metastore.warehouse.dir in hadoopconf to overwrite its original value #16996
Changes from 3 commits
92c1452
ac0a1c6
91b9fd2
7429cd8
26ba212
1d18636
86deb62
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,7 @@ private[sql] class SharedState(val sparkContext: SparkContext) extends Logging { | |
| val warehousePath = { | ||
| val configFile = Utils.getContextOrSparkClassLoader.getResource("hive-site.xml") | ||
| if (configFile != null) { | ||
| logInfo(s"load config from hive-site.xml $configFile") | ||
| sparkContext.hadoopConfiguration.addResource(configFile) | ||
| } | ||
|
|
||
|
|
@@ -61,6 +62,11 @@ private[sql] class SharedState(val sparkContext: SparkContext) extends Logging { | |
| // When neither spark.sql.warehouse.dir nor hive.metastore.warehouse.dir is set, | ||
| // we will set hive.metastore.warehouse.dir to the default value of spark.sql.warehouse.dir. | ||
| val sparkWarehouseDir = sparkContext.conf.get(WAREHOUSE_PATH) | ||
| logInfo(s"Setting hive.metastore.warehouse.dir ($hiveWarehouseDir) to the value of " + | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when we hit this condition because we provide a
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| s"${WAREHOUSE_PATH.key} ('$sparkWarehouseDir').") | ||
| if (hiveWarehouseDir != null) { | ||
| sparkContext.hadoopConfiguration.set("hive.metastore.warehouse.dir", sparkWarehouseDir) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can always set it.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, maybe when we always set it, the sparkContext.conf.set("hive.metastore.warehouse.dir", sparkWarehouseDir) could be removed, let me test it more, thanks~ |
||
| } | ||
| sparkContext.conf.set("hive.metastore.warehouse.dir", sparkWarehouseDir) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we still need to do this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I look into the code, and make some tests.
we can also find that,the default database does not created in
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, it is ok to remove it, and it will be more clear that |
||
| sparkWarehouseDir | ||
| } | ||
|
|
||
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.
nit:
loading hive config file: $configFile