You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2020/08/17 11:57:14 UTC
[hbase] branch master updated: HBASE-24887 Remove Row.compareTo
This is an automated email from the ASF dual-hosted git repository.
vjasani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/master by this push:
new c8c2016 HBASE-24887 Remove Row.compareTo
c8c2016 is described below
commit c8c20160dadb0c52239702f78078fe924f1468a0
Author: Joseph295 <51...@qq.com>
AuthorDate: Mon Aug 17 17:19:17 2020 +0530
HBASE-24887 Remove Row.compareTo
Closes #2262
Signed-off-by: Viraj Jasani <vj...@apache.org>
Signed-off-by: Jan Hentschel <ja...@ultratendency.com>
---
.../org/apache/hadoop/hbase/client/Action.java | 2 +-
.../java/org/apache/hadoop/hbase/client/Get.java | 9 +-----
.../org/apache/hadoop/hbase/client/Mutation.java | 10 ------
.../hbase/client/RegionCoprocessorServiceExec.java | 3 +-
.../java/org/apache/hadoop/hbase/client/Row.java | 9 +-----
.../apache/hadoop/hbase/client/RowMutations.java | 36 ----------------------
6 files changed, 4 insertions(+), 65 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Action.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Action.java
index 4496a9e..fdf3485 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Action.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Action.java
@@ -80,7 +80,7 @@ public class Action implements Comparable<Action> {
@Override
public int compareTo(Action other) {
- return action.compareTo(other.getAction());
+ return Row.COMPARATOR.compare(action, other.getAction());
}
@Override
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
index 3609c91..d3b57fb 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
@@ -459,13 +459,6 @@ public class Get extends Query implements Row {
return map;
}
- //Row
- @Override
- public int compareTo(Row other) {
- // TODO: This is wrong. Can't have two gets the same just because on same row.
- return Bytes.compareTo(this.getRow(), other.getRow());
- }
-
@Override
public int hashCode() {
// TODO: This is wrong. Can't have two gets the same just because on same row. But it
@@ -483,7 +476,7 @@ public class Get extends Query implements Row {
}
Row other = (Row) obj;
// TODO: This is wrong. Can't have two gets the same just because on same row.
- return compareTo(other) == 0;
+ return Row.COMPARATOR.compare(this, other) == 0;
}
@Override
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
index d575d0b..6ade9eb 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
@@ -323,16 +323,6 @@ public abstract class Mutation extends OperationWithAttributes implements Row, C
}
/**
- * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
- * Use {@link Row#COMPARATOR} instead
- */
- @Deprecated
- @Override
- public int compareTo(final Row d) {
- return Bytes.compareTo(this.getRow(), d.getRow());
- }
-
- /**
* Method for retrieving the timestamp.
*
* @return timestamp
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorServiceExec.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorServiceExec.java
index d9ff454..711f97b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorServiceExec.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RegionCoprocessorServiceExec.java
@@ -72,9 +72,8 @@ public class RegionCoprocessorServiceExec implements Row {
return request;
}
- @Override
public int compareTo(Row o) {
- int res = Bytes.compareTo(this.getRow(), o.getRow());
+ int res = Row.COMPARATOR.compare(this, o);
if ((o instanceof RegionCoprocessorServiceExec) && res == 0) {
RegionCoprocessorServiceExec exec = (RegionCoprocessorServiceExec) o;
res = method.getFullName().compareTo(exec.getMethod().getFullName());
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Row.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Row.java
index 3152f9e..c6eb4cc 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Row.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Row.java
@@ -26,17 +26,10 @@ import org.apache.yetus.audience.InterfaceAudience;
* Has a row.
*/
@InterfaceAudience.Public
-public interface Row extends Comparable<Row> {
+public interface Row {
Comparator<Row> COMPARATOR = (v1, v2) -> Bytes.compareTo(v1.getRow(), v2.getRow());
/**
* @return The row.
*/
byte [] getRow();
-
- /**
- * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
- * Use {@link Row#COMPARATOR} instead
- */
- @Deprecated
- int compareTo(Row var1);
}
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
index 345e26a..c9baa28 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/RowMutations.java
@@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.client;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@@ -127,41 +126,6 @@ public class RowMutations implements Row {
return this;
}
- /**
- * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
- * Use {@link Row#COMPARATOR} instead
- */
- @Deprecated
- @Override
- public int compareTo(Row i) {
- return Bytes.compareTo(this.getRow(), i.getRow());
- }
-
- /**
- * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
- * No replacement
- */
- @Deprecated
- @Override
- public boolean equals(Object obj) {
- if (obj == this) return true;
- if (obj instanceof RowMutations) {
- RowMutations other = (RowMutations)obj;
- return compareTo(other) == 0;
- }
- return false;
- }
-
- /**
- * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
- * No replacement
- */
- @Deprecated
- @Override
- public int hashCode(){
- return Arrays.hashCode(row);
- }
-
@Override
public byte[] getRow() {
return row;