org.apache.hadoop.hbase.filter
Class SkipFilter
java.lang.Object
org.apache.hadoop.hbase.filter.FilterBase
org.apache.hadoop.hbase.filter.SkipFilter
- All Implemented Interfaces:
- Filter, org.apache.hadoop.io.Writable
public class SkipFilter
- extends FilterBase
A wrapper filter that filters an entire row if any of the KeyValue checks do
not pass.
For example, if all columns in a row represent weights of different things,
with the values being the actual weights, and we want to filter out the
entire row if any of its weights are zero. In this case, we want to prevent
rows from being emitted if a single key is filtered. Combine this filter
with a ValueFilter
:
scan.setFilter(new SkipFilter(new ValueFilter(CompareOp.EQUAL,
new BinaryComparator(Bytes.toBytes(0))));
Any row which contained a column whose value was 0 will be filtered out.
Without this filter, the other non-zero valued columns in the row would still
be emitted.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SkipFilter
public SkipFilter()
SkipFilter
public SkipFilter(Filter filter)
getFilter
public Filter getFilter()
reset
public void reset()
- Description copied from class:
FilterBase
- Filters that are purely stateless and do nothing in their reset() methods can inherit
this null/empty implementation.
- Specified by:
reset
in interface Filter
- Overrides:
reset
in class FilterBase
filterKeyValue
public Filter.ReturnCode filterKeyValue(KeyValue v)
- Description copied from class:
FilterBase
- Filters that dont filter by key value can inherit this implementation that
includes all KeyValues.
- Specified by:
filterKeyValue
in interface Filter
- Overrides:
filterKeyValue
in class FilterBase
- Parameters:
v
- the KeyValue in question
- Returns:
- code as described below
- See Also:
Filter.ReturnCode
filterRow
public boolean filterRow()
- Description copied from class:
FilterBase
- Filters that never filter by rows based on previously gathered state from
FilterBase.filterKeyValue(KeyValue)
can inherit this implementation that
never filters a row.
- Specified by:
filterRow
in interface Filter
- Overrides:
filterRow
in class FilterBase
- Returns:
- true to exclude row, false to include row.
write
public void write(DataOutput out)
throws IOException
- Throws:
IOException
readFields
public void readFields(DataInput in)
throws IOException
- Throws:
IOException
Copyright © 2011 The Apache Software Foundation. All Rights Reserved.