Github user HeartSaVioR commented on a diff in the pull request: https://github.com/apache/spark/pull/23169#discussion_r237309191 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/package.scala --- @@ -202,6 +202,26 @@ package object util extends Logging { /** Shorthand for calling truncatedString() without start or end strings. */ def truncatedString[T](seq: Seq[T], sep: String): String = truncatedString(seq, "", sep, "") + /** 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 { + val limited = new SizeLimitedWriter(writer, SQLConf.get.maxPlanStringLength) + Some(f(limited)) + } + catch { + case e: WriterSizeException => + writer.write("...") --- End diff -- nit: Would we want to restrict string's length to maxPlanStringLength including `...`? I think exceeding defined length by max 3 chars is not a big deal but just to double check.
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org