panbingkun commented on code in PR #45837:
URL: https://github.com/apache/spark/pull/45837#discussion_r1549093935
##########
common/utils/src/main/scala/org/apache/spark/internal/Logging.scala:
##########
@@ -49,6 +49,8 @@ case class MessageWithContext(message: String, context:
java.util.HashMap[String
resultMap.putAll(mdc.context)
MessageWithContext(message + mdc.message, resultMap)
}
+
+ override def toString: String = message
Review Comment:
Why override the method `toString`,
Dor the following scenarios, no need to write like as
```
throw new RuntimeException(errMsg.toString + ....
```
```
val errMsg = log"checkCategoryMaps failed for input with " +
log"maxCategories=${MDC(MAX_CATEGORIES, maxCategories)} " +
log"categoricalFeatures=${MDC(CATEGORICAL_FEATURES,
categoricalFeatures.mkString(", "))}"
...
throw new RuntimeException(errMsg + s". Categorical feature $feature failed"
+
s" metadata check. Found feature attribute: $featureAttr.")
```
--
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]