From fd82681945447d97df368bcdcd112b08bd541cca Mon Sep 17 00:00:00 2001 From: Subhobrata Dey Date: Wed, 20 Apr 2016 14:26:07 -0700 Subject: [PATCH] [SPARK-14749][SQL, TESTS] PlannerSuite failed when it run individually ## What changes were proposed in this pull request? 3 testcases namely, ``` "count is partially aggregated" "count distinct is partially aggregated" "mixed aggregates are partially aggregated" ``` were failing when running PlannerSuite individually. The PR provides a fix for this. ## How was this patch tested? unit tests (If this patch involves UI changes, please attach a screenshot; otherwise, remove this) Author: Subhobrata Dey Closes #12532 from sbcd90/plannersuitetestsfix. --- .../org/apache/spark/sql/execution/QueryExecution.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala index ddcae0fe07533..35228643a5f49 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala @@ -51,7 +51,10 @@ class QueryExecution(val sqlContext: SQLContext, val logical: LogicalPlan) { } } - lazy val analyzed: LogicalPlan = sqlContext.sessionState.analyzer.execute(logical) + lazy val analyzed: LogicalPlan = { + SQLContext.setActive(sqlContext) + sqlContext.sessionState.analyzer.execute(logical) + } lazy val withCachedData: LogicalPlan = { assertAnalyzed()