Class: Google::Cloud::Bigtable::RowFilter::SimpleFilter
- Inherits:
-
Object
- Object
- Google::Cloud::Bigtable::RowFilter::SimpleFilter
- Defined in:
- lib/google/cloud/bigtable/row_filter/simple_filter.rb
Overview
SimpleFilter
Instance Method Summary collapse
-
#block ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Does not match any cells, regardless of input.
-
#cells_per_column(limit) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only the most recent N cells within each column.
-
#cells_per_row(limit) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only the first N cells of each row.
-
#cells_per_row_offset(offset) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Skips the first N cells of each row, matching all subsequent cells.
-
#column_range(range) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells from columns within the given range.
-
#family(regex) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells from columns whose families satisfy the given RE2 regex.
-
#key(regex) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells from rows whose keys satisfy the given RE2 regex.
-
#label(value) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Applies the given label to all cells in the output row.
-
#pass ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches all cells, regardless of input.
-
#qualifier(regex) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells from columns whose qualifiers satisfy the given RE2 regex.
-
#sample(probability) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches all cells from a row with probability p, and matches no cells from the row with probability 1-p.
-
#sink ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Outputs all cells directly to the output of the read rather than to any parent filter.
-
#strip_value ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Replaces each cell's value with the empty string.
-
#timestamp_range(from, to) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Create timestamp range filter instance.
-
#value(regex) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells with values that satisfy the given regular expression.
-
#value_range(range) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells with values that fall within the given range.
Instance Method Details
#block ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Does not match any cells, regardless of input. Useful for temporarily disabling just part of a filter.
57 58 59 60 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 57 def block @grpc.block_all_filter = true self end |
#cells_per_column(limit) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only the most recent N cells within each column. For example,
if N=2, this filter would match column foo:bar at timestamps 10 and 9,
skip all earlier cells in foo:bar, and then begin matching again in
column foo:bar2.
If duplicate cells are present, as is possible when using an Interleave,
each copy of the cell is counted separately.
207 208 209 210 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 207 def cells_per_column limit @grpc.cells_per_column_limit_filter = limit self end |
#cells_per_row(limit) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only the first N cells of each row. If duplicate cells are present, as is possible when using an Interleave, each copy of the cell is counted separately.
192 193 194 195 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 192 def cells_per_row limit @grpc.cells_per_row_limit_filter = limit self end |
#cells_per_row_offset(offset) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Skips the first N cells of each row, matching all subsequent cells. If duplicate cells are present, as is possible when using an Interleave, each copy of the cell is counted separately.
180 181 182 183 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 180 def cells_per_row_offset offset @grpc.cells_per_row_offset_filter = offset self end |
#column_range(range) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells from columns within the given range.
253 254 255 256 257 258 259 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 253 def column_range range unless range.instance_of?(Google::Cloud::Bigtable::ColumnRange) raise RowFilterError, "Range type mustbe ColumnRange" end @grpc.column_range_filter = range.to_grpc self end |
#family(regex) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells from columns whose families satisfy the given RE2
regex. For technical reasons, the regex must not contain the :
character, even if it is not being used as a literal.
Note that, since column families cannot contain the new line character
\n, it is sufficient to use . as a full wildcard when matching
column family names.
117 118 119 120 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 117 def family regex @grpc.family_name_regex_filter = regex self end |
#key(regex) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells from rows whose keys satisfy the given RE2 regex. In
other words, passes through the entire row when the key matches, and
otherwise produces an empty row.
Note that, since row keys can contain arbitrary bytes, the \C escape
sequence must be used if a true wildcard is desired. The . character
will not match the new line character \n, which may be present in a
binary key.
For Regex syntax:
85 86 87 88 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 85 def key regex @grpc.row_key_regex_filter = regex self end |
#label(value) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Applies the given label to all cells in the output row. This allows the client to determine which results were produced from which part of the filter.
Values must be at most 15 characters in length, and match the RE2
pattern [a-z0-9\\-]+
Due to a technical limitation, it is not currently possible to apply
multiple labels to a cell. As a result, a Chain may have no more than
one sub-filter which contains a apply_label_transformer. It is okay for
an Interleave to contain multiple apply_label_transformers, as they
will be applied to separate copies of the input. This may be relaxed in
the future.
168 169 170 171 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 168 def label value @grpc.apply_label_transformer = value self end |
#pass ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches all cells, regardless of input. Functionally equivalent to
leaving filter unset, but included for completeness.
47 48 49 50 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 47 def pass @grpc.pass_all_filter = true self end |
#qualifier(regex) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells from columns whose qualifiers satisfy the given RE2
regex.
Note that, since column qualifiers can contain arbitrary bytes, the \C
escape sequence must be used if a true wildcard is desired. The .
character will not match the new line character \n, which may be
present in a binary qualifier.
132 133 134 135 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 132 def qualifier regex @grpc.column_qualifier_regex_filter = regex self end |
#sample(probability) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches all cells from a row with probability p, and matches no cells from the row with probability 1-p.
96 97 98 99 100 101 102 103 104 105 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 96 def sample probability if probability >= 1 || probability <= 0 raise( RowFilterError, "Probability must be greather then 0 and less then 1.0" ) end @grpc.row_sample_filter = probability self end |
#sink ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Outputs all cells directly to the output of the read rather than to any parent filter.
37 38 39 40 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 37 def sink @grpc.sink = true self end |
#strip_value ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Replaces each cell's value with the empty string.
66 67 68 69 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 66 def strip_value @grpc.strip_value_transformer = true self end |
#timestamp_range(from, to) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Create timestamp range filter instance
Matches only cells with timestamps within the given range. Specified a contiguous range of timestamps.
221 222 223 224 225 226 227 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 221 def from, to range_grpc = Google::Bigtable::V2::TimestampRange.new range_grpc. = from if from range_grpc. = to if to @grpc. = range_grpc self end |
#value(regex) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells with values that satisfy the given regular expression.
Note that, since cell values can contain arbitrary bytes, the \C escape
sequence must be used if a true wildcard is desired. The . character
will not match the new line character \n, which may be present in a
binary value.
146 147 148 149 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 146 def value regex @grpc.value_regex_filter = regex self end |
#value_range(range) ⇒ Google::Cloud::Bigtable::RowFilter::SimpleFilter
Matches only cells with values that fall within the given range.
See ValueRange#from and { Google::Cloud::Bigtable::ValueRange#to} for range option inclusive/exclusive options
- The value at which to start the range.If neither field is set, interpreted as the empty string, inclusive.
- The value at which to end the range. If neither field is set, interpreted as the infinite string, exclusive.
240 241 242 243 244 245 246 |
# File 'lib/google/cloud/bigtable/row_filter/simple_filter.rb', line 240 def value_range range unless range.instance_of?(Google::Cloud::Bigtable::ValueRange) raise RowFilterError, "Range type mustbe ValueRange" end @grpc.value_range_filter = range.to_grpc self end |