MAPREDUCE-4272. SortedRanges.Range#compareTo was not spec compliant. (Yu Gao via llu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1425180 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
40c3b7f0b2
commit
02e940d6a4
@ -81,6 +81,9 @@ Trunk (Unreleased)
|
|||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
||||||
|
MAPREDUCE-4272. SortedRanges.Range#compareTo is not spec compliant.
|
||||||
|
(Yu Gao via llu)
|
||||||
|
|
||||||
MAPREDUCE-4356. [Rumen] Provide access to the method
|
MAPREDUCE-4356. [Rumen] Provide access to the method
|
||||||
ParsedTask.obtainTaskAttempts(). (ravigummadi)
|
ParsedTask.obtainTaskAttempts(). (ravigummadi)
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ boolean isEmpty() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if(o!=null && o instanceof Range) {
|
if (o instanceof Range) {
|
||||||
Range range = (Range)o;
|
Range range = (Range)o;
|
||||||
return startIndex==range.startIndex &&
|
return startIndex==range.startIndex &&
|
||||||
length==range.length;
|
length==range.length;
|
||||||
@ -285,10 +285,11 @@ public int hashCode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int compareTo(Range o) {
|
public int compareTo(Range o) {
|
||||||
if(this.equals(o)) {
|
// Ensure sgn(x.compareTo(y) == -sgn(y.compareTo(x))
|
||||||
return 0;
|
return this.startIndex < o.startIndex ? -1 :
|
||||||
}
|
(this.startIndex > o.startIndex ? 1 :
|
||||||
return (this.startIndex > o.startIndex) ? 1:-1;
|
(this.length < o.length ? -1 :
|
||||||
|
(this.length > o.length ? 1 : 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFields(DataInput in) throws IOException {
|
public void readFields(DataInput in) throws IOException {
|
||||||
|
Loading…
Reference in New Issue
Block a user