HBASE-19008 Add missing equals or hashCode method(s) to stock Filter implementations

Signed-off-by: Reid Chan <reidchan@apache.org>
Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
liubangchen 2018-08-23 11:19:17 +08:00 committed by Reid Chan
parent cf4d23f8d4
commit a7a281a644
33 changed files with 575 additions and 0 deletions

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.yetus.audience.InterfaceAudience;
@ -132,4 +133,18 @@ public class ColumnCountGetFilter extends FilterBase {
public String toString() {
return this.getClass().getSimpleName() + " " + this.limit;
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnCountGetFilter))) {
return false;
}
ColumnCountGetFilter f = (ColumnCountGetFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.limit);
}
}

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
@ -230,4 +231,18 @@ public class ColumnPaginationFilter extends FilterBase {
return String.format("%s (%d, %d)", this.getClass().getSimpleName(),
this.limit, this.offset);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnPaginationFilter))) {
return false;
}
ColumnPaginationFilter f = (ColumnPaginationFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.limit, this.offset);
}
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.ByteBufferExtendedCell;
import org.apache.hadoop.hbase.Cell;
@ -161,4 +162,18 @@ public class ColumnPrefixFilter extends FilterBase {
public String toString() {
return this.getClass().getSimpleName() + " " + Bytes.toStringBinary(this.prefix);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnPrefixFilter))) {
return false;
}
ColumnPrefixFilter f = (ColumnPrefixFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getPrefix()));
}
}

View File

@ -23,6 +23,7 @@ import static org.apache.hadoop.hbase.util.Bytes.len;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
@ -239,4 +240,19 @@ public class ColumnRangeFilter extends FilterBase {
+ ", " + Bytes.toStringBinary(this.maxColumn)
+ (this.maxColumnInclusive ? "]" : ")");
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnRangeFilter))) {
return false;
}
ColumnRangeFilter f = (ColumnRangeFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(Bytes.toStringBinary(this.getMinColumn()), this.getMinColumnInclusive(),
Bytes.toStringBinary(this.getMaxColumn()), this.getMaxColumnInclusive());
}
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
@ -238,4 +239,19 @@ public class ColumnValueFilter extends FilterBase {
Bytes.toStringBinary(this.qualifier), this.op.name(),
Bytes.toStringBinary(this.comparator.getValue()));
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnValueFilter))) {
return false;
}
ColumnValueFilter f = (ColumnValueFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getFamily()), Bytes.hashCode(this.getQualifier()),
this.getCompareOperator(), this.getComparator());
}
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CompareOperator;
@ -321,4 +322,18 @@ public abstract class CompareFilter extends FilterBase {
this.op.name(),
Bytes.toStringBinary(this.comparator.getValue()));
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof CompareFilter))) {
return false;
}
CompareFilter f = (CompareFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.getComparator(), this.getCompareOperator());
}
}

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import org.apache.hadoop.hbase.Cell;
@ -311,4 +312,19 @@ public class DependentColumnFilter extends CompareFilter {
this.op.name(),
this.comparator != null ? Bytes.toStringBinary(this.comparator.getValue()) : "null");
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof DependentColumnFilter))) {
return false;
}
DependentColumnFilter f = (DependentColumnFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getFamily()), Bytes.hashCode(this.getQualifier()),
this.dropDependentColumn());
}
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CompareOperator;
@ -146,4 +147,18 @@ public class FamilyFilter extends CompareFilter {
FamilyFilter other = (FamilyFilter)o;
return super.areSerializedFieldsEqual(other);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FamilyFilter))) {
return false;
}
FamilyFilter f = (FamilyFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.getComparator(), this.getCompareOperator());
}
}

View File

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.yetus.audience.InterfaceAudience;
@ -276,4 +277,17 @@ final public class FilterList extends FilterBase {
public String toString() {
return this.filterListBase.toString();
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FilterList))) {
return false;
}
FilterList f = (FilterList) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.getOperator(), Arrays.hashCode(this.getFilters().toArray()));
}
}

View File

@ -24,8 +24,10 @@ import org.apache.yetus.audience.InterfaceAudience;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* FilterListWithAND represents an ordered list of filters which will be evaluated with an AND
@ -279,4 +281,21 @@ public class FilterListWithAND extends FilterListBase {
}
return maxHint;
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FilterListWithAND))) {
return false;
}
if (this == obj) {
return true;
}
FilterListWithAND f = (FilterListWithAND) obj;
return this.filters.equals(f.getFilters()) && this.seekHintFilters.equals(f.seekHintFilters);
}
@Override
public int hashCode() {
return Objects.hash(this.seekHintFilters, Arrays.hashCode(this.filters.toArray()));
}
}

View File

@ -26,8 +26,10 @@ import org.apache.yetus.audience.InterfaceAudience;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* FilterListWithOR represents an ordered list of filters which will be evaluated with an OR
@ -391,4 +393,25 @@ public class FilterListWithOR extends FilterListBase {
}
return minKeyHint;
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FilterListWithOR))) {
return false;
}
if (this == obj) {
return true;
}
FilterListWithOR f = (FilterListWithOR) obj;
return this.filters.equals(f.getFilters()) &&
this.prevFilterRCList.equals(f.prevFilterRCList) &&
this.prevCellList.equals(f.prevCellList);
}
@Override
public int hashCode() {
return Objects.hash(Arrays.hashCode(this.prevFilterRCList.toArray()),
Arrays.hashCode(this.prevCellList.toArray()), Arrays.hashCode(this.filters.toArray()));
}
}

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.hbase.filter;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
@ -133,4 +134,18 @@ public class FirstKeyValueMatchingQualifiersFilter extends FirstKeyOnlyFilter {
FirstKeyValueMatchingQualifiersFilter other = (FirstKeyValueMatchingQualifiersFilter)o;
return this.qualifiers.equals(other.qualifiers);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FirstKeyValueMatchingQualifiersFilter))) {
return false;
}
FirstKeyValueMatchingQualifiersFilter f = (FirstKeyValueMatchingQualifiersFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.qualifiers);
}
}

View File

@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.PriorityQueue;
import org.apache.hadoop.hbase.Cell;
@ -646,4 +647,18 @@ public class FuzzyRowFilter extends FilterBase {
}
return true;
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FuzzyRowFilter))) {
return false;
}
FuzzyRowFilter f = (FuzzyRowFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.fuzzyKeysData.toArray());
}
}

View File

@ -20,6 +20,7 @@
package org.apache.hadoop.hbase.filter;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellComparator;
@ -131,4 +132,18 @@ public class InclusiveStopFilter extends FilterBase {
public String toString() {
return this.getClass().getSimpleName() + " " + Bytes.toStringBinary(this.stopRowKey);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof InclusiveStopFilter))) {
return false;
}
InclusiveStopFilter f = (InclusiveStopFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(Bytes.hashCode(this.stopRowKey));
}
}

View File

@ -23,7 +23,9 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.Objects;
import java.util.Optional;
import org.apache.hadoop.hbase.ByteBufferExtendedCell;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HConstants;
@ -133,6 +135,20 @@ public class KeyOnlyFilter extends FilterBase {
return this.lenAsVal == other.lenAsVal;
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof KeyOnlyFilter))) {
return false;
}
KeyOnlyFilter f = (KeyOnlyFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.lenAsVal);
}
static class KeyOnlyCell implements Cell {
private Cell cell;
private boolean lenAsVal;

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.filter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
@ -512,5 +513,42 @@ public class MultiRowRangeFilter extends FilterBase {
|| Bytes.compareTo(startRow, stopRow) < 0
|| (Bytes.compareTo(startRow, stopRow) == 0 && stopRowInclusive == true);
}
@Override
public boolean equals(Object obj){
if (obj == null || (!(obj instanceof RowRange))) {
return false;
}
if (this == obj) {
return true;
}
RowRange rr = (RowRange) obj;
return Bytes.equals(this.stopRow, rr.getStopRow()) &&
Bytes.equals(this.startRow, this.getStartRow()) &&
this.startRowInclusive == rr.isStartRowInclusive() &&
this.stopRowInclusive == rr.isStopRowInclusive();
}
@Override
public int hashCode() {
return Objects.hash(Bytes.hashCode(this.stopRow),
Bytes.hashCode(this.startRow),
this.startRowInclusive,
this.stopRowInclusive);
}
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof MultiRowRangeFilter))) {
return false;
}
MultiRowRangeFilter f = (MultiRowRangeFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.rangeList.toArray());
}
}

View File

@ -19,7 +19,9 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Objects;
import java.util.TreeSet;
import org.apache.hadoop.hbase.Cell;
@ -207,4 +209,18 @@ public class MultipleColumnPrefixFilter extends FilterBase {
return String.format("%s (%d/%d): [%s]", this.getClass().getSimpleName(),
count, this.sortedPrefixes.size(), prefixes.toString());
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof MultipleColumnPrefixFilter))) {
return false;
}
MultipleColumnPrefixFilter f = (MultipleColumnPrefixFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(Arrays.hashCode(this.sortedPrefixes.toArray()));
}
}

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.exceptions.DeserializationException;
@ -150,4 +151,18 @@ public class PageFilter extends FilterBase {
public String toString() {
return this.getClass().getSimpleName() + " " + this.pageSize;
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof PageFilter))) {
return false;
}
PageFilter f = (PageFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.pageSize);
}
}

View File

@ -20,6 +20,7 @@
package org.apache.hadoop.hbase.filter;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.ByteBufferExtendedCell;
import org.apache.hadoop.hbase.Cell;
@ -156,4 +157,18 @@ public class PrefixFilter extends FilterBase {
public String toString() {
return this.getClass().getSimpleName() + " " + Bytes.toStringBinary(this.prefix);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof PrefixFilter))) {
return false;
}
PrefixFilter f = (PrefixFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getPrefix()));
}
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CompareOperator;
@ -143,4 +144,18 @@ public class QualifierFilter extends CompareFilter {
return super.areSerializedFieldsEqual(o);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof QualifierFilter))) {
return false;
}
QualifierFilter f = (QualifierFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.getComparator(), this.getCompareOperator());
}
}

View File

@ -19,6 +19,7 @@
package org.apache.hadoop.hbase.filter;
import java.util.Objects;
import java.util.Random;
import org.apache.hadoop.hbase.Cell;
@ -154,4 +155,18 @@ public class RandomRowFilter extends FilterBase {
RandomRowFilter other = (RandomRowFilter)o;
return this.getChance() == other.getChance();
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof RandomRowFilter))) {
return false;
}
RandomRowFilter f = (RandomRowFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.getChance());
}
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CompareOperator;
@ -160,4 +161,18 @@ public class RowFilter extends CompareFilter {
return super.areSerializedFieldsEqual(o);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof RowFilter))) {
return false;
}
RowFilter f = (RowFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.getComparator(), this.getCompareOperator());
}
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
@ -460,4 +461,19 @@ public class SingleColumnValueFilter extends FilterBase {
Bytes.toStringBinary(this.columnQualifier), this.op.name(),
Bytes.toStringBinary(this.comparator.getValue()));
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(SingleColumnValueFilter.class.isInstance(obj)))) {
return false;
}
SingleColumnValueFilter f = (SingleColumnValueFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getFamily()), Bytes.hashCode(this.getQualifier()),
this.op, this.getComparator(), this.getFilterIfMissing(), this.getLatestVersionOnly());
}
}

View File

@ -20,6 +20,7 @@
package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.yetus.audience.InterfaceAudience;
@ -161,4 +162,18 @@ public class SkipFilter extends FilterBase {
public String toString() {
return this.getClass().getSimpleName() + " " + this.filter.toString();
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) {
return false;
}
SkipFilter f = (SkipFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.filter);
}
}

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.TreeSet;
import org.apache.hadoop.hbase.Cell;
@ -238,4 +239,18 @@ public class TimestampsFilter extends FilterBase {
return String.format("%s (%d/%d): [%s] canHint: [%b]", this.getClass().getSimpleName(),
count, this.timestamps.size(), tsList.toString(), canHint);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof TimestampsFilter))) {
return false;
}
TimestampsFilter f = (TimestampsFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.getTimestamps().toArray());
}
}

View File

@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CompareOperator;
@ -139,4 +140,18 @@ public class ValueFilter extends CompareFilter {
return super.areSerializedFieldsEqual(o);
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ValueFilter))) {
return false;
}
ValueFilter f = (ValueFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.getComparator(), this.getCompareOperator());
}
}

View File

@ -20,6 +20,7 @@
package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.yetus.audience.InterfaceAudience;
@ -163,4 +164,18 @@ public class WhileMatchFilter extends FilterBase {
public String toString() {
return this.getClass().getSimpleName() + " " + this.filter.toString();
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) {
return false;
}
WhileMatchFilter f = (WhileMatchFilter) obj;
return this.areSerializedFieldsEqual(f);
}
@Override
public int hashCode() {
return Objects.hash(this.filter);
}
}

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.security.access;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.Cell;
@ -173,4 +174,26 @@ class AccessControlFilter extends FilterBase {
throw new UnsupportedOperationException(
"Serialization not supported. Intended for server-side use only.");
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) {
return false;
}
if(this == obj){
return true;
}
AccessControlFilter f=(AccessControlFilter)obj;
return this.authManager.equals(f.authManager) &&
this.table.equals(f.table) &&
this.user.equals(f.user) &&
this.strategy.equals(f.strategy) &&
this.cfVsMaxVersions.equals(f.cfVsMaxVersions);
}
@Override
public int hashCode() {
return Objects.hash(this.authManager, this.table, this.strategy, this.user,
this.cfVsMaxVersions);
}
}

View File

@ -1038,6 +1038,23 @@ public class VisibilityController implements MasterCoprocessor, RegionCoprocesso
deleteCellVisTagsFormat);
return matchFound ? ReturnCode.INCLUDE : ReturnCode.SKIP;
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) {
return false;
}
if(this == obj){
return true;
}
DeleteVersionVisibilityExpressionFilter f = (DeleteVersionVisibilityExpressionFilter)obj;
return this.deleteCellVisTags.equals(f.deleteCellVisTags) &&
this.deleteCellVisTagsFormat.equals(f.deleteCellVisTagsFormat);
}
@Override
public int hashCode() {
return Objects.hash(this.deleteCellVisTags, this.deleteCellVisTagsFormat);
}
}
/**

View File

@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.security.visibility;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.Cell;
@ -90,4 +91,21 @@ class VisibilityLabelFilter extends FilterBase {
this.curFamilyMaxVersions = 0;
this.curQualMetVersions = 0;
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) {
return false;
}
if(this == obj){
return true;
}
VisibilityLabelFilter f = (VisibilityLabelFilter)obj;
return this.expEvaluator.equals(f.expEvaluator) &&
this.cfVsMaxVersions.equals(f.cfVsMaxVersions);
}
@Override
public int hashCode() {
return Objects.hash(this.expEvaluator, this.cfVsMaxVersions);
}
}

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.hbase.client;
import java.io.IOException;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.yetus.audience.InterfaceAudience;
@ -55,4 +56,21 @@ public final class ColumnCountOnRowFilter extends FilterBase {
public static ColumnCountOnRowFilter parseFrom(byte[] bytes) throws DeserializationException {
return new ColumnCountOnRowFilter(Bytes.toInt(bytes));
}
@Override
public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) {
return false;
}
if (this == obj) {
return true;
}
ColumnCountOnRowFilter f = (ColumnCountOnRowFilter) obj;
return this.limit == f.limit;
}
@Override
public int hashCode() {
return Objects.hash(this.limit);
}
}

View File

@ -25,6 +25,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.CellUtil;

View File

@ -27,6 +27,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellComparator;
import org.apache.hadoop.hbase.CompareOperator;
@ -647,6 +649,23 @@ public class TestFilterList {
this.didCellPassToTheFilter = true;
return targetRetCode;
}
@Override
public boolean equals(Object obj) {
if(obj == null || !(obj instanceof MockFilter)){
return false;
}
if(obj == this){
return true;
}
MockFilter f = (MockFilter)obj;
return this.targetRetCode.equals(f.targetRetCode);
}
@Override
public int hashCode() {
return Objects.hash(this.targetRetCode);
}
}
@Test
@ -819,6 +838,23 @@ public class TestFilterList {
public Cell getNextCellHint(Cell currentCell) throws IOException {
return this.returnCell;
}
@Override
public boolean equals(Object obj) {
if(obj == null || !(obj instanceof MockSeekHintFilter)){
return false;
}
if(obj == this){
return true;
}
MockSeekHintFilter f = (MockSeekHintFilter)obj;
return this.returnCell.equals(f.returnCell);
}
@Override
public int hashCode() {
return Objects.hash(this.returnCell);
}
}
@Test
@ -988,6 +1024,23 @@ public class TestFilterList {
public boolean getTransformed() {
return this.transformed;
}
@Override
public boolean equals(Object obj) {
if(obj == null || !(obj instanceof TransformFilter)){
return false;
}
if(obj == this){
return true;
}
TransformFilter f = (TransformFilter)obj;
return this.targetRetCode.equals(f.targetRetCode);
}
@Override
public int hashCode() {
return Objects.hash(this.targetRetCode);
}
}
@Test