MaxGekk 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_r244533061
##########
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:
> Can we specialize this method for this scenario and pass the plan and all
the needed treeString parameters?
@hvanhovell Do you mean changes like in the PR
https://github.com/MaxGekk/spark-1/pull/16 ? Unfortunately it doesn't work well
because plan's constructor can produce `AnalysisException` which cannot be
handled with this approach.
----------------------------------------------------------------
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]