hvanhovell commented on a change in pull request #23406: [SPARK-26504][SQL]
Rope-wise dumping of Spark plans
URL: https://github.com/apache/spark/pull/23406#discussion_r244513118
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/QueryExecution.scala
##########
@@ -197,55 +193,65 @@ class QueryExecution(
}
def simpleString: String = withRedaction {
- s"""== Physical Plan ==
- |${stringOrError(executedPlan.treeString(verbose = false))}
- """.stripMargin.trim
+ val rope = new StringRope()
+
+ rope.append("== Physical Plan ==\n")
+ appendOrError(rope.append)(
+ executedPlan.treeString(_, false, false, SQLConf.get.maxToStringFields))
+ rope.append("\n")
+
+ rope.toString
}
- private def writeOrError(writer: Writer)(f: Writer => Unit): Unit = {
- try f(writer)
+ private def appendOrError(append: String => Unit)(f: (String => Unit) =>
Unit): Unit = {
Review comment:
You always call this method on a QueryPlan. Can we specialize this method
for this scenario and pass the plan and all the needed treeString parameters?
Different question. Is it possible that treeString already writes to the
appender before throwing an exception. It it does the output might look pretty
weird, because it will and contain a part of the tree and the exception thrown.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]