Skip to content

Commit 5060696

Browse files
authored
feat: add value_bitmask_filter to the read API (#16898)
This PR was created outside of librarian due to b/501132869. b/501132869 should be resolved soon. In the meantime, we need to publish `value_bitmask_filter` to avoid blocking other teams. Steps used to create this PR - Clone [googleapis/googleapis](https://github.com/googleapis/googleapis) and checkout the last generated commit `a6cbf809c4c165e618ee23a059442af90a80a0f5` which matches what we have in .librarian/state.yaml https://github.com/googleapis/google-cloud-python/blob/8fa0f81cb35f93210ffb2020a8bc822a9eee5ec4/.librarian/state.yaml#L1169 - Apply this diff ``` (py392) partheniou@partheniou-vm-3:~/git/googleapis$ git diff diff --git a/google/bigtable/v2/data.proto b/google/bigtable/v2/data.proto index 8320a0c22f..af354b05a2 100644 --- a/google/bigtable/v2/data.proto +++ b/google/bigtable/v2/data.proto @@ -255,6 +255,15 @@ message ValueRange { } } +// Restricts the output to cells whose values match the given bitmask. +message ValueBitmask { + // Required. Mask applied to the value. + // Evaluated as: `(value & mask) == mask` + // The mask length must exactly match the value length, otherwise the cell is + // not considered a match. + bytes mask = 1 [(google.api.field_behavior) = REQUIRED]; +} + // Takes a row as input and produces an alternate view of the row based on // specified rules. For example, a RowFilter might trim down a row to include // just the cells from columns matching a given regular expression, or might @@ -514,6 +523,12 @@ message RowFilter { // will be applied to separate copies of the input. This may be relaxed in // the future. string apply_label_transformer = 19; + + // Matches only cells with values that satisfy the condition `(value & mask) + // == mask`. + // The mask length must exactly match the value length, otherwise the cell + // is not considered a match. + ValueBitmask value_bitmask_filter = 20; } } ``` - Clone this repo. Checkout commit `6cb5af5227e09e99ee12bb3542374f683b75d4b4` which is the last commit where generation was run: https://github.com/googleapis/google-cloud-python/commits/main/packages/google-cloud-bigtable - Run `legacylibrarian generate --api-source=<path/to/clone/of/googleapis> --library=google-cloud-bigtable` to regenerate the library using the local version of googleapis - Revert changes to `.librarian/state.yaml` Closes #16884
1 parent 83bffc2 commit 5060696

3 files changed

Lines changed: 36 additions & 0 deletions

File tree

packages/google-cloud-bigtable/google/cloud/bigtable_v2/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
StreamPartition,
8181
TimestampRange,
8282
Value,
83+
ValueBitmask,
8384
ValueRange,
8485
)
8586
from .types.feature_flags import FeatureFlags
@@ -245,5 +246,6 @@ def _get_version(dependency_name):
245246
"TimestampRange",
246247
"Type",
247248
"Value",
249+
"ValueBitmask",
248250
"ValueRange",
249251
)

packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
StreamPartition,
6464
TimestampRange,
6565
Value,
66+
ValueBitmask,
6667
ValueRange,
6768
)
6869
from .feature_flags import (
@@ -132,6 +133,7 @@
132133
"StreamPartition",
133134
"TimestampRange",
134135
"Value",
136+
"ValueBitmask",
135137
"ValueRange",
136138
"FeatureFlags",
137139
"PeerInfo",

packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/data.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"ColumnRange",
3838
"TimestampRange",
3939
"ValueRange",
40+
"ValueBitmask",
4041
"RowFilter",
4142
"Mutation",
4243
"ReadModifyWriteRule",
@@ -558,6 +559,24 @@ class ValueRange(proto.Message):
558559
)
559560

560561

562+
class ValueBitmask(proto.Message):
563+
r"""Restricts the output to cells whose values match the given
564+
bitmask.
565+
566+
Attributes:
567+
mask (bytes):
568+
Required. Mask applied to the value. Evaluated as:
569+
``(value & mask) == mask`` The mask length must exactly
570+
match the value length, otherwise the cell is not considered
571+
a match.
572+
"""
573+
574+
mask: bytes = proto.Field(
575+
proto.BYTES,
576+
number=1,
577+
)
578+
579+
561580
class RowFilter(proto.Message):
562581
r"""Takes a row as input and produces an alternate view of the row based
563582
on specified rules. For example, a RowFilter might trim down a row
@@ -805,6 +824,13 @@ class RowFilter(proto.Message):
805824
be applied to separate copies of the input. This may be
806825
relaxed in the future.
807826
827+
This field is a member of `oneof`_ ``filter``.
828+
value_bitmask_filter (google.cloud.bigtable_v2.types.ValueBitmask):
829+
Matches only cells with values that satisfy the condition
830+
``(value & mask) == mask``. The mask length must exactly
831+
match the value length, otherwise the cell is not considered
832+
a match.
833+
808834
This field is a member of `oneof`_ ``filter``.
809835
"""
810836

@@ -1012,6 +1038,12 @@ class Condition(proto.Message):
10121038
number=19,
10131039
oneof="filter",
10141040
)
1041+
value_bitmask_filter: "ValueBitmask" = proto.Field(
1042+
proto.MESSAGE,
1043+
number=20,
1044+
oneof="filter",
1045+
message="ValueBitmask",
1046+
)
10151047

10161048

10171049
class Mutation(proto.Message):

0 commit comments

Comments
 (0)