Skip to content

Commit

Permalink
Update unit tests for explain.
Browse files Browse the repository at this point in the history
  • Loading branch information
rxin committed Jun 19, 2014
1 parent a9d3ba8 commit def83b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@ case class ExplainCommand(
extends LeafNode with Command {

// Run through the optimizer to generate the physical plan.
// This is really side effect free but we follow the infrastructure anyway...
override protected[sql] lazy val sideEffectResult: Seq[String] = {
context.executePlan(logicalPlan).executedPlan.toString.split("\n")
"Physical execution plan:" +: context.executePlan(logicalPlan).executedPlan.toString.split("\n")
}

def execute(): RDD[Row] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,9 @@ class HiveQuerySuite extends HiveComparisonTest {
}
}

private val explainCommandClassName =
classOf[execution.ExplainCommand].getSimpleName.stripSuffix("$")

def isExplanation(result: SchemaRDD) = {
val explanation = result.select('plan).collect().map { case Row(plan: String) => plan }
explanation.size > 1 && explanation.head.startsWith(explainCommandClassName)
explanation.size > 1 && explanation.head.startsWith("Physical execution plan")
}

test("SPARK-1704: Explain commands as a SchemaRDD") {
Expand Down

0 comments on commit def83b0

Please sign in to comment.