Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion core/src/main/resources/error/error-classes.json
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,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."
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed it because there is another error class which shares the same function in source code, and it has the same structure and the first parameter objectName. Having the same name simplifies the implementation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: we will not get away with renaming parameter names in the long run, once third parties start building dependencies on the API.

],
"subClass" : {
"WITHOUT_SUGGESTION" : {
Expand Down
Loading