spark git commit: [SPARK-18093][SQL] Fix default value test in SQLConfSuite to work rega…

2016-10-26 Thread vanzin
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 

Closes #15623 from markgrover/spark-18093.

(cherry picked from commit 4bee9540790a40acb74db4b0b44c364c4b3f537d)
Signed-off-by: Marcelo Vanzin 


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 
Authored: Wed Oct 26 09:07:30 2016 -0700
Committer: Marcelo Vanzin 
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



spark git commit: [SPARK-18093][SQL] Fix default value test in SQLConfSuite to work rega…

2016-10-26 Thread vanzin
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 

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 
Authored: Wed Oct 26 09:07:30 2016 -0700
Committer: Marcelo Vanzin 
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