-
Notifications
You must be signed in to change notification settings - Fork 1.7k
bigtable: add ValueBitmaskFilter for data client #17567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b56cabf
6310b72
f929dc0
27c4e73
d750148
ca4c2d8
100f049
66bdec9
bb3d168
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1987,6 +1987,26 @@ def test_literal_value__write_literal_regex(input_arg, expected_bytes): | |||||||||||||||||||||
| assert filter_.regex == expected_bytes | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| class TestValueBitmaskFilter: | ||||||||||||||||||||||
| @staticmethod | ||||||||||||||||||||||
| def _target_class(): | ||||||||||||||||||||||
| from google.cloud.bigtable.data.row_filters import ValueBitmaskFilter | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return ValueBitmaskFilter | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def test_to_dict(self): | ||||||||||||||||||||||
| mask = b"\xaa" * 8 | ||||||||||||||||||||||
| row_filter = self._target_class()(mask) | ||||||||||||||||||||||
| expected = {"value_bitmask_filter": {"mask": mask}} | ||||||||||||||||||||||
| assert row_filter._to_dict() == expected | ||||||||||||||||||||||
|
Comment on lines
+1997
to
+2001
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the expected dictionary format to match the corrected
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def test_to_pb(self): | ||||||||||||||||||||||
| mask = b"\xaa" * 8 | ||||||||||||||||||||||
| row_filter = self._target_class()(mask) | ||||||||||||||||||||||
| pb = row_filter._to_pb() | ||||||||||||||||||||||
| assert pb.value_bitmask_filter.mask == mask | ||||||||||||||||||||||
|
Comment on lines
+2003
to
+2007
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def _ColumnRangePB(*args, **kw): | ||||||||||||||||||||||
| from google.cloud.bigtable_v2.types import data as data_v2_pb2 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Bigtable V2 API,
value_bitmask_filteris abytesfield, not a message with amaskfield. Therefore,_to_dictshould return{"value_bitmask_filter": self.mask}directly rather than nesting it under a"mask"key.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right. The proto is a ValueBitMask message with a mask field.