Repository: spark Updated Branches: refs/heads/branch-2.2 b17f4063c -> f8e73d029
[SPARK-17920][SQL] [FOLLOWUP] Backport PR 19779 to branch-2.2 ## What changes were proposed in this pull request? A followup of https://github.com/apache/spark/pull/19795 , to simplify the file creation. ## How was this patch tested? Only test case is updated Author: vinodkc <vinod.kc...@gmail.com> Closes #19809 from vinodkc/br_FollowupSPARK-17920_branch-2.2. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/f8e73d02 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/f8e73d02 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/f8e73d02 Branch: refs/heads/branch-2.2 Commit: f8e73d029d247d594793d832acd43041ac65b136 Parents: b17f406 Author: vinodkc <vinod.kc...@gmail.com> Authored: Fri Nov 24 11:42:47 2017 +0100 Committer: Wenchen Fan <wenc...@databricks.com> Committed: Fri Nov 24 11:42:47 2017 +0100 ---------------------------------------------------------------------- .../org/apache/spark/sql/hive/client/VersionsSuite.scala | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/f8e73d02/sql/hive/src/test/scala/org/apache/spark/sql/hive/client/VersionsSuite.scala ---------------------------------------------------------------------- diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/client/VersionsSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/client/VersionsSuite.scala index d48a23f..8376fc7 100644 --- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/client/VersionsSuite.scala +++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/client/VersionsSuite.scala @@ -700,12 +700,7 @@ class VersionsSuite extends SparkFunSuite with Logging { test(s"$version: SPARK-17920: Insert into/overwrite avro table") { withTempDir { dir => - val path = dir.getAbsolutePath - val schemaPath = s"""$path${File.separator}avroschemadir""" val destTableName = "tab1" - - new File(schemaPath).mkdir() - val avroSchema = """{ |"type": "record", @@ -719,11 +714,11 @@ class VersionsSuite extends SparkFunSuite with Logging { """.stripMargin withTable(destTableName) { - val schemaUrl = s"""$schemaPath${File.separator}avroSchema.avsc""" - val schemaFile = new File(schemaPath, "avroSchema.avsc") + val schemaFile = new File(dir, "avroSchema.avsc") val writer = new PrintWriter(schemaFile) writer.write(avroSchema) writer.close() + val schemaPath = schemaFile.getCanonicalPath versionSpark.sql( s"""CREATE TABLE $destTableName @@ -731,7 +726,7 @@ class VersionsSuite extends SparkFunSuite with Logging { |STORED AS | INPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerInputFormat' | OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.avro.AvroContainerOutputFormat' - |TBLPROPERTIES ('avro.schema.url' = '$schemaUrl') + |TBLPROPERTIES ('avro.schema.url' = '$schemaPath') """.stripMargin ) val insertStmt = s"INSERT OVERWRITE TABLE $destTableName SELECT 'ABC', 'DEF'" --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org