org.apache.hadoop.hbase.filter
Class TimestampsFilter

java.lang.Object
  extended by org.apache.hadoop.hbase.filter.Filter
      extended by org.apache.hadoop.hbase.filter.FilterBase
          extended by org.apache.hadoop.hbase.filter.TimestampsFilter

@InterfaceAudience.Public
@InterfaceStability.Stable
public class TimestampsFilter
extends org.apache.hadoop.hbase.filter.FilterBase

Filter that returns only cells whose timestamp (version) is in the specified list of timestamps (versions).

Note: Use of this filter overrides any time range/time stamp options specified using Get.setTimeRange(long, long), Scan.setTimeRange(long, long), Get.setTimeStamp(long), or Scan.setTimeStamp(long).


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hbase.filter.Filter
Filter.ReturnCode
 
Field Summary
 
Fields inherited from class org.apache.hadoop.hbase.filter.Filter
reversed
 
Constructor Summary
TimestampsFilter(List<Long> timestamps)
          Constructor for filter that retains only the specified timestamps in the list.
TimestampsFilter(List<Long> timestamps, boolean canHint)
          Constructor for filter that retains only those cells whose timestamp (version) is in the specified list of timestamps.
 
Method Summary
static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments)
           
 Filter.ReturnCode filterKeyValue(Cell v)
          Filters that dont filter by key value can inherit this implementation that includes all Cells.
 long getMin()
          Gets the minimum timestamp requested by filter.
 Cell getNextCellHint(Cell currentCell)
          Pick the next cell that the scanner should seek to.
 List<Long> getTimestamps()
           
static TimestampsFilter parseFrom(byte[] pbBytes)
           
 byte[] toByteArray()
          Return length 0 byte array for Filters that don't require special serialization
 String toString()
          Return filter's info for debugging and logging purpose.
protected  String toString(int maxTimestamps)
           
 
Methods inherited from class org.apache.hadoop.hbase.filter.FilterBase
filterAllRemaining, filterRow, filterRow, filterRowCells, filterRowKey, getNextKeyHint, hasFilterRow, isFamilyEssential, reset, transform, transformCell
 
Methods inherited from class org.apache.hadoop.hbase.filter.Filter
isReversed, setReversed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimestampsFilter

public TimestampsFilter(List<Long> timestamps)
Constructor for filter that retains only the specified timestamps in the list.

Parameters:
timestamps -

TimestampsFilter

public TimestampsFilter(List<Long> timestamps,
                        boolean canHint)
Constructor for filter that retains only those cells whose timestamp (version) is in the specified list of timestamps.

Parameters:
timestamps - list of timestamps that are wanted.
canHint - should the filter provide a seek hint? This can skip past delete tombstones, so it should only be used when that is not an issue ( no deletes, or don't care if data becomes visible)
Method Detail

getTimestamps

public List<Long> getTimestamps()
Returns:
the list of timestamps

getMin

public long getMin()
Gets the minimum timestamp requested by filter.

Returns:
minimum timestamp requested by filter.

filterKeyValue

public Filter.ReturnCode filterKeyValue(Cell v)
Description copied from class: org.apache.hadoop.hbase.filter.FilterBase
Filters that dont filter by key value can inherit this implementation that includes all Cells.

Overrides:
filterKeyValue in class org.apache.hadoop.hbase.filter.FilterBase
Parameters:
v - the Cell in question
Returns:
code as described below
See Also:
Filter.ReturnCode

getNextCellHint

public Cell getNextCellHint(Cell currentCell)
                     throws IOException
Pick the next cell that the scanner should seek to. Since this can skip any number of cells any of which can be a delete this can resurect old data. The method will only be used if canHint was set to true while creating the filter.

Overrides:
getNextCellHint in class org.apache.hadoop.hbase.filter.FilterBase
Returns:
KeyValue which must be next seeked. return null if the filter is not sure which key to seek to next.
Throws:
IOException - This will never happen.

createFilterFromArguments

public static Filter createFilterFromArguments(ArrayList<byte[]> filterArguments)

toByteArray

public byte[] toByteArray()
Description copied from class: org.apache.hadoop.hbase.filter.FilterBase
Return length 0 byte array for Filters that don't require special serialization

Overrides:
toByteArray in class org.apache.hadoop.hbase.filter.FilterBase
Returns:
The filter serialized using pb

parseFrom

public static TimestampsFilter parseFrom(byte[] pbBytes)
                                  throws org.apache.hadoop.hbase.exceptions.DeserializationException
Parameters:
pbBytes - A pb serialized TimestampsFilter instance
Returns:
An instance of TimestampsFilter made from bytes
Throws:
org.apache.hadoop.hbase.exceptions.DeserializationException
See Also:
toByteArray()

toString

public String toString()
Description copied from class: org.apache.hadoop.hbase.filter.FilterBase
Return filter's info for debugging and logging purpose.

Overrides:
toString in class org.apache.hadoop.hbase.filter.FilterBase

toString

protected String toString(int maxTimestamps)


Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.