-
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 2 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,8 @@ | |
|
|
||
| package org.apache.spark.sql.execution.debug | ||
|
|
||
| import java.io.ByteArrayOutputStream | ||
|
|
||
| import org.apache.spark.SparkFunSuite | ||
| import org.apache.spark.sql.functions._ | ||
| import org.apache.spark.sql.test.SharedSQLContext | ||
|
|
@@ -48,4 +50,49 @@ 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 or columnar related queries") { | ||
| val rightDF = spark.range(10) | ||
| val leftDF = spark.range(10) | ||
| val joinedDF = leftDF.join(rightDF, leftDF("id") === rightDF("id")) | ||
| try { | ||
| 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)) | ||
| } catch { | ||
|
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. why do we need this catch? the test would fail anyway
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. It's for better error message. |
||
| case e: Throwable => fail("debug() for broadcast failed with exception", e) | ||
| } | ||
|
|
||
| val df = spark.range(5) | ||
|
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. can we split this into 2 different tests? |
||
| 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? |
||
| try { | ||
| val captured = new ByteArrayOutputStream() | ||
| Console.withOut(captured) { | ||
| df.debug() | ||
| } | ||
|
|
||
| val exprId = df.queryExecution.executedPlan.output.head.toString | ||
| val output = captured.toString() | ||
| assert(output.contains( | ||
|
Member
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. For these kinds of tests, substring matching seems to be better than exact matching.
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. I'll follow the manner in ExplainSuite. |
||
| s"""== InMemoryTableScan [$exprId] == | ||
| |Tuples output: 0 | ||
| | id LongType: {} | ||
| |""".stripMargin)) | ||
| } catch { | ||
|
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. ditto |
||
| case e: Throwable => fail("debug() for columnar failed with exception", e) | ||
|
Member
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.
|
||
| } | ||
| } | ||
| } | ||
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.
IMO this is of improvements for debugging, so we don't need the prefix. cc: @dongjoon-hyun
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.
or->andin the title.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.
It seems that @sarutak reported this issue as a
BUG.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.
I think this is a BUG.