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_r244540168
 
 

 ##########
 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:
   Yeah that would be it. You can pass in a call-by-name parameter if you want 
to capture errors during construction. I prefer his over having some overly 
generic function.

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