Skip to content
Snippets Groups Projects
Commit b5bae849 authored by Michael Armbrust's avatar Michael Armbrust Committed by Reynold Xin
Browse files

[SQL] SPARK-1427 Fix toString for SchemaRDD NativeCommands.

Author: Michael Armbrust <michael@databricks.com>

Closes #343 from marmbrus/toStringFix and squashes the following commits:

37198fe [Michael Armbrust] Fix toString for SchemaRDD NativeCommands.
parent accd0999
No related branches found
No related tags found
No related merge requests found
......@@ -224,6 +224,8 @@ class SQLContext(@transient val sparkContext: SparkContext)
protected def stringOrError[A](f: => A): String =
try f.toString catch { case e: Throwable => e.toString }
def simpleString: String = stringOrError(executedPlan)
override def toString: String =
s"""== Logical Plan ==
|${stringOrError(analyzed)}
......
......@@ -41,8 +41,7 @@ trait SchemaRDDLike {
override def toString =
s"""${super.toString}
|== Query Plan ==
|${queryExecution.executedPlan}""".stripMargin.trim
|${queryExecution.simpleString}""".stripMargin.trim
/**
* Saves the contents of this `SchemaRDD` as a parquet file, preserving the schema. Files that
......
......@@ -297,5 +297,11 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
val asString = result.map(_.zip(types).map(toHiveString)).map(_.mkString("\t")).toSeq
asString
}
override def simpleString: String =
logical match {
case _: NativeCommand => "<Executed by Hive>"
case _ => executedPlan.toString
}
}
}
......@@ -146,4 +146,8 @@ class HiveQuerySuite extends HiveComparisonTest {
hql("SELECT * FROM src TABLESAMPLE(0.1 PERCENT) s")
}
test("SchemaRDD toString") {
hql("SHOW TABLES").toString
hql("SELECT * FROM src").toString
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment