From 30ba376cfb235efc4d90766e98dc85904c0e5e96 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 30 Apr 2026 18:17:23 +0000 Subject: [PATCH] feat: add value_bitmask_filter to the read API --- .../google/cloud/bigtable_v2/__init__.py | 2 ++ .../cloud/bigtable_v2/types/__init__.py | 2 ++ .../google/cloud/bigtable_v2/types/data.py | 32 +++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/packages/google-cloud-bigtable/google/cloud/bigtable_v2/__init__.py b/packages/google-cloud-bigtable/google/cloud/bigtable_v2/__init__.py index 6dcbba6e4912..5226a09ebb7f 100644 --- a/packages/google-cloud-bigtable/google/cloud/bigtable_v2/__init__.py +++ b/packages/google-cloud-bigtable/google/cloud/bigtable_v2/__init__.py @@ -80,6 +80,7 @@ StreamPartition, TimestampRange, Value, + ValueBitmask, ValueRange, ) from .types.feature_flags import FeatureFlags @@ -245,5 +246,6 @@ def _get_version(dependency_name): "TimestampRange", "Type", "Value", + "ValueBitmask", "ValueRange", ) diff --git a/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/__init__.py b/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/__init__.py index b13c076a2cf6..89fc5582ef34 100644 --- a/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/__init__.py +++ b/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/__init__.py @@ -63,6 +63,7 @@ StreamPartition, TimestampRange, Value, + ValueBitmask, ValueRange, ) from .feature_flags import ( @@ -132,6 +133,7 @@ "StreamPartition", "TimestampRange", "Value", + "ValueBitmask", "ValueRange", "FeatureFlags", "PeerInfo", diff --git a/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/data.py b/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/data.py index d4c481c93988..4ca790c49464 100644 --- a/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/data.py +++ b/packages/google-cloud-bigtable/google/cloud/bigtable_v2/types/data.py @@ -37,6 +37,7 @@ "ColumnRange", "TimestampRange", "ValueRange", + "ValueBitmask", "RowFilter", "Mutation", "ReadModifyWriteRule", @@ -558,6 +559,24 @@ class ValueRange(proto.Message): ) +class ValueBitmask(proto.Message): + r"""Restricts the output to cells whose values match the given + bitmask. + + Attributes: + mask (bytes): + 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. + """ + + mask: bytes = proto.Field( + proto.BYTES, + number=1, + ) + + class RowFilter(proto.Message): r"""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 @@ -805,6 +824,13 @@ class RowFilter(proto.Message): be applied to separate copies of the input. This may be relaxed in the future. + This field is a member of `oneof`_ ``filter``. + value_bitmask_filter (google.cloud.bigtable_v2.types.ValueBitmask): + 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. + This field is a member of `oneof`_ ``filter``. """ @@ -1012,6 +1038,12 @@ class Condition(proto.Message): number=19, oneof="filter", ) + value_bitmask_filter: "ValueBitmask" = proto.Field( + proto.MESSAGE, + number=20, + oneof="filter", + message="ValueBitmask", + ) class Mutation(proto.Message):