DaveDeCaprio commented on a change in pull request #23169: [SPARK-26103][SQL]
Limit the length of debug strings for query plans
URL: https://github.com/apache/spark/pull/23169#discussion_r247354204
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/package.scala
##########
@@ -204,6 +204,27 @@ package object util extends Logging {
truncatedString(seq, "", sep, "", maxFields)
}
+ /** Whether we have warned about plan string truncation yet. */
+ private val planSizeWarningPrinted = new AtomicBoolean(false)
+
+ def withSizeLimitedWriter[T](writer: Writer)(f: (Writer) => T): Option[T] = {
+ try {
+ // Subtract 3 from the string length to leave room for the "..."
+ val limited = new SizeLimitedWriter(writer,
SQLConf.get.maxPlanStringLength - 3)
+ Some(f(limited))
+ }
+ catch {
+ case e: WriterSizeException =>
+ writer.write("...")
+ if (planSizeWarningPrinted.compareAndSet(false, true)) {
+ logWarning(
+ "Truncated the string representation of a plan since it was too
long. This " +
Review comment:
That should be possible.
----------------------------------------------------------------
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]