-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-17810] [SQL] Default spark.sql.warehouse.dir is relative to local FS but can resolve as HDFS path #15382
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ public void setValue(String value) { | |
| public static void main(String[] args) { | ||
| // $example on:spark_hive$ | ||
| // warehouseLocation points to the default location for managed databases and tables | ||
| String warehouseLocation = "file:" + System.getProperty("user.dir") + "spark-warehouse"; | ||
| String warehouseLocation = "spark-warehouse"; | ||
|
||
| SparkSession spark = SparkSession | ||
| .builder() | ||
| .appName("Java Spark Hive Example") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,11 +19,11 @@ package org.apache.spark.sql.internal | |
|
|
||
| import org.apache.hadoop.fs.Path | ||
|
|
||
| import org.apache.spark.SparkContext | ||
| import org.apache.spark.sql._ | ||
| import org.apache.spark.sql.execution.WholeStageCodegenExec | ||
| import org.apache.spark.sql.internal.StaticSQLConf._ | ||
| import org.apache.spark.sql.test.{SharedSQLContext, TestSQLContext} | ||
| import org.apache.spark.util.Utils | ||
|
|
||
| class SQLConfSuite extends QueryTest with SharedSQLContext { | ||
| import testImplicits._ | ||
|
|
@@ -219,8 +219,8 @@ class SQLConfSuite extends QueryTest with SharedSQLContext { | |
| try { | ||
| // to get the default value, always unset it | ||
| spark.conf.unset(SQLConf.WAREHOUSE_PATH.key) | ||
| assert(spark.sessionState.conf.warehousePath | ||
| === new Path(s"${System.getProperty("user.dir")}/spark-warehouse").toString) | ||
| assert(new Path(Utils.resolveURI("spark-warehouse")).toString === | ||
| spark.sessionState.conf.warehousePath + "/") | ||
|
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. could "/" change on Windows?
Member
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 think it will be a forward-slash because this will have to be a URI in any event in order to work on Windows. (The reason it's there is because the URI of a local directory will resolve with a trailing slash if the JDK knows the directory exists, otherwise it will be left as-is. The default URI won't have a trailing slash because it doesn't find the directory; it will exist at this point in the test though. Both are equally fine for Spark's purposes but that's why this exists in the test, for the record.) |
||
| } finally { | ||
| sql(s"set ${SQLConf.WAREHOUSE_PATH}=$original") | ||
| } | ||
|
|
||
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.
Here I am just fixing some duplication of docs that relate to this change. There were 3 identical stanzas