From fec462c15321fa138d9654d64cc08468b6ab5ad1 Mon Sep 17 00:00:00 2001 From: Cheng Lian Date: Wed, 16 Apr 2014 08:54:34 -0700 Subject: 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 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 --- sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sql/hive/src') 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 444bbfb4dd..b1a26fdabb 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 -- cgit v1.2.3