Skip to content

Commit

Permalink
HBASE-22262 Removed deprecated methods from Filter class
Browse files Browse the repository at this point in the history
  • Loading branch information
HorizonNet committed Apr 19, 2019
1 parent 268bcce commit 3099312
Show file tree
Hide file tree
Showing 33 changed files with 10 additions and 291 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ public boolean filterAllRemaining() {
return this.count > this.limit;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
this.count++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ public boolean filterRowKey(Cell cell) throws IOException {
return false;
}

@Override
@Deprecated
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,6 @@ public boolean filterRowKey(Cell cell) throws IOException {
return false;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell cell) {
if (this.prefix == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ public boolean filterRowKey(Cell cell) throws IOException {
return false;
}

@Override
@Deprecated
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
int cmpMin = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ public boolean filterAllRemaining() {
return false;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
// Check if the column and qualifier match
Expand Down Expand Up @@ -196,10 +190,6 @@ public boolean filterRow() {
return false;
}

@Override
public boolean filterRowKey(byte[] buffer, int offset, int length) {
return false;
}
@Override
public void reset() {
stampSet.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ public FamilyFilter(final CompareOperator op,
super(op, familyComparator);
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
int familyLength = c.getFamilyLength();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,6 @@ public abstract class Filter {
*/
abstract public void reset() throws IOException;

/**
* Filters a row based on the row key. If this returns true, the entire row will be excluded. If
* false, each KeyValue in the row will be passed to {@link #filterCell(Cell)} below.
*
* Concrete implementers can signal a failure condition in their code by throwing an
* {@link IOException}.
*
* @param buffer buffer containing row key
* @param offset offset into buffer where row key starts
* @param length length of the row key
* @return true, remove entire row, false, include the row (maybe).
* @throws IOException in case an I/O or an filter specific failure needs to be signaled.
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
* Instead use {@link #filterRowKey(Cell)}
*/
@Deprecated
abstract public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException;

/**
* Filters a row based on the row key. If this returns true, the entire row will be excluded. If
* false, each KeyValue in the row will be passed to {@link #filterCell(Cell)} below.
Expand All @@ -108,34 +90,6 @@ public abstract class Filter {
*/
abstract public boolean filterAllRemaining() throws IOException;

/**
* A way to filter based on the column family, column qualifier and/or the column value. Return
* code is described below. This allows filters to filter only certain number of columns, then
* terminate without matching ever column.
*
* If filterRowKey returns true, filterKeyValue needs to be consistent with it.
*
* filterKeyValue can assume that filterRowKey has already been called for the row.
*
* If your filter returns <code>ReturnCode.NEXT_ROW</code>, it should return
* <code>ReturnCode.NEXT_ROW</code> until {@link #reset()} is called just in case the caller calls
* for the next row.
*
* Concrete implementers can signal a failure condition in their code by throwing an
* {@link IOException}.
*
* @param c the Cell in question
* @return code as described below, Filter.ReturnCode.INCLUDE by default
* @throws IOException in case an I/O or an filter specific failure needs to be signaled.
* @see Filter.ReturnCode
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
* Instead use filterCell(Cell)
*/
@Deprecated
public ReturnCode filterKeyValue(final Cell c) throws IOException {
return Filter.ReturnCode.INCLUDE;
}

/**
* A way to filter based on the column family, column qualifier and/or the column value. Return
* code is described below. This allows filters to filter only certain number of columns, then
Expand All @@ -157,8 +111,8 @@ public ReturnCode filterKeyValue(final Cell c) throws IOException {
* @throws IOException in case an I/O or an filter specific failure needs to be signaled.
* @see Filter.ReturnCode
*/
public ReturnCode filterCell(final Cell c) throws IOException{
return filterKeyValue(c);
public ReturnCode filterCell(final Cell c) throws IOException {
return ReturnCode.INCLUDE;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,9 @@ public abstract class FilterBase extends Filter {
public void reset() throws IOException {
}

/**
* Filters that do not filter by row key can inherit this implementation that
* never filters anything. (ie: returns false).
*
* {@inheritDoc}
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
* Instead use {@link #filterRowKey(Cell)}
*/
@Override
@Deprecated
public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException {
if (filterAllRemaining()) return true;
return false;
}

@Override
public boolean filterRowKey(Cell cell) throws IOException {
if (filterAllRemaining()) return true;
return filterRowKey(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
return filterAllRemaining();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ public void reset() throws IOException {
filterListBase.reset();
}

@Override
public boolean filterRowKey(byte[] rowKey, int offset, int length) throws IOException {
return filterListBase.filterRowKey(rowKey, offset, length);
}

@Override
public boolean filterRowKey(Cell firstRowCell) throws IOException {
return filterListBase.filterRowKey(firstRowCell);
Expand All @@ -166,12 +161,6 @@ public Cell transformCell(Cell c) throws IOException {
return filterListBase.transformCell(c);
}

@Override
@Deprecated
public ReturnCode filterKeyValue(final Cell c) throws IOException {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) throws IOException {
return filterListBase.filterCell(c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,6 @@ public Cell transformCell(Cell c) throws IOException {
return transformed;
}

@Override
public ReturnCode filterKeyValue(final Cell c) throws IOException {
return filterCell(c);
}

/**
* Filters that never filter by modifying the returned List of Cells can inherit this
* implementation that does nothing. {@inheritDoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,21 +199,6 @@ public void reset() throws IOException {
seekHintFilters.clear();
}

@Override
public boolean filterRowKey(byte[] rowKey, int offset, int length) throws IOException {
if (isEmpty()) {
return super.filterRowKey(rowKey, offset, length);
}
boolean retVal = false;
for (int i = 0, n = filters.size(); i < n; i++) {
Filter filter = filters.get(i);
if (filter.filterAllRemaining() || filter.filterRowKey(rowKey, offset, length)) {
retVal = true;
}
}
return retVal;
}

@Override
public boolean filterRowKey(Cell firstRowCell) throws IOException {
if (isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,21 +307,6 @@ public void reset() throws IOException {
}
}

@Override
public boolean filterRowKey(byte[] rowKey, int offset, int length) throws IOException {
if (isEmpty()) {
return super.filterRowKey(rowKey, offset, length);
}
boolean retVal = true;
for (int i = 0, n = filters.size(); i < n; i++) {
Filter filter = filters.get(i);
if (!filter.filterAllRemaining() && !filter.filterRowKey(rowKey, offset, length)) {
retVal = false;
}
}
return retVal;
}

@Override
public boolean filterRowKey(Cell firstRowCell) throws IOException {
if (isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ public boolean filterRowKey(Cell cell) throws IOException {
return false;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
if(foundKV) return ReturnCode.NEXT_ROW;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@ public FirstKeyValueMatchingQualifiersFilter(Set<byte []> qualifiers) {
this.qualifiers = qualifiers;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
if (hasFoundKV()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@ private boolean isPreprocessedMask(byte[] mask) {
return true;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
final int startIndex = lastFoundIndex >= 0 ? lastFoundIndex : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,6 @@ public byte[] getStopRowKey() {
return this.stopRowKey;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
if (done) return ReturnCode.NEXT_ROW;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ private Cell createKeyOnlyCell(Cell c) {
}
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell ignored) throws IOException {
return filterCell(ignored);
}

@Override
public ReturnCode filterCell(final Cell ignored) throws IOException {
return ReturnCode.INCLUDE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@ public boolean filterRowKey(Cell firstRowCell) {
return false;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell ignored) {
return filterCell(ignored);
}

@Override
public ReturnCode filterCell(final Cell ignored) {
return currentReturnCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,6 @@ public boolean filterRowKey(Cell cell) throws IOException {
return false;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
if (sortedPrefixes.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ public boolean filterRowKey(Cell cell) throws IOException {
return false;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) throws IOException {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell ignored) throws IOException {
return ReturnCode.INCLUDE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ public boolean filterRowKey(Cell firstRowCell) {
return filterRow;
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
if (filterRow) return ReturnCode.NEXT_ROW;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ public QualifierFilter(final CompareOperator op,
super(op, qualifierComparator);
}

@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}

@Override
public ReturnCode filterCell(final Cell c) {
if (compareQualifier(getCompareOperator(), this.comparator, c)) {
Expand Down
Loading

0 comments on commit 3099312

Please sign in to comment.