Skip to content
Snippets Groups Projects
Commit 76f3c735 authored by Matei Zaharia's avatar Matei Zaharia Committed by Reynold Xin
Browse files

[SPARK-14356] Update spark.sql.execution.debug to work on Datasets

## What changes were proposed in this pull request?

Update DebugQuery to work on Datasets of any type, not just DataFrames.

## How was this patch tested?

Added unit tests, checked in spark-shell.

Author: Matei Zaharia <matei@databricks.com>

Closes #12140 from mateiz/debug-dataset.
parent 3f749f7e
No related branches found
No related tags found
No related merge requests found
......@@ -77,9 +77,9 @@ package object debug {
}
/**
* Augments [[DataFrame]]s with debug methods.
* Augments [[Dataset]]s with debug methods.
*/
implicit class DebugQuery(query: DataFrame) extends Logging {
implicit class DebugQuery(query: Dataset[_]) extends Logging {
def debug(): Unit = {
val plan = query.queryExecution.executedPlan
val visited = new collection.mutable.HashSet[TreeNodeRef]()
......
......@@ -19,6 +19,7 @@ package org.apache.spark.sql.execution.debug
import org.apache.spark.SparkFunSuite
import org.apache.spark.sql.test.SharedSQLContext
import org.apache.spark.sql.test.SQLTestData.TestData
class DebuggingSuite extends SparkFunSuite with SharedSQLContext {
......@@ -26,6 +27,11 @@ class DebuggingSuite extends SparkFunSuite with SharedSQLContext {
testData.debug()
}
test("Dataset.debug()") {
import testImplicits._
testData.as[TestData].debug()
}
test("debugCodegen") {
val res = codegenString(sqlContext.range(10).groupBy("id").count().queryExecution.executedPlan)
assert(res.contains("Subtree 1 / 2"))
......
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