public class HBaseFilterBuilder extends java.lang.Object implements FilterParser.FilterBuilder
FilterParser.FilterBuilder
for HBase.
The class uses the filter parser code to build a filter object,
either simple (single Filter
class) or a compound (FilterList
)
for HBaseAccessor
to use for its scan.
This is done before the scan starts. It is not a scan time operation.
HBase row key column is a special case.
If the user defined row key column as TEXT and used <,>,<=,>=,=
operators
the startkey (>/>=
) and the endkey (</<=
) are stored in addition to
the created filter.
This is an addition on top of regular filters and does not replace
any logic in HBase filter objects.
Constructor and Description |
---|
HBaseFilterBuilder(HBaseTupleDescription tupleDescription) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
build(FilterParser.Operation opId,
java.lang.Object leftOperand,
java.lang.Object rightOperand)
Builds a filter from the input operands and operation.
|
byte[] |
endKey()
Returns the endKey for scanning the HBase table.
|
org.apache.hadoop.hbase.filter.Filter |
getFilterObject(java.lang.String filterString)
Translates a filterString into a HBase
Filter object. |
byte[] |
startKey()
Returns the startKey for scanning the HBase table.
|
public HBaseFilterBuilder(HBaseTupleDescription tupleDescription)
public org.apache.hadoop.hbase.filter.Filter getFilterObject(java.lang.String filterString) throws java.lang.Exception
Filter
object.filterString
- filter stringjava.lang.Exception
- if parsing failedpublic byte[] startKey()
> / >=
operation
on a textual row key column, this value will be returned.
Otherwise, the start of table.public byte[] endKey()
< / <=
operation
on a textual row key column, this value will be returned.
Otherwise, the end of table.public java.lang.Object build(FilterParser.Operation opId, java.lang.Object leftOperand, java.lang.Object rightOperand) throws java.lang.Exception
FilterParser.Constant
and FilterParser.ColumnIndex
.
Supported operations are <, >, <=, <=, >=, =, !=
. Filter
objects.
The only supported operation is AND
.
This function is called by FilterParser
,
each time the parser comes across an operator.
build
in interface FilterParser.FilterBuilder
opId
- the parse operation to performleftOperand
- the left operandrightOperand
- the right operandjava.lang.Exception
- if building the filter failed