HBASE-22262 Removed deprecated methods from Filter class

This commit is contained in:
Jan Hentschel 2019-04-17 20:25:07 +02:00
parent e8ef8ad42f
commit f62028593f
33 changed files with 10 additions and 291 deletions

View File

@ -63,12 +63,6 @@ public class ColumnCountGetFilter extends FilterBase {
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++;

View File

@ -111,12 +111,6 @@ public class ColumnPaginationFilter extends FilterBase {
return false;
}
@Override
@Deprecated
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c)
{

View File

@ -58,12 +58,6 @@ public class ColumnPrefixFilter extends FilterBase {
return false;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell cell) {
if (this.prefix == null) {

View File

@ -122,12 +122,6 @@ public class ColumnRangeFilter extends FilterBase {
return false;
}
@Override
@Deprecated
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) {
int cmpMin = 1;

View File

@ -133,12 +133,6 @@ public class DependentColumnFilter extends CompareFilter {
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
@ -173,10 +167,6 @@ public class DependentColumnFilter extends CompareFilter {
return false;
}
@Override
public boolean filterRowKey(byte[] buffer, int offset, int length) {
return false;
}
@Override
public void reset() {
stampSet.clear();

View File

@ -56,12 +56,6 @@ public class FamilyFilter extends CompareFilter {
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();

View File

@ -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.
@ -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
@ -157,8 +111,8 @@ public abstract class Filter {
* @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;
}
/**

View File

@ -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();
}
/**

View File

@ -146,11 +146,6 @@ final public class FilterList extends FilterBase {
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);
@ -166,12 +161,6 @@ final public class FilterList extends FilterBase {
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);

View File

@ -112,11 +112,6 @@ public abstract class FilterListBase extends FilterBase {
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}

View File

@ -199,21 +199,6 @@ public class FilterListWithAND extends FilterListBase {
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()) {

View File

@ -307,21 +307,6 @@ public class FilterListWithOR extends FilterListBase {
}
}
@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()) {

View File

@ -53,12 +53,6 @@ public class FirstKeyOnlyFilter extends FilterBase {
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;

View File

@ -61,12 +61,6 @@ public class FirstKeyValueMatchingQualifiersFilter extends FirstKeyOnlyFilter {
this.qualifiers = qualifiers;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) {
if (hasFoundKV()) {

View File

@ -147,12 +147,6 @@ public class FuzzyRowFilter extends FilterBase {
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;

View File

@ -51,12 +51,6 @@ public class InclusiveStopFilter extends FilterBase {
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;

View File

@ -74,12 +74,6 @@ public class KeyOnlyFilter extends FilterBase {
}
}
@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;

View File

@ -137,12 +137,6 @@ public class MultiRowRangeFilter extends FilterBase {
return false;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell ignored) {
return filterCell(ignored);
}
@Override
public ReturnCode filterCell(final Cell ignored) {
return currentReturnCode;

View File

@ -68,12 +68,6 @@ public class MultipleColumnPrefixFilter extends FilterBase {
return false;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) {
if (sortedPrefixes.isEmpty()) {

View File

@ -67,12 +67,6 @@ public class PageFilter extends FilterBase {
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;

View File

@ -76,12 +76,6 @@ public class PrefixFilter extends FilterBase {
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;

View File

@ -55,12 +55,6 @@ public class QualifierFilter extends CompareFilter {
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)) {

View File

@ -70,12 +70,6 @@ public class RandomRowFilter extends FilterBase {
return false;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) {
if (filterOutRow) {

View File

@ -61,12 +61,6 @@ public class RowFilter extends CompareFilter {
this.filterOutRow = false;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell v) {
if(this.filterOutRow) {

View File

@ -178,12 +178,6 @@ public class SingleColumnValueFilter extends FilterBase {
return false;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) {
// System.out.println("REMOVE KEY=" + keyValue.toString() + ", value=" + Bytes.toString(keyValue.getValue()));

View File

@ -79,12 +79,6 @@ public class SkipFilter extends FilterBase {
return false;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) throws IOException {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) throws IOException {
ReturnCode rc = filter.filterCell(c);

View File

@ -110,12 +110,6 @@ public class TimestampsFilter extends FilterBase {
return false;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) {
if (this.timestamps.contains(c.getTimestamp())) {

View File

@ -54,12 +54,6 @@ public class ValueFilter extends CompareFilter {
super(valueCompareOp, valueComparator);
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) {
if (compareValue(getCompareOperator(), this.comparator, c)) {

View File

@ -31,7 +31,7 @@ import org.apache.hbase.thirdparty.com.google.protobuf.InvalidProtocolBufferExce
/**
* A wrapper filter that returns true from {@link #filterAllRemaining()} as soon
* as the wrapped filters {@link Filter#filterRowKey(byte[], int, int)},
* as the wrapped filters {@link Filter#filterRowKey(Cell)},
* {@link Filter#filterCell(org.apache.hadoop.hbase.Cell)},
* {@link org.apache.hadoop.hbase.filter.Filter#filterRow()} or
* {@link org.apache.hadoop.hbase.filter.Filter#filterAllRemaining()} methods
@ -64,13 +64,6 @@ public class WhileMatchFilter extends FilterBase {
return this.filterAllRemaining || this.filter.filterAllRemaining();
}
@Override
public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException {
boolean value = filter.filterRowKey(buffer, offset, length);
changeFAR(value);
return value;
}
@Override
public boolean filterRowKey(Cell cell) throws IOException {
if (filterAllRemaining()) return true;
@ -79,12 +72,6 @@ public class WhileMatchFilter extends FilterBase {
return value;
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) throws IOException {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) throws IOException {
ReturnCode code = filter.filterCell(c);

View File

@ -48,6 +48,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.stream.XMLStreamException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HColumnDescriptor;
@ -649,8 +650,9 @@ public class TestTableScan {
}
@Override
public boolean filterRowKey(byte[] buffer, int offset, int length) {
int cmp = Bytes.compareTo(buffer, offset, length, this.key, 0, this.key.length);
public boolean filterRowKey(Cell cell) {
int cmp = Bytes.compareTo(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(),
this.key, 0, this.key.length);
return cmp != 0;
}

View File

@ -100,25 +100,12 @@ final public class FilterWrapper extends Filter {
return this.filter.getNextCellHint(currentCell);
}
@Override
public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException {
// No call to this.
if (filterAllRemaining()) return true;
return this.filter.filterRowKey(buffer, offset, length);
}
@Override
public boolean filterRowKey(Cell cell) throws IOException {
if (filterAllRemaining()) return true;
return this.filter.filterRowKey(cell);
}
@Deprecated
@Override
public ReturnCode filterKeyValue(final Cell c) throws IOException {
return filterCell(c);
}
@Override
public ReturnCode filterCell(final Cell c) throws IOException {
return this.filter.filterCell(c);

View File

@ -502,18 +502,6 @@ public class TestConnectionImplementation {
protected static final AtomicBoolean syncBlockingFilter = new AtomicBoolean(false);
public static class BlockingFilter extends FilterBase {
@Override
public boolean filterRowKey(byte[] buffer, int offset, int length) throws IOException {
int i = 0;
while (i++ < 1000 && !syncBlockingFilter.get()) {
synchronized (syncBlockingFilter) {
syncBlockingFilter.notifyAll();
}
Threads.sleep(100);
}
syncBlockingFilter.set(true);
return false;
}
@Override
public ReturnCode filterCell(final Cell ignored) throws IOException {
return ReturnCode.INCLUDE;

View File

@ -248,9 +248,8 @@ public class TestUserScanQueryMatcher extends AbstractTestScanQueryMatcher {
}
private static class AlwaysIncludeAndSeekNextRowFilter extends FilterBase {
@Override
public ReturnCode filterKeyValue(final Cell c) throws IOException {
public ReturnCode filterCell(final Cell c) {
return ReturnCode.INCLUDE_AND_SEEK_NEXT_ROW;
}
}
@ -294,7 +293,7 @@ public class TestUserScanQueryMatcher extends AbstractTestScanQueryMatcher {
private static class AlwaysIncludeFilter extends FilterBase {
@Override
public ReturnCode filterKeyValue(final Cell c) throws IOException {
public ReturnCode filterCell(final Cell c) {
return ReturnCode.INCLUDE;
}
}