[SPARK-18093][SQL] Fix default value test in SQLConfSuite to work rega…
…rdless of warehouse dir's existence ## What changes were proposed in this pull request? Appending a trailing slash, if there already isn't one for the sake comparison of the two paths. It doesn't take away from the essence of the check, but removes any potential mismatch due to lack of trailing slash. ## How was this patch tested? Ran unit tests and they passed. Author: Mark Grover <mark@apache.org> Closes #15623 from markgrover/spark-18093.
This commit is contained in:
parent
3c023570b2
commit
4bee954079
|
@ -215,12 +215,15 @@ class SQLConfSuite extends QueryTest with SharedSQLContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
test("default value of WAREHOUSE_PATH") {
|
test("default value of WAREHOUSE_PATH") {
|
||||||
|
|
||||||
val original = spark.conf.get(SQLConf.WAREHOUSE_PATH)
|
val original = spark.conf.get(SQLConf.WAREHOUSE_PATH)
|
||||||
try {
|
try {
|
||||||
// to get the default value, always unset it
|
// to get the default value, always unset it
|
||||||
spark.conf.unset(SQLConf.WAREHOUSE_PATH.key)
|
spark.conf.unset(SQLConf.WAREHOUSE_PATH.key)
|
||||||
assert(new Path(Utils.resolveURI("spark-warehouse")).toString ===
|
// JVM adds a trailing slash if the directory exists and leaves it as-is, if it doesn't
|
||||||
spark.sessionState.conf.warehousePath + "/")
|
// In our comparison, strip trailing slash off of both sides, to account for such cases
|
||||||
|
assert(new Path(Utils.resolveURI("spark-warehouse")).toString.stripSuffix("/") === spark
|
||||||
|
.sessionState.conf.warehousePath.stripSuffix("/"))
|
||||||
} finally {
|
} finally {
|
||||||
sql(s"set ${SQLConf.WAREHOUSE_PATH}=$original")
|
sql(s"set ${SQLConf.WAREHOUSE_PATH}=$original")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue