cjmctague closed pull request #1045: Fixes #1044
URL: https://github.com/apache/fluo/pull/1045
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/modules/core/src/main/java/org/apache/fluo/core/worker/finder/hash/TableRange.java
b/modules/core/src/main/java/org/apache/fluo/core/worker/finder/hash/TableRange.java
index a3c70bb7..ef4d5302 100644
---
a/modules/core/src/main/java/org/apache/fluo/core/worker/finder/hash/TableRange.java
+++
b/modules/core/src/main/java/org/apache/fluo/core/worker/finder/hash/TableRange.java
@@ -17,6 +17,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -104,21 +105,11 @@ public Range getRange() {
return new Range(tper, false, ter, true);
}
- @Override
- public int compareTo(TableRange o) {
- if (Objects.equals(getEndRow(), o.getEndRow())) {
- // this will catch case of both null
- return 0;
- }
-
- if (getEndRow() == null) {
- return 1;
- }
+ private static final Comparator<TableRange> TABLE_RANGE_COMPARATOR =
+ Comparator.comparing(TableRange::getEndRow,
Comparator.nullsLast(Bytes::compareTo));
- if (o.getEndRow() == null) {
- return -1;
- }
-
- return getEndRow().compareTo(o.getEndRow());
+ @Override
+ public int compareTo(TableRange other) {
+ return TABLE_RANGE_COMPARATOR.compare(this, other);
}
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services