Skip to content

Commit fec462c

Browse files
lianchengpwendell
authored andcommitted
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
1 parent c0273d8 commit fec462c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/TestHive.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,12 @@ class TestHiveContext(sc: SparkContext) extends LocalHiveContext(sc) {
9999
hiveFilesTemp.delete()
100100
hiveFilesTemp.mkdir()
101101

102-
val inRepoTests = new File("src/test/resources/")
102+
val inRepoTests = if (System.getProperty("user.dir").endsWith("sql/hive")) {
103+
new File("src/test/resources/")
104+
} else {
105+
new File("sql/hive/src/test/resources")
106+
}
107+
103108
def getHiveFile(path: String): File = {
104109
val stripped = path.replaceAll("""\.\.\/""", "")
105110
hiveDevHome

0 commit comments

Comments
 (0)