com.google.cloud.bigtable.hbase.adapters.filters
Class SingleColumnValueFilterAdapter
- java.lang.Object
-
- com.google.cloud.bigtable.hbase.adapters.filters.TypedFilterAdapterBase<SingleColumnValueFilter>
-
- com.google.cloud.bigtable.hbase.adapters.filters.SingleColumnValueFilterAdapter
-
- All Implemented Interfaces:
- TypedFilterAdapter<SingleColumnValueFilter>
public class SingleColumnValueFilterAdapter extends TypedFilterAdapterBase<SingleColumnValueFilter>
Adapt SingleColumnValueFilter instances into bigtable RowFilters.- Version:
- $Id: $Id
- Author:
- sduskis
-
-
Constructor Summary
Constructors Constructor and Description SingleColumnValueFilterAdapter(ValueFilterAdapter delegateAdapter)
Constructor for SingleColumnValueFilterAdapter.
-
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, SingleColumnValueFilter filter)
SingleColumnValueFilter
is a filter that will return a row if a family/qualifier value matches some condition.FilterSupportStatus
isFilterSupported(FilterAdapterContext context, SingleColumnValueFilter 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
-
SingleColumnValueFilterAdapter
public SingleColumnValueFilterAdapter(ValueFilterAdapter delegateAdapter)
Constructor for SingleColumnValueFilterAdapter.- Parameters:
delegateAdapter
- aValueFilterAdapter
object.
-
-
Method Detail
-
adapt
public com.google.cloud.bigtable.data.v2.models.Filters.Filter adapt(FilterAdapterContext context, SingleColumnValueFilter filter) throws IOException
SingleColumnValueFilter
is a filter that will return a row if a family/qualifier value matches some condition. Optionally, ifSingleColumnValueFilter.getFilterIfMissing()
is set to false, then also return the row if the family/column is not present on the row. There's aHere's a rough translation of
SingleColumnValueFilter.getFilterIfMissing()
== true. Here's a rough translation ofIF a single family/column exists AND the value of the family/column meets some condition THEN return the ROW END
SingleColumnValueFilter.getFilterIfMissing()
== false. The Cloud Bigtable filter translation for theIF a single family/column exists THEN IF the value of the family/column meets some condition THEN return the ROW END ELSE IF filter.filter_if_missing == false THEN return the ROW END
SingleColumnValueFilter.getFilterIfMissing()
true case here's the resulting filter is as follows: In addition to the default filter, there's a bit more ifcondition: { predicate: { chain: { family: [filter.family] qualifier: [filter.qualifier], // if filter.latestOnly, then add // cells_per_column: 1 value: // something interesting } } true_filter: { pass_all: true } }
SingleColumnValueFilter.getFilterIfMissing()
is false. Here's what the filter would look like:interleave: [ // either { // If the family/qualifier exists and matches a value // Then return the row // Else return nothing condition: { predicate: { chain: { family: [filter.family] qualifier: [filter.qualifier], // if filter.latestOnly, then add // cells_per_column: 1 value: // something interesting } }, true_filter: { pass_all: true } } }, { // If the family/qualifer exists // Then return nothing // Else return row condition: { predicate: { chain: { family: [filter.family] qualifier: [filter.qualifier], } }, false_filter: { pass_all: true } } } ]
NOTE: This logic can also be expressed as nested predicates, but that approach creates really poor performance on the server side.
- Parameters:
context
- aFilterAdapterContext
object.filter
- a S object.- Returns:
- a
Filters.Filter
object. - Throws:
IOException
- if any.
-
isFilterSupported
public FilterSupportStatus isFilterSupported(FilterAdapterContext context, SingleColumnValueFilter 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.
-
-