Class WhileMatchFilterAdapter
- java.lang.Object
-
- com.google.cloud.bigtable.hbase.adapters.filters.TypedFilterAdapterBase<WhileMatchFilter>
-
- com.google.cloud.bigtable.hbase.adapters.filters.WhileMatchFilterAdapter
-
- All Implemented Interfaces:
- TypedFilterAdapter<WhileMatchFilter>
public class WhileMatchFilterAdapter extends TypedFilterAdapterBase<WhileMatchFilter>
Adapter forWhileMatchFilter
.- Version:
- $Id: $Id
- Author:
- sduskis
-
-
Constructor Summary
Constructors Constructor and Description WhileMatchFilterAdapter(FilterAdapter subFilterAdapter)
Constructor for WhileMatchFilterAdapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description com.google.cloud.bigtable.data.v2.models.Filters.Filter
adapt(FilterAdapterContext context, WhileMatchFilter filter)
Adapt the given filter.FilterSupportStatus
isFilterSupported(FilterAdapterContext context, WhileMatchFilter filter)
Determine if the given filter can be adapted to a Bigtable RowFilter.-
Methods inherited from class com.google.cloud.bigtable.hbase.adapters.filters.TypedFilterAdapterBase
getIndexScanHint
-
-
-
-
Constructor Detail
-
WhileMatchFilterAdapter
public WhileMatchFilterAdapter(FilterAdapter subFilterAdapter)
Constructor for WhileMatchFilterAdapter.- Parameters:
subFilterAdapter
- aFilterAdapter
object.
-
-
Method Detail
-
adapt
public com.google.cloud.bigtable.data.v2.models.Filters.Filter adapt(FilterAdapterContext context, WhileMatchFilter filter) throws IOException
Adapt the given filter. Implementers of this method should assume that isFilterSupported has already been called with a result indicating it is in fact supproted.Adapt
WhileMatchFilter
as follow:| V +--------+--------+ | | | | label('id-in') wrappedFilter.filter() | | | | sink() +-----+-----+ + | | label('id-out') all() | | sink() | + v
The above implementation gives enough information from the server side to determine whether the remaining rows should be filtered out. For each
WhileMatchFilter
instance, an unique ID is generated for labeling. The input label is the unique ID suffixed by "-in" and the output label is the unique ID suffixed by "-out". WhenwrappedFilter
decides to filter out the rest of rows, there is no out label ("id-out") applied in the output. In other words, when there is a missing "id-out" for an input "id-in",WhileMatchFilter.filterAllRemaining()
returnstrue
. Since the server continues to send result even thoughWhileMatchFilter.filterAllRemaining()
returnstrue
, we need to replace thisWhileMatchFilter
instance with a "block all" filter and rescan from the next row.- Parameters:
context
- aFilterAdapterContext
object.filter
- a S object.- Returns:
- a
Filters.Filter
object. - Throws:
IOException
- if any.
-
isFilterSupported
public FilterSupportStatus isFilterSupported(FilterAdapterContext context, WhileMatchFilter filter)
Determine if the given filter can be adapted to a Bigtable RowFilter.- Parameters:
context
- aFilterAdapterContext
object.filter
- a S object.- Returns:
- a
FilterSupportStatus
object.
-
-