Package org.apache.hadoop.hbase.filter
Class TimestampsFilter
java.lang.Object
org.apache.hadoop.hbase.filter.Filter
org.apache.hadoop.hbase.filter.FilterBase
org.apache.hadoop.hbase.filter.TimestampsFilter
- All Implemented Interfaces:
HintingFilter
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
Modifier and TypeFieldDescriptionprivate final boolean
private static final int
(package private) long
-
Constructor Summary
ConstructorDescriptionTimestampsFilter
(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
Modifier and TypeMethodDescription(package private) boolean
Returns true if and only if the fields of the filter that are serialized are equal to the corresponding fields in other.static Filter
createFilterFromArguments
(ArrayList<byte[]> filterArguments) boolean
filterCell
(Cell c) A way to filter based on the column family, column qualifier and/or the column value.boolean
filterRowKey
(Cell cell) Filters a row based on the row key.long
getMin()
Gets the minimum timestamp requested by filter.getNextCellHint
(Cell currentCell) Pick the next cell that the scanner should seek to.Returns the list of timestampsint
hashCode()
private void
init()
static TimestampsFilter
parseFrom
(byte[] pbBytes) Parse a serialized representation ofTimestampsFilter
byte[]
Returns The filter serialized using pbtoString()
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, filterRowCells, hasFilterRow, isFamilyEssential, reset, transformCell
Methods inherited from class org.apache.hadoop.hbase.filter.Filter
isReversed, setReversed
-
Field Details
-
canHint
-
timestamps
-
MAX_LOG_TIMESTAMPS
- See Also:
-
minTimestamp
long minTimestamp
-
-
Constructor Details
-
TimestampsFilter
Constructor for filter that retains only the specified timestamps in the list. -
TimestampsFilter
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 Details
-
getTimestamps
Returns the list of timestamps -
init
-
getMin
Gets the minimum timestamp requested by filter.- Returns:
- minimum timestamp requested by filter.
-
filterRowKey
Description copied from class:Filter
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 toFilter.filterCell(Cell)
below. IfFilter.filterAllRemaining()
returns true, thenFilter.filterRowKey(Cell)
should also return true. Concrete implementers can signal a failure condition in their code by throwing anIOException
.- Overrides:
filterRowKey
in classFilterBase
- Parameters:
cell
- The first cell coming in the new row- Returns:
- 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.
-
filterCell
Description copied from class:Filter
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, filterCell needs to be consistent with it. filterCell can assume that filterRowKey has already been called for the row. If your filter returnsReturnCode.NEXT_ROW
, it should returnReturnCode.NEXT_ROW
untilFilter.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 anIOException
.- Overrides:
filterCell
in classFilter
- Parameters:
c
- the Cell in question- Returns:
- code as described below
- See Also:
-
getNextCellHint
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 classFilterBase
- 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
-
toByteArray
Returns The filter serialized using pb- Overrides:
toByteArray
in classFilterBase
- Returns:
- The filter serialized using pb
-
parseFrom
Parse a serialized representation ofTimestampsFilter
- Parameters:
pbBytes
- A pb serializedTimestampsFilter
instance- Returns:
- An instance of
TimestampsFilter
made frombytes
- Throws:
DeserializationException
- if an error occurred- See Also:
-
areSerializedFieldsEqual
Returns true if and only if the fields of the filter that are serialized are equal to the corresponding fields in other. Used for testing.- Overrides:
areSerializedFieldsEqual
in classFilterBase
- Returns:
- true if and only if the fields of the filter that are serialized are equal to the corresponding fields in other. Used for testing.
-
toString
Description copied from class:FilterBase
Return filter's info for debugging and logging purpose.- Overrides:
toString
in classFilterBase
-
toString
-
equals
-
hashCode
-