You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by jo...@apache.org on 2016/01/24 20:29:50 UTC

spark git commit: [SPARK-12971] Fix Hive tests which fail in Hadoop-2.3 SBT build

Repository: spark
Updated Branches:
  refs/heads/master cfdcef70d -> f4004601b


[SPARK-12971] Fix Hive tests which fail in Hadoop-2.3 SBT build

ErrorPositionSuite and one of the HiveComparisonTest tests have been consistently failing on the Hadoop 2.3 SBT build (but on no other builds). I believe that this is due to test isolation issues (e.g. tests sharing state via the sets of temporary tables that are registered to TestHive).

This patch attempts to improve the isolation of these tests in order to address this issue.

Author: Josh Rosen <jo...@databricks.com>

Closes #10884 from JoshRosen/fix-failing-hadoop-2.3-hive-tests.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/f4004601
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/f4004601
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/f4004601

Branch: refs/heads/master
Commit: f4004601b00044e1d5c57e72c45b815f36feac3e
Parents: cfdcef7
Author: Josh Rosen <jo...@databricks.com>
Authored: Sun Jan 24 11:29:27 2016 -0800
Committer: Josh Rosen <jo...@databricks.com>
Committed: Sun Jan 24 11:29:27 2016 -0800

----------------------------------------------------------------------
 .../spark/sql/hive/ErrorPositionSuite.scala     | 20 +++++++++++++++++---
 .../sql/hive/execution/HiveComparisonTest.scala |  6 +++++-
 2 files changed, 22 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/f4004601/sql/hive/src/test/scala/org/apache/spark/sql/hive/ErrorPositionSuite.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/ErrorPositionSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/ErrorPositionSuite.scala
index 14a466c..4b6da7c 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/ErrorPositionSuite.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/ErrorPositionSuite.scala
@@ -19,20 +19,34 @@ package org.apache.spark.sql.hive
 
 import scala.util.Try
 
-import org.scalatest.BeforeAndAfter
+import org.scalatest.BeforeAndAfterEach
 
 import org.apache.spark.sql.{AnalysisException, QueryTest}
 import org.apache.spark.sql.catalyst.parser.ParseDriver
 import org.apache.spark.sql.catalyst.util.quietly
 import org.apache.spark.sql.hive.test.TestHiveSingleton
 
-class ErrorPositionSuite extends QueryTest with TestHiveSingleton with BeforeAndAfter {
+class ErrorPositionSuite extends QueryTest with TestHiveSingleton with BeforeAndAfterEach {
   import hiveContext.implicits._
 
-  before {
+  override protected def beforeEach(): Unit = {
+    super.beforeEach()
+    if (sqlContext.tableNames().contains("src")) {
+      sqlContext.dropTempTable("src")
+    }
+    Seq((1, "")).toDF("key", "value").registerTempTable("src")
     Seq((1, 1, 1)).toDF("a", "a", "b").registerTempTable("dupAttributes")
   }
 
+  override protected def afterEach(): Unit = {
+    try {
+      sqlContext.dropTempTable("src")
+      sqlContext.dropTempTable("dupAttributes")
+    } finally {
+      super.afterEach()
+    }
+  }
+
   positionTest("ambiguous attribute reference 1",
     "SELECT a from dupAttributes", "a")
 

http://git-wip-us.apache.org/repos/asf/spark/blob/f4004601/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
index 2e0a869..207bb81 100644
--- a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveComparisonTest.scala
@@ -150,7 +150,11 @@ abstract class HiveComparisonTest
        """.stripMargin
     })
 
-    super.afterAll()
+    try {
+      TestHive.reset()
+    } finally {
+      super.afterAll()
+    }
   }
 
   protected def prepareAnswer(


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org