HBASE-21129 Clean up duplicate codes in #equals and #hashCode methods of Filter

Signed-off-by Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
Reid Chan 2018-09-03 15:25:29 +08:00
parent 5cca61c4d0
commit 245bb44703
36 changed files with 107 additions and 182 deletions

View File

@ -136,11 +136,7 @@ public class ColumnCountGetFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnCountGetFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
ColumnCountGetFilter f = (ColumnCountGetFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override

View File

@ -234,15 +234,12 @@ public class ColumnPaginationFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnPaginationFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
ColumnPaginationFilter f = (ColumnPaginationFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(this.limit, this.offset); return columnOffset == null ? Objects.hash(this.limit, this.offset) :
Objects.hash(this.limit, Bytes.hashCode(this.columnOffset));
} }
} }

View File

@ -21,7 +21,6 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.ByteBufferExtendedCell; import org.apache.hadoop.hbase.ByteBufferExtendedCell;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
@ -165,15 +164,11 @@ public class ColumnPrefixFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnPrefixFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
ColumnPrefixFilter f = (ColumnPrefixFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getPrefix())); return Bytes.hashCode(this.getPrefix());
} }
} }

View File

@ -243,16 +243,12 @@ public class ColumnRangeFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnRangeFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
ColumnRangeFilter f = (ColumnRangeFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(Bytes.toStringBinary(this.getMinColumn()), this.getMinColumnInclusive(), return Objects.hash(Bytes.hashCode(getMinColumn()), getMinColumnInclusive(),
Bytes.toStringBinary(this.getMaxColumn()), this.getMaxColumnInclusive()); Bytes.hashCode(getMaxColumn()), getMaxColumnInclusive());
} }
} }

View File

@ -242,16 +242,12 @@ public class ColumnValueFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof ColumnValueFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
ColumnValueFilter f = (ColumnValueFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getFamily()), Bytes.hashCode(this.getQualifier()), return Objects.hash(Bytes.hashCode(getFamily()), Bytes.hashCode(getQualifier()),
this.getCompareOperator(), this.getComparator()); getCompareOperator(), getComparator());
} }
} }

View File

@ -325,11 +325,7 @@ public abstract class CompareFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof CompareFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
CompareFilter f = (CompareFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override

View File

@ -315,16 +315,12 @@ public class DependentColumnFilter extends CompareFilter {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof DependentColumnFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
DependentColumnFilter f = (DependentColumnFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getFamily()), Bytes.hashCode(this.getQualifier()), return Objects.hash(Bytes.hashCode(getFamily()), Bytes.hashCode(getQualifier()),
this.dropDependentColumn()); dropDependentColumn(), getComparator(), getCompareOperator());
} }
} }

View File

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

View File

@ -277,17 +277,14 @@ final public class FilterList extends FilterBase {
public String toString() { public String toString() {
return this.filterListBase.toString(); return this.filterListBase.toString();
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FilterList))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
FilterList f = (FilterList) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(this.getOperator(), Arrays.hashCode(this.getFilters().toArray())); return Objects.hash(getOperator(), getFilters());
} }
} }

View File

@ -24,7 +24,6 @@ import org.apache.yetus.audience.InterfaceAudience;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -284,7 +283,7 @@ public class FilterListWithAND extends FilterListBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FilterListWithAND))) { if (!(obj instanceof FilterListWithAND)) {
return false; return false;
} }
if (this == obj) { if (this == obj) {
@ -296,6 +295,6 @@ public class FilterListWithAND extends FilterListBase {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(this.seekHintFilters, Arrays.hashCode(this.filters.toArray())); return Objects.hash(this.seekHintFilters, this.filters);
} }
} }

View File

@ -26,7 +26,6 @@ import org.apache.yetus.audience.InterfaceAudience;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@ -405,13 +404,12 @@ public class FilterListWithOR extends FilterListBase {
} }
FilterListWithOR f = (FilterListWithOR) obj; FilterListWithOR f = (FilterListWithOR) obj;
return this.filters.equals(f.getFilters()) && return this.filters.equals(f.getFilters()) &&
this.prevFilterRCList.equals(f.prevFilterRCList) && this.prevFilterRCList.equals(f.prevFilterRCList) &&
this.prevCellList.equals(f.prevCellList); this.prevCellList.equals(f.prevCellList);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(Arrays.hashCode(this.prevFilterRCList.toArray()), return Objects.hash(this.prevFilterRCList, this.prevCellList, this.filters);
Arrays.hashCode(this.prevCellList.toArray()), Arrays.hashCode(this.filters.toArray()));
} }
} }

View File

@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
@ -126,4 +127,14 @@ public class FirstKeyOnlyFilter extends FilterBase {
return true; return true;
} }
@Override
public boolean equals(Object obj) {
return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
}
@Override
public int hashCode() {
return Objects.hashCode(foundKV);
}
} }

View File

@ -137,11 +137,7 @@ public class FirstKeyValueMatchingQualifiersFilter extends FirstKeyOnlyFilter {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FirstKeyValueMatchingQualifiersFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
FirstKeyValueMatchingQualifiersFilter f = (FirstKeyValueMatchingQualifiersFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override

View File

@ -650,15 +650,11 @@ public class FuzzyRowFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof FuzzyRowFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
FuzzyRowFilter f = (FuzzyRowFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(this.fuzzyKeysData.toArray()); return Objects.hash(this.fuzzyKeysData);
} }
} }

View File

@ -20,7 +20,6 @@
package org.apache.hadoop.hbase.filter; package org.apache.hadoop.hbase.filter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.CellComparator;
@ -135,15 +134,11 @@ public class InclusiveStopFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof InclusiveStopFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
InclusiveStopFilter f = (InclusiveStopFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(Bytes.hashCode(this.stopRowKey)); return Bytes.hashCode(this.stopRowKey);
} }
} }

View File

@ -137,11 +137,7 @@ public class KeyOnlyFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof KeyOnlyFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
KeyOnlyFilter f = (KeyOnlyFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override

View File

@ -516,7 +516,7 @@ public class MultiRowRangeFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj){ public boolean equals(Object obj){
if (obj == null || (!(obj instanceof RowRange))) { if (!(obj instanceof RowRange)) {
return false; return false;
} }
if (this == obj) { if (this == obj) {
@ -540,15 +540,11 @@ public class MultiRowRangeFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof MultiRowRangeFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
MultiRowRangeFilter f = (MultiRowRangeFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(this.rangeList.toArray()); return Objects.hash(this.rangeList);
} }
} }

View File

@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.filter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.Objects; import java.util.Objects;
import java.util.TreeSet; import java.util.TreeSet;
@ -212,15 +211,11 @@ public class MultipleColumnPrefixFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof MultipleColumnPrefixFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
MultipleColumnPrefixFilter f = (MultipleColumnPrefixFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(Arrays.hashCode(this.sortedPrefixes.toArray())); return Objects.hash(this.sortedPrefixes);
} }
} }

View File

@ -154,11 +154,7 @@ public class PageFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof PageFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
PageFilter f = (PageFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override

View File

@ -20,7 +20,6 @@
package org.apache.hadoop.hbase.filter; package org.apache.hadoop.hbase.filter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import org.apache.hadoop.hbase.ByteBufferExtendedCell; import org.apache.hadoop.hbase.ByteBufferExtendedCell;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
@ -160,15 +159,11 @@ public class PrefixFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof PrefixFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
PrefixFilter f = (PrefixFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getPrefix())); return Bytes.hashCode(this.getPrefix());
} }
} }

View File

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

View File

@ -158,11 +158,7 @@ public class RandomRowFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof RandomRowFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
RandomRowFilter f = (RandomRowFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override

View File

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

View File

@ -241,4 +241,14 @@ public class SingleColumnValueExcludeFilter extends SingleColumnValueFilter {
return super.areSerializedFieldsEqual(o); return super.areSerializedFieldsEqual(o);
} }
@Override
public boolean equals(Object obj) {
return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
}
@Override
public int hashCode() {
return super.hashCode();
}
} }

View File

@ -464,16 +464,12 @@ public class SingleColumnValueFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(SingleColumnValueFilter.class.isInstance(obj)))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
SingleColumnValueFilter f = (SingleColumnValueFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(Bytes.hashCode(this.getFamily()), Bytes.hashCode(this.getQualifier()), return Objects.hash(Bytes.hashCode(getFamily()), Bytes.hashCode(getQualifier()),
this.op, this.getComparator(), this.getFilterIfMissing(), this.getLatestVersionOnly()); this.op, getComparator(), getFilterIfMissing(), getLatestVersionOnly());
} }
} }

View File

@ -165,11 +165,7 @@ public class SkipFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
SkipFilter f = (SkipFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override

View File

@ -242,15 +242,11 @@ public class TimestampsFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof TimestampsFilter))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
TimestampsFilter f = (TimestampsFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(this.getTimestamps().toArray()); return Objects.hash(getTimestamps());
} }
} }

View File

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

View File

@ -167,11 +167,7 @@ public class WhileMatchFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) { return obj instanceof Filter && areSerializedFieldsEqual((Filter) obj);
return false;
}
WhileMatchFilter f = (WhileMatchFilter) obj;
return this.areSerializedFieldsEqual(f);
} }
@Override @Override

View File

@ -39,4 +39,17 @@ class MobReferenceOnlyFilter extends FilterBase {
} }
return ReturnCode.SKIP; return ReturnCode.SKIP;
} }
@Override
public boolean equals(Object obj) {
if (!(obj instanceof MobReferenceOnlyFilter)) {
return false;
}
return obj == this;
}
@Override
public int hashCode() {
return super.hashCode();
}
} }

View File

@ -177,23 +177,23 @@ class AccessControlFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) { if (!(obj instanceof AccessControlFilter)) {
return false; return false;
} }
if(this == obj){ if (this == obj){
return true; return true;
} }
AccessControlFilter f=(AccessControlFilter)obj; AccessControlFilter f=(AccessControlFilter)obj;
return this.authManager.equals(f.authManager) && return this.authManager.equals(f.authManager) &&
this.table.equals(f.table) && this.table.equals(f.table) &&
this.user.equals(f.user) && this.user.equals(f.user) &&
this.strategy.equals(f.strategy) && this.strategy.equals(f.strategy) &&
this.cfVsMaxVersions.equals(f.cfVsMaxVersions); this.cfVsMaxVersions.equals(f.cfVsMaxVersions);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(this.authManager, this.table, this.strategy, this.user, return Objects.hash(this.authManager, this.table, this.strategy, this.user,
this.cfVsMaxVersions); this.cfVsMaxVersions);
} }
} }

View File

@ -1038,12 +1038,13 @@ public class VisibilityController implements MasterCoprocessor, RegionCoprocesso
deleteCellVisTagsFormat); deleteCellVisTagsFormat);
return matchFound ? ReturnCode.INCLUDE : ReturnCode.SKIP; return matchFound ? ReturnCode.INCLUDE : ReturnCode.SKIP;
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) { if (!(obj instanceof DeleteVersionVisibilityExpressionFilter)) {
return false; return false;
} }
if(this == obj){ if (this == obj){
return true; return true;
} }
DeleteVersionVisibilityExpressionFilter f = (DeleteVersionVisibilityExpressionFilter)obj; DeleteVersionVisibilityExpressionFilter f = (DeleteVersionVisibilityExpressionFilter)obj;

View File

@ -23,7 +23,6 @@ import java.util.Objects;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.PrivateCellUtil; import org.apache.hadoop.hbase.PrivateCellUtil;
import org.apache.hadoop.hbase.filter.FilterBase; import org.apache.hadoop.hbase.filter.FilterBase;
import org.apache.hadoop.hbase.util.ByteRange; import org.apache.hadoop.hbase.util.ByteRange;
@ -91,9 +90,10 @@ class VisibilityLabelFilter extends FilterBase {
this.curFamilyMaxVersions = 0; this.curFamilyMaxVersions = 0;
this.curQualMetVersions = 0; this.curQualMetVersions = 0;
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) { if (!(obj instanceof VisibilityLabelFilter)) {
return false; return false;
} }
if(this == obj){ if(this == obj){
@ -101,7 +101,7 @@ class VisibilityLabelFilter extends FilterBase {
} }
VisibilityLabelFilter f = (VisibilityLabelFilter)obj; VisibilityLabelFilter f = (VisibilityLabelFilter)obj;
return this.expEvaluator.equals(f.expEvaluator) && return this.expEvaluator.equals(f.expEvaluator) &&
this.cfVsMaxVersions.equals(f.cfVsMaxVersions); this.cfVsMaxVersions.equals(f.cfVsMaxVersions);
} }
@Override @Override

View File

@ -59,7 +59,7 @@ public final class ColumnCountOnRowFilter extends FilterBase {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj.getClass() == this.getClass()))) { if (!(obj instanceof ColumnCountOnRowFilter)) {
return false; return false;
} }
if (this == obj) { if (this == obj) {

View File

@ -1027,10 +1027,10 @@ public class TestFilterList {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if(obj == null || !(obj instanceof TransformFilter)){ if(!(obj instanceof TransformFilter)){
return false; return false;
} }
if(obj == this){ if (obj == this) {
return true; return true;
} }
TransformFilter f = (TransformFilter)obj; TransformFilter f = (TransformFilter)obj;

View File

@ -29,7 +29,6 @@ import java.util.Objects;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.exceptions.DeserializationException; import org.apache.hadoop.hbase.exceptions.DeserializationException;
import org.apache.hadoop.hbase.filter.Filter.ReturnCode;
import org.apache.hadoop.hbase.filter.FilterBase; import org.apache.hadoop.hbase.filter.FilterBase;
import org.apache.hadoop.hbase.spark.datasources.BytesEncoder; import org.apache.hadoop.hbase.spark.datasources.BytesEncoder;
import org.apache.hadoop.hbase.spark.datasources.JavaBytesEncoder; import org.apache.hadoop.hbase.spark.datasources.JavaBytesEncoder;
@ -279,7 +278,7 @@ public class SparkSQLPushDownFilter extends FilterBase{
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj == null || (!(obj instanceof SparkSQLPushDownFilter))) { if (!(obj instanceof SparkSQLPushDownFilter)) {
return false; return false;
} }
if (this == obj) { if (this == obj) {
@ -297,8 +296,8 @@ public class SparkSQLPushDownFilter extends FilterBase{
i++; i++;
} }
return this.dynamicLogicExpression.equals(f.dynamicLogicExpression) && return this.dynamicLogicExpression.equals(f.dynamicLogicExpression) &&
this.currentCellToColumnIndexMap.equals(f.currentCellToColumnIndexMap) && this.currentCellToColumnIndexMap.equals(f.currentCellToColumnIndexMap) &&
this.encoderClassName.equals(f.encoderClassName); this.encoderClassName.equals(f.encoderClassName);
} }
@Override @Override