-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-28537][SQL] DebugExec cannot debug broadcast or columnar related queries. #25274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
6fd6260
8ee28f5
2685272
ee1c26f
e67d004
46c6598
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,10 @@ | |||||
|
|
||||||
| package org.apache.spark.sql.execution.debug | ||||||
|
|
||||||
| import java.io.ByteArrayOutputStream | ||||||
|
|
||||||
| import scala.util.control.NonFatal | ||||||
|
|
||||||
| import org.apache.spark.SparkFunSuite | ||||||
| import org.apache.spark.sql.functions._ | ||||||
| import org.apache.spark.sql.test.SharedSQLContext | ||||||
|
|
@@ -48,4 +52,44 @@ class DebuggingSuite extends SparkFunSuite with SharedSQLContext { | |||||
| assert(res.forall{ case (subtree, code) => | ||||||
| subtree.contains("Range") && code.contains("Object[]")}) | ||||||
| } | ||||||
|
|
||||||
| test("SPARK-28537: DebugExec cannot debug broadcast related queries") { | ||||||
| val rightDF = spark.range(10) | ||||||
| val leftDF = spark.range(10) | ||||||
| val joinedDF = leftDF.join(rightDF, leftDF("id") === rightDF("id")) | ||||||
|
|
||||||
| val captured = new ByteArrayOutputStream() | ||||||
| Console.withOut(captured) { | ||||||
| joinedDF.debug() | ||||||
| } | ||||||
|
|
||||||
| val output = captured.toString() | ||||||
| assert(output.contains( | ||||||
| """== BroadcastExchange HashedRelationBroadcastMode(List(input[0, bigint, false])) == | ||||||
| |Tuples output: 0 | ||||||
| | id LongType: {} | ||||||
| |== WholeStageCodegen == | ||||||
| |Tuples output: 10 | ||||||
| | id LongType: {java.lang.Long} | ||||||
| |== Range (0, 10, step=1, splits=2) == | ||||||
| |Tuples output: 0 | ||||||
| | id LongType: {}""".stripMargin)) | ||||||
| } | ||||||
|
|
||||||
| test("SPARK-28537: DebugExec cannot debug columnar related queries") { | ||||||
| val df = spark.range(5) | ||||||
| df.persist() | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shall we unpersist this? |
||||||
|
|
||||||
| val captured = new ByteArrayOutputStream() | ||||||
| Console.withOut(captured) { | ||||||
| df.debug() | ||||||
| } | ||||||
|
|
||||||
| val output = captured.toString()replaceAll ("#\\d+", "#x") | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! What an embarrassing mistake... |
||||||
| assert(output.contains( | ||||||
| s"""== InMemoryTableScan [id#xL] == | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh... I forgot to remove it. |
||||||
| |Tuples output: 0 | ||||||
| | id LongType: {} | ||||||
| |""".stripMargin)) | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we split this into 2 different tests?