gengliangwang commented on a change in pull request #28610:
URL: https://github.com/apache/spark/pull/28610#discussion_r429092052



##########
File path: core/src/main/scala/org/apache/spark/util/Utils.scala
##########
@@ -2904,6 +2904,23 @@ private[spark] object Utils extends Logging {
     props.forEach((k, v) => resultProps.put(k, v))
     resultProps
   }
+
+  /**
+   * Convert a sequence of [[Path]] to a metadata string. When the length of 
metadata string
+   * exceeds `stopAppendingThreshold`, stop appending paths for saving memory.
+   */
+  def buildLocationMetadata(paths: Seq[Path], stopAppendingThreshold: Int): 
String = {
+    var metadata = "["
+    var index: Int = 0
+    while (index < paths.length && metadata.length <= stopAppendingThreshold) {
+      if (index > 0) {
+        metadata += ", "
+      }
+      metadata += paths(index).toString
+      index += 1
+    }
+    metadata + "]"

Review comment:
       There is `StringUtils.abbreviate` method call when converting to 
`simpleString` anyway.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to