google-cloud-bigtable - Class Google::Cloud::Bigtable::RowFilter::ConditionFilter (v2.6.5)

Reference documentation and code samples for the google-cloud-bigtable class Google::Cloud::Bigtable::RowFilter::ConditionFilter.

ConditionFilter

A RowFilter that 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 true and false filters, which may lead to inconsistent or unexpected results. Additionally, condition filters have poor performance, especially when filters are set for the false condition.

If predicate_filter outputs any cells, then true_filter will be evaluated on the input row. Otherwise, false_filter will be evaluated.

Inherits

  • Object

Example

predicate = Google::Cloud::Bigtable::RowFilter.key "user-*"

label = Google::Cloud::Bigtable::RowFilter.label "user"
strip_value = Google::Cloud::Bigtable::RowFilter.strip_value

Google::Cloud::Bigtable::RowFilter.condition(predicate).on_match(label).otherwise(strip_value)

Methods

#on_match

def on_match(filter) -> Google::Cloud::Bigtable::RowFilter::ConditionFilter

Sets a true filter on predicate-filter match.

The filter to apply to the input row if predicate_filter returns any results. If not provided, no results will be returned in the true case.

Example
require "google/cloud/bigtable"
predicate = Google::Cloud::Bigtable::RowFilter.key "user-*"

label = Google::Cloud::Bigtable::RowFilter.label "user"
strip_value = Google::Cloud::Bigtable::RowFilter.strip_value

Google::Cloud::Bigtable::RowFilter.condition(predicate).on_match(label).otherwise(strip_value)

#otherwise

def otherwise(filter) -> Google::Cloud::Bigtable::RowFilter::ConditionFilter

Set otherwise(false) filter.

The filter to apply to the input row if predicate_filter does not return any results. If not provided, no results will be returned in the false case.

Example
require "google/cloud/bigtable"

predicate = Google::Cloud::Bigtable::RowFilter.key "user-*"

label = Google::Cloud::Bigtable::RowFilter.label "user"
strip_value = Google::Cloud::Bigtable::RowFilter.strip_value

Google::Cloud::Bigtable::RowFilter.condition(predicate).on_match(label).otherwise(strip_value)