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_r244514973
 
 

 ##########
 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:
   > because it will and contain a part of the tree and the exception thrown
   
   In the case of writing to a file, I think it is possible. I believe it will 
be a nice feature in trouble shooting. I would image a huge (maybe wrong) plan 
causes OOMs at some point. If we write some part of the plan to file, it would 
be helpful in debugging.

----------------------------------------------------------------
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]

Reply via email to