Skip to content

Commit 1f0e43a

Browse files
committed
HBASE-22232 Removed deprecated methods in CompareFilter
1 parent 1584d24 commit 1f0e43a

File tree

24 files changed

+34
-576
lines changed

24 files changed

+34
-576
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import org.apache.hadoop.hbase.client.coprocessor.Batch;
5050
import org.apache.hadoop.hbase.client.coprocessor.Batch.Callback;
5151
import org.apache.hadoop.hbase.filter.BinaryComparator;
52-
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
5352
import org.apache.hadoop.hbase.io.TimeRange;
5453
import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
5554
import org.apache.hadoop.hbase.ipc.RpcControllerFactory;
@@ -667,13 +666,6 @@ public boolean checkAndPut(final byte [] row, final byte [] family, final byte [
667666
return doCheckAndPut(row, family, qualifier, CompareOperator.EQUAL.name(), value, null, put);
668667
}
669668

670-
@Override
671-
@Deprecated
672-
public boolean checkAndPut(final byte [] row, final byte [] family, final byte [] qualifier,
673-
final CompareOp compareOp, final byte [] value, final Put put) throws IOException {
674-
return doCheckAndPut(row, family, qualifier, compareOp.name(), value, null, put);
675-
}
676-
677669
@Override
678670
@Deprecated
679671
public boolean checkAndPut(final byte [] row, final byte [] family, final byte [] qualifier,
@@ -711,13 +703,6 @@ public boolean checkAndDelete(final byte[] row, final byte[] family, final byte[
711703
delete);
712704
}
713705

714-
@Override
715-
@Deprecated
716-
public boolean checkAndDelete(final byte[] row, final byte[] family, final byte[] qualifier,
717-
final CompareOp compareOp, final byte[] value, final Delete delete) throws IOException {
718-
return doCheckAndDelete(row, family, qualifier, compareOp.name(), value, null, delete);
719-
}
720-
721706
@Override
722707
@Deprecated
723708
public boolean checkAndDelete(final byte[] row, final byte[] family, final byte[] qualifier,
@@ -816,14 +801,6 @@ protected MultiResponse rpcCall() throws Exception {
816801
return ((Result)results[0]).getExists();
817802
}
818803

819-
@Override
820-
@Deprecated
821-
public boolean checkAndMutate(final byte [] row, final byte [] family, final byte [] qualifier,
822-
final CompareOp compareOp, final byte [] value, final RowMutations rm)
823-
throws IOException {
824-
return doCheckAndMutate(row, family, qualifier, compareOp.name(), value, null, rm);
825-
}
826-
827804
@Override
828805
@Deprecated
829806
public boolean checkAndMutate(final byte [] row, final byte [] family, final byte [] qualifier,

hbase-client/src/main/java/org/apache/hadoop/hbase/client/Table.java

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.apache.hadoop.hbase.HTableDescriptor;
3636
import org.apache.hadoop.hbase.TableName;
3737
import org.apache.hadoop.hbase.client.coprocessor.Batch;
38-
import org.apache.hadoop.hbase.filter.CompareFilter;
3938
import org.apache.hadoop.hbase.io.TimeRange;
4039
import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
4140
import org.apache.hadoop.hbase.util.Bytes;
@@ -305,35 +304,6 @@ default boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[]
305304
return checkAndPut(row, family, qualifier, CompareOperator.EQUAL, value, put);
306305
}
307306

308-
/**
309-
* Atomically checks if a row/family/qualifier value matches the expected
310-
* value. If it does, it adds the put. If the passed value is null, the check
311-
* is for the lack of column (ie: non-existence)
312-
*
313-
* The expected value argument of this call is on the left and the current
314-
* value of the cell is on the right side of the comparison operator.
315-
*
316-
* Ie. eg. GREATER operator means expected value > existing <=> add the put.
317-
*
318-
* @param row to check
319-
* @param family column family to check
320-
* @param qualifier column qualifier to check
321-
* @param compareOp comparison operator to use
322-
* @param value the expected value
323-
* @param put data to put if check succeeds
324-
* @throws IOException e
325-
* @return true if the new put was executed, false otherwise
326-
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #checkAndMutate(byte[], byte[])}
327-
*/
328-
@Deprecated
329-
default boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier,
330-
CompareFilter.CompareOp compareOp, byte[] value, Put put) throws IOException {
331-
RowMutations mutations = new RowMutations(put.getRow(), 1);
332-
mutations.add(put);
333-
334-
return checkAndMutate(row, family, qualifier, compareOp, value, mutations);
335-
}
336-
337307
/**
338308
* Atomically checks if a row/family/qualifier value matches the expected
339309
* value. If it does, it adds the put. If the passed value is null, the check
@@ -421,35 +391,6 @@ default boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
421391
return checkAndDelete(row, family, qualifier, CompareOperator.EQUAL, value, delete);
422392
}
423393

424-
/**
425-
* Atomically checks if a row/family/qualifier value matches the expected
426-
* value. If it does, it adds the delete. If the passed value is null, the
427-
* check is for the lack of column (ie: non-existence)
428-
*
429-
* The expected value argument of this call is on the left and the current
430-
* value of the cell is on the right side of the comparison operator.
431-
*
432-
* Ie. eg. GREATER operator means expected value > existing <=> add the delete.
433-
*
434-
* @param row to check
435-
* @param family column family to check
436-
* @param qualifier column qualifier to check
437-
* @param compareOp comparison operator to use
438-
* @param value the expected value
439-
* @param delete data to delete if check succeeds
440-
* @throws IOException e
441-
* @return true if the new delete was executed, false otherwise
442-
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #checkAndMutate(byte[], byte[])}
443-
*/
444-
@Deprecated
445-
default boolean checkAndDelete(byte[] row, byte[] family, byte[] qualifier,
446-
CompareFilter.CompareOp compareOp, byte[] value, Delete delete) throws IOException {
447-
RowMutations mutations = new RowMutations(delete.getRow(), 1);
448-
mutations.add(delete);
449-
450-
return checkAndMutate(row, family, qualifier, compareOp, value, mutations);
451-
}
452-
453394
/**
454395
* Atomically checks if a row/family/qualifier value matches the expected
455396
* value. If it does, it adds the delete. If the passed value is null, the
@@ -790,32 +731,6 @@ default <R extends Message> void batchCoprocessorService(
790731
throw new NotImplementedException("Add an implementation!");
791732
}
792733

793-
/**
794-
* Atomically checks if a row/family/qualifier value matches the expected value.
795-
* If it does, it performs the row mutations. If the passed value is null, the check
796-
* is for the lack of column (ie: non-existence)
797-
*
798-
* The expected value argument of this call is on the left and the current
799-
* value of the cell is on the right side of the comparison operator.
800-
*
801-
* Ie. eg. GREATER operator means expected value > existing <=> perform row mutations.
802-
*
803-
* @param row to check
804-
* @param family column family to check
805-
* @param qualifier column qualifier to check
806-
* @param compareOp the comparison operator
807-
* @param value the expected value
808-
* @param mutation mutations to perform if check succeeds
809-
* @throws IOException e
810-
* @return true if the new put was executed, false otherwise
811-
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use {@link #checkAndMutate(byte[], byte[])}
812-
*/
813-
@Deprecated
814-
default boolean checkAndMutate(byte[] row, byte[] family, byte[] qualifier,
815-
CompareFilter.CompareOp compareOp, byte[] value, RowMutations mutation) throws IOException {
816-
throw new NotImplementedException("Add an implementation!");
817-
}
818-
819734
/**
820735
* Atomically checks if a row/family/qualifier value matches the expected value.
821736
* If it does, it performs the row mutations. If the passed value is null, the check

hbase-client/src/main/java/org/apache/hadoop/hbase/filter/CompareFilter.java

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* See the License for the specific language governing permissions and
1717
* limitations under the License.
1818
*/
19-
2019
package org.apache.hadoop.hbase.filter;
2120

2221
import java.io.IOException;
@@ -55,46 +54,9 @@
5554
*/
5655
@InterfaceAudience.Public
5756
public abstract class CompareFilter extends FilterBase {
58-
/**
59-
* Comparison operators. For filters only!
60-
* Use {@link CompareOperator} otherwise.
61-
* It (intentionally) has at least the below enums with same names.
62-
* @deprecated since 2.0.0. Will be removed in 3.0.0. Use {@link CompareOperator} instead.
63-
*/
64-
@Deprecated
65-
@InterfaceAudience.Public
66-
public enum CompareOp {
67-
/** less than */
68-
LESS,
69-
/** less than or equal to */
70-
LESS_OR_EQUAL,
71-
/** equals */
72-
EQUAL,
73-
/** not equal */
74-
NOT_EQUAL,
75-
/** greater than or equal to */
76-
GREATER_OR_EQUAL,
77-
/** greater than */
78-
GREATER,
79-
/** no operation */
80-
NO_OP,
81-
}
82-
8357
protected CompareOperator op;
8458
protected ByteArrayComparable comparator;
8559

86-
/**
87-
* Constructor.
88-
* @param compareOp the compare op for row matching
89-
* @param comparator the comparator for row matching
90-
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use other constructor.
91-
*/
92-
@Deprecated
93-
public CompareFilter(final CompareOp compareOp,
94-
final ByteArrayComparable comparator) {
95-
this(CompareOperator.valueOf(compareOp.name()), comparator);
96-
}
97-
9860
/**
9961
* Constructor.
10062
* @param op the compare op for row matching
@@ -106,15 +68,6 @@ public CompareFilter(final CompareOperator op,
10668
this.comparator = comparator;
10769
}
10870

109-
/**
110-
* @return operator
111-
* @deprecated since 2.0.0. Will be removed in 3.0.0. Use {@link #getCompareOperator()} instead.
112-
*/
113-
@Deprecated
114-
public CompareOp getOperator() {
115-
return CompareOp.valueOf(op.name());
116-
}
117-
11871
public CompareOperator getCompareOperator() {
11972
return op;
12073
}
@@ -132,20 +85,6 @@ public boolean filterRowKey(Cell cell) throws IOException {
13285
return false;
13386
}
13487

135-
/**
136-
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
137-
* Use {@link #compareRow(CompareOperator, ByteArrayComparable, Cell)}
138-
*/
139-
@Deprecated
140-
protected boolean compareRow(final CompareOp compareOp, final ByteArrayComparable comparator,
141-
final Cell cell) {
142-
if (compareOp == CompareOp.NO_OP) {
143-
return true;
144-
}
145-
int compareResult = PrivateCellUtil.compareRow(cell, comparator);
146-
return compare(compareOp, compareResult);
147-
}
148-
14988
protected boolean compareRow(final CompareOperator op, final ByteArrayComparable comparator,
15089
final Cell cell) {
15190
if (op == CompareOperator.NO_OP) {
@@ -155,20 +94,6 @@ protected boolean compareRow(final CompareOperator op, final ByteArrayComparable
15594
return compare(op, compareResult);
15695
}
15796

158-
/**
159-
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
160-
* Use {@link #compareFamily(CompareOperator, ByteArrayComparable, Cell)}
161-
*/
162-
@Deprecated
163-
protected boolean compareFamily(final CompareOp compareOp, final ByteArrayComparable comparator,
164-
final Cell cell) {
165-
if (compareOp == CompareOp.NO_OP) {
166-
return true;
167-
}
168-
int compareResult = PrivateCellUtil.compareFamily(cell, comparator);
169-
return compare(compareOp, compareResult);
170-
}
171-
17297
protected boolean compareFamily(final CompareOperator op, final ByteArrayComparable comparator,
17398
final Cell cell) {
17499
if (op == CompareOperator.NO_OP) {
@@ -178,21 +103,6 @@ protected boolean compareFamily(final CompareOperator op, final ByteArrayCompara
178103
return compare(op, compareResult);
179104
}
180105

181-
/**
182-
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
183-
* Use {@link #compareQualifier(CompareOperator, ByteArrayComparable, Cell)}
184-
*/
185-
@Deprecated
186-
protected boolean compareQualifier(final CompareOp compareOp,
187-
final ByteArrayComparable comparator, final Cell cell) {
188-
// We do not call through to the non-deprecated method for perf reasons.
189-
if (compareOp == CompareOp.NO_OP) {
190-
return true;
191-
}
192-
int compareResult = PrivateCellUtil.compareQualifier(cell, comparator);
193-
return compare(compareOp, compareResult);
194-
}
195-
196106
protected boolean compareQualifier(final CompareOperator op,
197107
final ByteArrayComparable comparator, final Cell cell) {
198108
// We do not call through to the non-deprecated method for perf reasons.
@@ -203,21 +113,6 @@ protected boolean compareQualifier(final CompareOperator op,
203113
return compare(op, compareResult);
204114
}
205115

206-
/**
207-
* @deprecated Since 2.0.0. Will be removed in 3.0.0.
208-
* Use {@link #compareValue(CompareOperator, ByteArrayComparable, Cell)}
209-
*/
210-
@Deprecated
211-
protected boolean compareValue(final CompareOp compareOp, final ByteArrayComparable comparator,
212-
final Cell cell) {
213-
// We do not call through to the non-deprecated method for perf reasons.
214-
if (compareOp == CompareOp.NO_OP) {
215-
return true;
216-
}
217-
int compareResult = PrivateCellUtil.compareValue(cell, comparator);
218-
return compare(compareOp, compareResult);
219-
}
220-
221116
protected boolean compareValue(final CompareOperator op, final ByteArrayComparable comparator,
222117
final Cell cell) {
223118
if (op == CompareOperator.NO_OP) {
@@ -227,25 +122,6 @@ protected boolean compareValue(final CompareOperator op, final ByteArrayComparab
227122
return compare(op, compareResult);
228123
}
229124

230-
static boolean compare(final CompareOp op, int compareResult) {
231-
switch (op) {
232-
case LESS:
233-
return compareResult <= 0;
234-
case LESS_OR_EQUAL:
235-
return compareResult < 0;
236-
case EQUAL:
237-
return compareResult != 0;
238-
case NOT_EQUAL:
239-
return compareResult == 0;
240-
case GREATER_OR_EQUAL:
241-
return compareResult > 0;
242-
case GREATER:
243-
return compareResult >= 0;
244-
default:
245-
throw new RuntimeException("Unknown Compare op " + op.name());
246-
}
247-
}
248-
249125
static boolean compare(final CompareOperator op, int compareResult) {
250126
switch (op) {
251127
case LESS:

hbase-client/src/main/java/org/apache/hadoop/hbase/filter/DependentColumnFilter.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,29 +54,6 @@ public class DependentColumnFilter extends CompareFilter {
5454
protected boolean dropDependentColumn;
5555

5656
protected Set<Long> stampSet = new HashSet<>();
57-
58-
/**
59-
* Build a dependent column filter with value checking
60-
* dependent column varies will be compared using the supplied
61-
* compareOp and comparator, for usage of which
62-
* refer to {@link CompareFilter}
63-
*
64-
* @param family dependent column family
65-
* @param qualifier dependent column qualifier
66-
* @param dropDependentColumn whether the column should be discarded after
67-
* @param valueCompareOp comparison op
68-
* @param valueComparator comparator
69-
* @deprecated Since 2.0.0. Will be removed in 3.0.0. Use
70-
* {@link #DependentColumnFilter(byte[], byte[], boolean, CompareOperator, ByteArrayComparable)}
71-
* instead.
72-
*/
73-
@Deprecated
74-
public DependentColumnFilter(final byte [] family, final byte[] qualifier,
75-
final boolean dropDependentColumn, final CompareOp valueCompareOp,
76-
final ByteArrayComparable valueComparator) {
77-
this(family, qualifier, dropDependentColumn, CompareOperator.valueOf(valueCompareOp.name()),
78-
valueComparator);
79-
}
8057

8158
/**
8259
* Build a dependent column filter with value checking
@@ -123,7 +100,7 @@ public DependentColumnFilter(final byte [] family, final byte [] qualifier) {
123100
*/
124101
public DependentColumnFilter(final byte [] family, final byte [] qualifier,
125102
final boolean dropDependentColumn) {
126-
this(family, qualifier, dropDependentColumn, CompareOp.NO_OP, null);
103+
this(family, qualifier, dropDependentColumn, CompareOperator.NO_OP, null);
127104
}
128105

129106
/**

0 commit comments

Comments
 (0)