aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorReynold Xin <rxin@databricks.com>2016-04-04 09:58:01 +0200
committerHerman van Hovell <hvanhovell@questtec.nl>2016-04-04 09:58:01 +0200
commit0340b3d279de6be4903673bbf3e6a1a2653de6c0 (patch)
treed5da6c96c3a5457cac74489d63df79bed255337e /sql
parent76f3c735aa300d7ea6b17e64cc22d7e8fc3a8322 (diff)
downloadspark-0340b3d279de6be4903673bbf3e6a1a2653de6c0.tar.gz
spark-0340b3d279de6be4903673bbf3e6a1a2653de6c0.tar.bz2
spark-0340b3d279de6be4903673bbf3e6a1a2653de6c0.zip
[SPARK-14360][SQL] QueryExecution.debug.codegen() to dump codegen
## What changes were proposed in this pull request? We recently added the ability to dump the generated code for a given query. However, the method is only available through an implicit after an import. It'd slightly simplify things if it can be called directly in queryExecution. ## How was this patch tested? Manually tested in spark-shell. Author: Reynold Xin <rxin@databricks.com> Closes #12144 from rxin/SPARK-14360.
Diffstat (limited to 'sql')
-rw-r--r--sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala16
1 files changed, 16 insertions, 0 deletions
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 4843553211..63eb1aa24e 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
@@ -103,4 +103,20 @@ class QueryExecution(val sqlContext: SQLContext, val logical: LogicalPlan) {
|${stringOrError(executedPlan)}
""".stripMargin.trim
}
+
+ /** A special namespace for commands that can be used to debug query execution. */
+ // scalastyle:off
+ object debug {
+ // scalastyle:on
+
+ /**
+ * Prints to stdout all the generated code found in this plan (i.e. the output of each
+ * WholeStageCodegen subtree).
+ */
+ def codegen(): Unit = {
+ // scalastyle:off println
+ println(org.apache.spark.sql.execution.debug.codegenString(executedPlan))
+ // scalastyle:on println
+ }
+ }
}