public final class Filters
A Fluent DSL to create a hierarchy of filters for the CheckAndMutateRow RPCs and ReadRows Query.
Intended usage is to statically import, or in case of conflict, assign the static variable FILTERS and use its fluent API to build filters.
Sample code:
import static com.google.cloud.bigtable.data.v2.models.Filters.FILTERS;
void main() {
// Build the filter expression
RowFilter filter = FILTERS.chain()
.filter(FILTERS.qualifier().regex("prefix.*"))
.filter(FILTERS.limit().cellsPerRow(10));
// Use it in a Query
Query query = Query.create("[TABLE]")
.filter(filter);
}
Static Fields
FILTERS
public static final Filters FILTERS
Entry point into the DSL.
Field Value | |
---|---|
Type | Description |
Filters |
Methods
block()
public Filters.Filter block()
Does not match any cells, regardless of input. Useful for temporarily disabling just part of a filter.
Returns | |
---|---|
Type | Description |
Filters.Filter |
chain()
public Filters.ChainFilter chain()
Creates an empty chain filter list. Filters can be added to the chain by invoking ChainFilter#filter(Filters.Filter).
The elements of "filters" are chained together to process the input row:
in row -> filter0 -> intermediate row -> filter1 -> ... -> filterN -> out row
The full chain is executed atomically.
Returns | |
---|---|
Type | Description |
Filters.ChainFilter |
condition(Filters.Filter predicate)
public Filters.ConditionFilter condition(Filters.Filter predicate)
Creates an empty condition filter. The filter results of the predicate can be configured by invoking ConditionFilter#then(Filters.Filter) and ConditionFilter#otherwise(Filters.Filter).
A RowFilter which evaluates one of two possible RowFilters, depending on whether or not a predicate RowFilter outputs any cells from the input row.
IMPORTANT NOTE: The predicate filter does not execute atomically with the ConditionFilter#then(Filters.Filter) and ConditionFilter#otherwise(Filters.Filter) (Filter)} filters, which may lead to inconsistent or unexpected results. Additionally, ConditionFilter may have poor performance, especially when filters are set for the ConditionFilter#otherwise(Filters.Filter).
Parameter | |
---|---|
Name | Description |
predicate | Filters.Filter |
Returns | |
---|---|
Type | Description |
Filters.ConditionFilter |
family()
public Filters.FamilyFilter family()
Returns the builder for column family related filters.
Returns | |
---|---|
Type | Description |
Filters.FamilyFilter |
fromProto(RowFilter rowFilter)
public Filters.Filter fromProto(RowFilter rowFilter)
Wraps protobuf representation of a filter.
For advanced use only.
Parameter | |
---|---|
Name | Description |
rowFilter | com.google.bigtable.v2.RowFilter |
Returns | |
---|---|
Type | Description |
Filters.Filter |
interleave()
public Filters.InterleaveFilter interleave()
Creates an empty interleave filter list. Filters can be added to the interleave by invoking InterleaveFilter#filter(Filters.Filter).
The elements of "filters" all process a copy of the input row, and the results are pooled, sorted, and combined into a single output row. If multiple cells are produced with the same column and timestamp, they will all appear in the output row in an unspecified mutual order. The full chain is executed atomically.
Returns | |
---|---|
Type | Description |
Filters.InterleaveFilter |
key()
public Filters.KeyFilter key()
Returns the builder for row key related filters.
Returns | |
---|---|
Type | Description |
Filters.KeyFilter |
label(String label)
public Filters.Filter label(String label)
Applies the given label to all cells in the output row. This allows the caller to determine which results were produced from which part of the filter.
Due to a technical limitation, it is not currently possible to apply multiple labels to a cell. As a result, a ChainFilter may have no more than one sub-filter which contains a label. It is okay for an InterleaveFilter to contain multiple labels, as they will be applied to separate copies of the input. This may be relaxed in the future.
Parameter | |
---|---|
Name | Description |
label | String |
Returns | |
---|---|
Type | Description |
Filters.Filter |
limit()
public Filters.LimitFilter limit()
Returns the builder for limit related filters.
Returns | |
---|---|
Type | Description |
Filters.LimitFilter |
offset()
public Filters.OffsetFilter offset()
Returns the builder for offset related filters.
Returns | |
---|---|
Type | Description |
Filters.OffsetFilter |
pass()
public Filters.Filter pass()
Matches all cells, regardless of input. Functionally equivalent to having no filter.
Returns | |
---|---|
Type | Description |
Filters.Filter |
qualifier()
public Filters.QualifierFilter qualifier()
Returns the builder for column qualifier related filters.
Returns | |
---|---|
Type | Description |
Filters.QualifierFilter |
sink()
public Filters.Filter sink()
Outputs all cells directly to the output of the read rather than to any parent filter. For advanced usage, see comments in https://github.com/googleapis/googleapis/blob/master/google/bigtable/v2/data.proto for more details.
Returns | |
---|---|
Type | Description |
Filters.Filter |
timestamp()
public Filters.TimestampFilter timestamp()
Returns the builder for timestamp related filters.
Returns | |
---|---|
Type | Description |
Filters.TimestampFilter |
value()
public Filters.ValueFilter value()
Returns the builder for value related filters.
Returns | |
---|---|
Type | Description |
Filters.ValueFilter |