Repository: spark Updated Branches: refs/heads/branch-1.0 5fe18a74f -> 9e908ab2e
Loads test tables when running "sbt hive/console" without HIVE_DEV_HOME When running Hive tests, the working directory is `$SPARK_HOME/sql/hive`, while when running `sbt hive/console`, it becomes `$SPARK_HOME`, and test tables are not loaded if `HIVE_DEV_HOME` is not defined. Author: Cheng Lian <[email protected]> Closes #417 from liancheng/loadTestTables and squashes the following commits: 7cea8d6 [Cheng Lian] Loads test tables when running "sbt hive/console" without HIVE_DEV_HOME (cherry picked from commit fec462c15321fa138d9654d64cc08468b6ab5ad1) Signed-off-by: Patrick Wendell <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/9e908ab2 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/9e908ab2 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/9e908ab2 Branch: refs/heads/branch-1.0 Commit: 9e908ab2ed5e7a58dd806fd0a79e53d83d124660 Parents: 5fe18a7 Author: Cheng Lian <[email protected]> Authored: Wed Apr 16 08:54:34 2014 -0700 Committer: Patrick Wendell <[email protected]> Committed: Wed Apr 16 08:54:41 2014 -0700 ---------------------------------------------------------------------- .../src/main/scala/org/apache/spark/sql/hive/TestHive.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/9e908ab2/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala ---------------------------------------------------------------------- diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala index 444bbfb..b1a26fd 100644 --- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala +++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala @@ -99,7 +99,12 @@ class TestHiveContext(sc: SparkContext) extends LocalHiveContext(sc) { hiveFilesTemp.delete() hiveFilesTemp.mkdir() - val inRepoTests = new File("src/test/resources/") + val inRepoTests = if (System.getProperty("user.dir").endsWith("sql/hive")) { + new File("src/test/resources/") + } else { + new File("sql/hive/src/test/resources") + } + def getHiveFile(path: String): File = { val stripped = path.replaceAll("""\.\.\/""", "") hiveDevHome
