Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ case class ExplainCommand(
override protected[sql] lazy val sideEffectResult: Seq[String] = this.toString.split("\n")

def execute(): RDD[Row] = {
val explanation = sideEffectResult.mkString("\n")
context.sparkContext.parallelize(Seq(new GenericRow(Array[Any](explanation))), 1)
val explanation = sideEffectResult.map(row => new GenericRow(Array[Any](row)))
context.sparkContext.parallelize(explanation, 1)
}

override def otherCopyArgs = context :: Nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class JavaHiveQLSuite extends FunSuite {

def isExplanation(result: JavaSchemaRDD) = {
val explanation = result.collect().map(_.getString(0))
explanation.size == 1 && explanation.head.startsWith(explainCommandClassName)
explanation.size > 1 && explanation.head.startsWith(explainCommandClassName)
}

ignore("Query Hive native command execution result") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class HiveQuerySuite extends HiveComparisonTest {

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(explainCommandClassName)
}

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