[
https://issues.apache.org/jira/browse/MAPREDUCE-4822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13572622#comment-13572622
]
Chu Tong commented on MAPREDUCE-4822:
-------------------------------------
When I look at the code the TaskAttemptID.forName method does not look like a
simple conversion. Therefore, I think it is safer to leave what it is right now.
public static TaskAttemptID forName(String str
) throws IllegalArgumentException {
if(str == null)
return null;
String exceptionMsg = null;
try {
String[] parts = str.split(Character.toString(SEPARATOR));
if(parts.length == 6) {
if(parts[0].equals(ATTEMPT)) {
String type = parts[3];
TaskType t = TaskID.getTaskType(type.charAt(0));
if(t != null) {
return new org.apache.hadoop.mapred.TaskAttemptID
(parts[1],
Integer.parseInt(parts[2]),
t, Integer.parseInt(parts[4]),
Integer.parseInt(parts[5]));
} else
exceptionMsg = "Bad TaskType identifier. TaskAttemptId string : "
+ str + " is not properly formed.";
}
}
} catch (Exception ex) {
//fall below
}
if (exceptionMsg == null) {
exceptionMsg = "TaskAttemptId string : " + str
+ " is not properly formed";
}
throw new IllegalArgumentException(exceptionMsg);
}
> Unnecessary conversions in History Events
> -----------------------------------------
>
> Key: MAPREDUCE-4822
> URL: https://issues.apache.org/jira/browse/MAPREDUCE-4822
> Project: Hadoop Map/Reduce
> Issue Type: Improvement
> Components: jobhistoryserver
> Affects Versions: 0.23.4
> Reporter: Robert Joseph Evans
> Assignee: Chu Tong
> Priority: Trivial
> Labels: patch
> Fix For: 0.24.0
>
> Attachments: MAPREDUCE-4822.patch
>
>
> There are a number of conversions in the Job History Event classes that are
> totally unnecessary. It appears that they were originally used to convert
> from the internal avro format, but now many of them do not pull the values
> from the avro they store them internally.
> For example:
> {code:title=TaskAttemptFinishedEvent.java}
> /** Get the task type */
> public TaskType getTaskType() {
> return TaskType.valueOf(taskType.toString());
> }
> {code}
> The code currently is taking an enum, converting it to a string and then
> asking the same enum to convert it back to an enum. If java work properly
> this should be a noop and a reference to the original taskType should be
> returned.
> There are several places that a string is having toString called on it, and
> since strings are immutable it returns a reference to itself.
> The various ids are not immutable and probably should not be changed at this
> point.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira