Repository: spark
Updated Branches:
  refs/heads/master 3c023570b -> 4bee95407


[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 <m...@apache.org>

Closes #15623 from markgrover/spark-18093.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/4bee9540
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/4bee9540
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/4bee9540

Branch: refs/heads/master
Commit: 4bee9540790a40acb74db4b0b44c364c4b3f537d
Parents: 3c02357
Author: Mark Grover <m...@apache.org>
Authored: Wed Oct 26 09:07:30 2016 -0700
Committer: Marcelo Vanzin <van...@cloudera.com>
Committed: Wed Oct 26 09:07:30 2016 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/internal/SQLConfSuite.scala    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/4bee9540/sql/core/src/test/scala/org/apache/spark/sql/internal/SQLConfSuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/internal/SQLConfSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/internal/SQLConfSuite.scala
index a89a43f..11d4693 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/internal/SQLConfSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/internal/SQLConfSuite.scala
@@ -215,12 +215,15 @@ class SQLConfSuite extends QueryTest with 
SharedSQLContext {
   }
 
   test("default value of WAREHOUSE_PATH") {
+
     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")
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to