MaxGekk commented on code in PR #49650:
URL: https://github.com/apache/spark/pull/49650#discussion_r1928973196


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ExpressionSet.scala:
##########
@@ -178,5 +180,9 @@ class ExpressionSet protected(
        |baseSet: ${baseSet.mkString(", ")}
        |originals: ${originals.mkString(", ")}
      """.stripMargin
+
+  /** Returns a length limited string that must be used for logging only. */
+  def simpleString(maxFields: Int): String =
+    s"Set(${truncatedString(originals.map(_.simpleString(maxFields)).toSeq, ", 
", maxFields)})"

Review Comment:
   I guess you convert elements via `simpleString` even if it could be not 
needed. Let's imagine `originals` has 10000 elements, and `maxFields` is 5. Any 
any case you converts all 10000 elements to strings.
   
   How about to add override `truncatedString` w/ additional parameter: a 
function which converts `T` to `String`:
   
   ```scala
   truncatedString(originals.toSeq, "Set(", ", ", ")", maxFields, 
_.simpleString(maxFields))
   ```



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to