Repository: spark
Updated Branches:
  refs/heads/branch-2.0 192c1dd4f -> b4a7b6551


[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.

(cherry picked from commit 4bee9540790a40acb74db4b0b44c364c4b3f537d)
Signed-off-by: Marcelo Vanzin <van...@cloudera.com>


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

Branch: refs/heads/branch-2.0
Commit: b4a7b6551d5db8f280656624b19bebf43fcfb819
Parents: 192c1dd
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:42 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/b4a7b655/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 a230344..41e011b 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
@@ -212,12 +212,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