diff options
author | Cheng Lian <lian.cs.zju@gmail.com> | 2014-04-16 08:54:34 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-04-16 08:54:34 -0700 |
commit | fec462c15321fa138d9654d64cc08468b6ab5ad1 (patch) | |
tree | f8ff4b3b5f5b542d95c2547fb71b39403d8f2fd7 /sql/hive | |
parent | c0273d806ea9b83dd8585039f2a18c2cc795dad2 (diff) | |
download | spark-fec462c15321fa138d9654d64cc08468b6ab5ad1.tar.gz spark-fec462c15321fa138d9654d64cc08468b6ab5ad1.tar.bz2 spark-fec462c15321fa138d9654d64cc08468b6ab5ad1.zip |
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 <lian.cs.zju@gmail.com>
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
Diffstat (limited to 'sql/hive')
-rw-r--r-- | sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala | 7 |
1 files changed, 6 insertions, 1 deletions
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 |