Skip to content

[SPARK-18093][SQL] Fix default value test in SQLConfSuite to work rega… #15623

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,15 @@ class SQLConfSuite extends QueryTest with SharedSQLContext {
}

test("default value of WAREHOUSE_PATH") {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: shouldn't add this line but I'll clean it during merge.

val original = spark.conf.get(SQLConf.WAREHOUSE_PATH)
try {
// to get the default value, always unset it
spark.conf.unset(SQLConf.WAREHOUSE_PATH.key)
assert(new Path(Utils.resolveURI("spark-warehouse")).toString ===
spark.sessionState.conf.warehousePath + "/")
// JVM adds a trailing slash if the directory exists and leaves it as-is, if it doesn't
// 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 {
sql(s"set ${SQLConf.WAREHOUSE_PATH}=$original")
}
Expand Down