MaxGekk commented on code in PR #41121:
URL: https://github.com/apache/spark/pull/41121#discussion_r1190294720
##########
core/src/main/scala/org/apache/spark/memory/UnifiedMemoryManager.scala:
##########
@@ -216,17 +216,21 @@ object UnifiedMemoryManager {
if (conf.contains(IS_TESTING)) 0 else RESERVED_SYSTEM_MEMORY_BYTES)
val minSystemMemory = (reservedMemory * 1.5).ceil.toLong
if (systemMemory < minSystemMemory) {
- throw new IllegalArgumentException(s"System memory $systemMemory must " +
- s"be at least $minSystemMemory. Please increase heap size using the
--driver-memory " +
- s"option or ${config.DRIVER_MEMORY.key} in Spark configuration.")
+ throw new SparkIllegalArgumentException(errorClass =
"INVALID_DRIVER_MEMORY",
+ messageParameters = Map(
Review Comment:
nit:
```suggestion
throw new SparkIllegalArgumentException(
errorClass = "INVALID_DRIVER_MEMORY",
messageParameters = Map(
```
##########
core/src/main/scala/org/apache/spark/memory/UnifiedMemoryManager.scala:
##########
@@ -216,17 +216,21 @@ object UnifiedMemoryManager {
if (conf.contains(IS_TESTING)) 0 else RESERVED_SYSTEM_MEMORY_BYTES)
val minSystemMemory = (reservedMemory * 1.5).ceil.toLong
if (systemMemory < minSystemMemory) {
- throw new IllegalArgumentException(s"System memory $systemMemory must " +
- s"be at least $minSystemMemory. Please increase heap size using the
--driver-memory " +
- s"option or ${config.DRIVER_MEMORY.key} in Spark configuration.")
+ throw new SparkIllegalArgumentException(errorClass =
"INVALID_DRIVER_MEMORY",
+ messageParameters = Map(
+ "systemMemory" -> systemMemory.toString,
+ "minSystemMemory" -> minSystemMemory.toString,
+ "config" -> config.DRIVER_MEMORY.key))
}
// SPARK-12759 Check executor memory to fail fast if memory is insufficient
if (conf.contains(config.EXECUTOR_MEMORY)) {
val executorMemory = conf.getSizeAsBytes(config.EXECUTOR_MEMORY.key)
if (executorMemory < minSystemMemory) {
- throw new IllegalArgumentException(s"Executor memory $executorMemory
must be at least " +
- s"$minSystemMemory. Please increase executor memory using the " +
- s"--executor-memory option or ${config.EXECUTOR_MEMORY.key} in Spark
configuration.")
+ throw new SparkIllegalArgumentException(errorClass =
"INVALID_EXECUTOR_MEMORY",
+ messageParameters = Map(
+ "executorMemory" -> executorMemory.toString,
+ "minSystemMemory" -> minSystemMemory.toString,
+ "config" -> config.EXECUTOR_MEMORY.key))
Review Comment:
Please, wrap the config by "" here or in the message format.
##########
core/src/main/scala/org/apache/spark/memory/UnifiedMemoryManager.scala:
##########
@@ -216,17 +216,21 @@ object UnifiedMemoryManager {
if (conf.contains(IS_TESTING)) 0 else RESERVED_SYSTEM_MEMORY_BYTES)
val minSystemMemory = (reservedMemory * 1.5).ceil.toLong
if (systemMemory < minSystemMemory) {
- throw new IllegalArgumentException(s"System memory $systemMemory must " +
- s"be at least $minSystemMemory. Please increase heap size using the
--driver-memory " +
- s"option or ${config.DRIVER_MEMORY.key} in Spark configuration.")
+ throw new SparkIllegalArgumentException(errorClass =
"INVALID_DRIVER_MEMORY",
+ messageParameters = Map(
+ "systemMemory" -> systemMemory.toString,
+ "minSystemMemory" -> minSystemMemory.toString,
+ "config" -> config.DRIVER_MEMORY.key))
Review Comment:
Could you wrap the config in the same way as `toSQLConf()`, please.
##########
core/src/main/scala/org/apache/spark/memory/UnifiedMemoryManager.scala:
##########
@@ -216,17 +216,21 @@ object UnifiedMemoryManager {
if (conf.contains(IS_TESTING)) 0 else RESERVED_SYSTEM_MEMORY_BYTES)
val minSystemMemory = (reservedMemory * 1.5).ceil.toLong
if (systemMemory < minSystemMemory) {
- throw new IllegalArgumentException(s"System memory $systemMemory must " +
- s"be at least $minSystemMemory. Please increase heap size using the
--driver-memory " +
- s"option or ${config.DRIVER_MEMORY.key} in Spark configuration.")
+ throw new SparkIllegalArgumentException(errorClass =
"INVALID_DRIVER_MEMORY",
+ messageParameters = Map(
+ "systemMemory" -> systemMemory.toString,
+ "minSystemMemory" -> minSystemMemory.toString,
+ "config" -> config.DRIVER_MEMORY.key))
}
// SPARK-12759 Check executor memory to fail fast if memory is insufficient
if (conf.contains(config.EXECUTOR_MEMORY)) {
val executorMemory = conf.getSizeAsBytes(config.EXECUTOR_MEMORY.key)
if (executorMemory < minSystemMemory) {
- throw new IllegalArgumentException(s"Executor memory $executorMemory
must be at least " +
- s"$minSystemMemory. Please increase executor memory using the " +
- s"--executor-memory option or ${config.EXECUTOR_MEMORY.key} in Spark
configuration.")
+ throw new SparkIllegalArgumentException(errorClass =
"INVALID_EXECUTOR_MEMORY",
+ messageParameters = Map(
Review Comment:
nit:
```suggestion
throw new SparkIllegalArgumentException(
errorClass = "INVALID_EXECUTOR_MEMORY",
messageParameters = Map(
```
--
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]