Repository: spark
Updated Branches:
  refs/heads/master 3e1d120ce -> a66142dec


[SPARK-11877] Prevent agg. fallback conf. from leaking across test suites

This patch fixes an issue where the 
`spark.sql.TungstenAggregate.testFallbackStartsAt` SQLConf setting was not 
properly reset / cleared at the end of 
`TungstenAggregationQueryWithControlledFallbackSuite`. This ended up causing 
test failures in HiveCompatibilitySuite in Maven builds by causing spilling to 
occur way too frequently.

This configuration leak was inadvertently introduced during test cleanup in 
#9618.

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

Closes #9857 from JoshRosen/clear-fallback-prop-in-test-teardown.


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

Branch: refs/heads/master
Commit: a66142decee48bf5689fb7f4f33646d7bb1ac08d
Parents: 3e1d120
Author: Josh Rosen <joshro...@databricks.com>
Authored: Fri Nov 20 00:46:29 2015 -0800
Committer: Josh Rosen <joshro...@databricks.com>
Committed: Fri Nov 20 00:46:29 2015 -0800

----------------------------------------------------------------------
 .../hive/execution/AggregationQuerySuite.scala  | 44 ++++++++++----------
 1 file changed, 21 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/a66142de/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
index 6dde79f..39c0a2a 100644
--- 
a/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
+++ 
b/sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala
@@ -868,29 +868,27 @@ class TungstenAggregationQueryWithControlledFallbackSuite 
extends AggregationQue
 
   override protected def checkAnswer(actual: => DataFrame, expectedAnswer: 
Seq[Row]): Unit = {
     (0 to 2).foreach { fallbackStartsAt =>
-      sqlContext.setConf(
-        "spark.sql.TungstenAggregate.testFallbackStartsAt",
-        fallbackStartsAt.toString)
-
-      // Create a new df to make sure its physical operator picks up
-      // spark.sql.TungstenAggregate.testFallbackStartsAt.
-      // todo: remove it?
-      val newActual = DataFrame(sqlContext, actual.logicalPlan)
-
-      QueryTest.checkAnswer(newActual, expectedAnswer) match {
-        case Some(errorMessage) =>
-          val newErrorMessage =
-            s"""
-              |The following aggregation query failed when using 
TungstenAggregate with
-              |controlled fallback (it falls back to sort-based aggregation 
once it has processed
-              |$fallbackStartsAt input rows). The query is
-              |${actual.queryExecution}
-              |
-              |$errorMessage
-            """.stripMargin
-
-          fail(newErrorMessage)
-        case None =>
+      withSQLConf("spark.sql.TungstenAggregate.testFallbackStartsAt" -> 
fallbackStartsAt.toString) {
+        // Create a new df to make sure its physical operator picks up
+        // spark.sql.TungstenAggregate.testFallbackStartsAt.
+        // todo: remove it?
+        val newActual = DataFrame(sqlContext, actual.logicalPlan)
+
+        QueryTest.checkAnswer(newActual, expectedAnswer) match {
+          case Some(errorMessage) =>
+            val newErrorMessage =
+              s"""
+                |The following aggregation query failed when using 
TungstenAggregate with
+                |controlled fallback (it falls back to sort-based aggregation 
once it has processed
+                |$fallbackStartsAt input rows). The query is
+                |${actual.queryExecution}
+                |
+                |$errorMessage
+              """.stripMargin
+
+            fail(newErrorMessage)
+          case None =>
+        }
       }
     }
   }


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

Reply via email to