Skip to content

Commit eab90d3

Browse files
committed
[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 apache#9618. Author: Josh Rosen <joshrosen@databricks.com> Closes apache#9857 from JoshRosen/clear-fallback-prop-in-test-teardown. (cherry picked from commit a66142d) Signed-off-by: Josh Rosen <joshrosen@databricks.com>
1 parent 1ce6394 commit eab90d3

File tree

1 file changed

+21
-23
lines changed

1 file changed

+21
-23
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/AggregationQuerySuite.scala

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -868,29 +868,27 @@ class TungstenAggregationQueryWithControlledFallbackSuite extends AggregationQue
868868

869869
override protected def checkAnswer(actual: => DataFrame, expectedAnswer: Seq[Row]): Unit = {
870870
(0 to 2).foreach { fallbackStartsAt =>
871-
sqlContext.setConf(
872-
"spark.sql.TungstenAggregate.testFallbackStartsAt",
873-
fallbackStartsAt.toString)
874-
875-
// Create a new df to make sure its physical operator picks up
876-
// spark.sql.TungstenAggregate.testFallbackStartsAt.
877-
// todo: remove it?
878-
val newActual = DataFrame(sqlContext, actual.logicalPlan)
879-
880-
QueryTest.checkAnswer(newActual, expectedAnswer) match {
881-
case Some(errorMessage) =>
882-
val newErrorMessage =
883-
s"""
884-
|The following aggregation query failed when using TungstenAggregate with
885-
|controlled fallback (it falls back to sort-based aggregation once it has processed
886-
|$fallbackStartsAt input rows). The query is
887-
|${actual.queryExecution}
888-
|
889-
|$errorMessage
890-
""".stripMargin
891-
892-
fail(newErrorMessage)
893-
case None =>
871+
withSQLConf("spark.sql.TungstenAggregate.testFallbackStartsAt" -> fallbackStartsAt.toString) {
872+
// Create a new df to make sure its physical operator picks up
873+
// spark.sql.TungstenAggregate.testFallbackStartsAt.
874+
// todo: remove it?
875+
val newActual = DataFrame(sqlContext, actual.logicalPlan)
876+
877+
QueryTest.checkAnswer(newActual, expectedAnswer) match {
878+
case Some(errorMessage) =>
879+
val newErrorMessage =
880+
s"""
881+
|The following aggregation query failed when using TungstenAggregate with
882+
|controlled fallback (it falls back to sort-based aggregation once it has processed
883+
|$fallbackStartsAt input rows). The query is
884+
|${actual.queryExecution}
885+
|
886+
|$errorMessage
887+
""".stripMargin
888+
889+
fail(newErrorMessage)
890+
case None =>
891+
}
894892
}
895893
}
896894
}

0 commit comments

Comments
 (0)