Repository: spark
Updated Branches:
  refs/heads/master 3f749f7ed -> 76f3c735a


[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 <ma...@databricks.com>

Closes #12140 from mateiz/debug-dataset.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/76f3c735
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/76f3c735
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/76f3c735

Branch: refs/heads/master
Commit: 76f3c735aa300d7ea6b17e64cc22d7e8fc3a8322
Parents: 3f749f7
Author: Matei Zaharia <ma...@databricks.com>
Authored: Sun Apr 3 21:08:54 2016 -0700
Committer: Reynold Xin <r...@databricks.com>
Committed: Sun Apr 3 21:08:54 2016 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/execution/debug/package.scala   | 4 ++--
 .../org/apache/spark/sql/execution/debug/DebuggingSuite.scala  | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/76f3c735/sql/core/src/main/scala/org/apache/spark/sql/execution/debug/package.scala
----------------------------------------------------------------------
diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/debug/package.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/debug/package.scala
index 7b0c8eb..17eae88 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/execution/debug/package.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/debug/package.scala
@@ -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]()

http://git-wip-us.apache.org/repos/asf/spark/blob/76f3c735/sql/core/src/test/scala/org/apache/spark/sql/execution/debug/DebuggingSuite.scala
----------------------------------------------------------------------
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/debug/DebuggingSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/debug/DebuggingSuite.scala
index c0fce4b..8aa0114 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/debug/DebuggingSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/debug/DebuggingSuite.scala
@@ -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"))


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to