@InternalApi(value="For internal usage only") public class SingleColumnValueFilterAdapter extends TypedFilterAdapterBase<org.apache.hadoop.hbase.filter.SingleColumnValueFilter>
For internal use only - public for technical reasons.
Constructor and Description |
---|
SingleColumnValueFilterAdapter(ValueFilterAdapter delegateAdapter)
Constructor for SingleColumnValueFilterAdapter.
|
Modifier and Type | Method and Description |
---|---|
com.google.cloud.bigtable.data.v2.models.Filters.Filter |
adapt(FilterAdapterContext context,
org.apache.hadoop.hbase.filter.SingleColumnValueFilter filter)
SingleColumnValueFilter is a filter that will return a row if a family/qualifier value
matches some condition. |
FilterSupportStatus |
isFilterSupported(FilterAdapterContext context,
org.apache.hadoop.hbase.filter.SingleColumnValueFilter filter)
Determine if the given filter can be adapted to a Bigtable RowFilter.
|
getIndexScanHint
public SingleColumnValueFilterAdapter(ValueFilterAdapter delegateAdapter)
delegateAdapter
- a ValueFilterAdapter
object.public com.google.cloud.bigtable.data.v2.models.Filters.Filter adapt(FilterAdapterContext context, org.apache.hadoop.hbase.filter.SingleColumnValueFilter filter) throws IOException
SingleColumnValueFilter
is a filter that will return a row if a family/qualifier value
matches some condition. Optionally, if SingleColumnValueFilter.getFilterIfMissing()
is
set to false, then also return the row if the family/column is not present on the row. There's
a
Here's a rough translation of SingleColumnValueFilter.getFilterIfMissing()
== true.
IF a single family/column exists AND the value of the family/column meets some condition THEN return the ROW ENDHere's a rough translation of
SingleColumnValueFilter.getFilterIfMissing()
== false.
IF 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 ENDThe Cloud Bigtable filter translation for the
SingleColumnValueFilter.getFilterIfMissing()
true case here's the resulting filter is as
follows:
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 } }In addition to the default filter, there's a bit more if
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.
context
- a FilterAdapterContext
object.filter
- a S object.Filters.Filter
object.IOException
- if any.public FilterSupportStatus isFilterSupported(FilterAdapterContext context, org.apache.hadoop.hbase.filter.SingleColumnValueFilter filter)
context
- a FilterAdapterContext
object.filter
- a S object.FilterSupportStatus
object.