Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.io.IOException;

import org.apache.spark.errors.SparkCoreErrors;
import org.apache.spark.unsafe.array.LongArray;
import org.apache.spark.unsafe.memory.MemoryBlock;

Expand Down Expand Up @@ -153,9 +154,6 @@ private void throwOom(final MemoryBlock page, final long required) {
taskMemoryManager.freePage(page, this);
}
taskMemoryManager.showMemoryUsage();
// checkstyle.off: RegexpSinglelineJava
throw new SparkOutOfMemoryError("UNABLE_TO_ACQUIRE_MEMORY",
new String[]{Long.toString(required), Long.toString(got)});
// checkstyle.on: RegexpSinglelineJava
throw SparkCoreErrors.outOfMemoryError(required, got);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import org.apache.spark.SparkThrowableHelper;
import org.apache.spark.annotation.Private;

import java.util.Map;

/**
* This exception is thrown when a task can not acquire memory from the Memory manager.
* Instead of throwing {@link OutOfMemoryError}, which kills the executor,
Expand All @@ -28,7 +30,7 @@
@Private
public final class SparkOutOfMemoryError extends OutOfMemoryError implements SparkThrowable {
String errorClass;
String[] messageParameters;
Map<String, String> messageParameters;

public SparkOutOfMemoryError(String s) {
super(s);
Expand All @@ -38,15 +40,15 @@ public SparkOutOfMemoryError(OutOfMemoryError e) {
super(e.getMessage());
}

public SparkOutOfMemoryError(String errorClass, String[] messageParameters) {
public SparkOutOfMemoryError(String errorClass, Map<String, String> messageParameters) {
super(SparkThrowableHelper.getMessage(errorClass, null, messageParameters));
this.errorClass = errorClass;
this.messageParameters = messageParameters;
}

@Override
public String[] getMessageParameters() {
return messageParameters;
return SparkThrowableHelper.getMessageParameters(errorClass, null, messageParameters);
}

@Override
Expand Down
7 changes: 6 additions & 1 deletion core/src/main/resources/error/error-classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@
],
"sqlState" : "22023"
},
"TOO_MANY_ARRAY_ELEMENTS" : {
"message" : [
"Cannot initialize array with <numElements> elements of size <size>"
]
},
"UNABLE_TO_ACQUIRE_MEMORY" : {
"message" : [
"Unable to acquire <requestedBytes> bytes of memory, got <receivedBytes>"
Expand Down Expand Up @@ -484,7 +489,7 @@
},
"UNRESOLVED_MAP_KEY" : {
"message" : [
"Cannot resolve column <columnName> as a map key. If the key is a string literal, please add single quotes around it."
"Cannot resolve column <objectName> as a map key. If the key is a string literal, please add single quotes around it."
],
"subClass" : {
"WITHOUT_SUGGESTION" : {
Expand Down
Loading