From 21be4ca7f4fb987ab467c6bcbed2db10e0cdbeb9 Mon Sep 17 00:00:00 2001 From: Herman van Hovell Date: Thu, 9 Feb 2017 16:25:37 +0100 Subject: [PATCH] Remove temp file --- .../org/apache/spark/sql/hive/orc/OrcSourceSuite.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcSourceSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcSourceSuite.scala index a05b29c579b34..59ea8916efae9 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcSourceSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/OrcSourceSuite.scala @@ -154,7 +154,8 @@ abstract class OrcSuite extends QueryTest with TestHiveSingleton with BeforeAndA test("SPARK-19459/SPARK-18220: read char/varchar column written by Hive") { val hiveClient = spark.sharedState.externalCatalog.asInstanceOf[HiveExternalCatalog].client - val location = Utils.createTempDir().toURI + val location = Utils.createTempDir() + val uri = location.toURI try { hiveClient.runSqlHive( """ @@ -165,7 +166,7 @@ abstract class OrcSuite extends QueryTest with TestHiveSingleton with BeforeAndA |STORED AS orc""".stripMargin) // Hive throws an exception if I assign the location in the create table statement. hiveClient.runSqlHive( - s"ALTER TABLE hive_orc SET LOCATION '$location'") + s"ALTER TABLE hive_orc SET LOCATION '$uri'") hiveClient.runSqlHive( "INSERT INTO TABLE hive_orc SELECT 'a', 'b', 'c' FROM (SELECT 1) t") @@ -178,13 +179,14 @@ abstract class OrcSuite extends QueryTest with TestHiveSingleton with BeforeAndA | b CHAR(10), | c VARCHAR(10)) |STORED AS orc - |LOCATION '$location'""".stripMargin) + |LOCATION '$uri'""".stripMargin) val result = Row("a", "b ", "c") checkAnswer(spark.table("hive_orc"), result) checkAnswer(spark.table("spark_orc"), result) } finally { hiveClient.runSqlHive("DROP TABLE IF EXISTS hive_orc") hiveClient.runSqlHive("DROP TABLE IF EXISTS spark_orc") + Utils.deleteRecursively(location) } } }