Skip to content
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

docs: Update the docstring for ExactValueFilter #620

Closed
wants to merge 1 commit into from

Conversation

Mariatta
Copy link
Contributor

@Mariatta Mariatta commented Aug 4, 2022

It derives from ValueRegexFilter, so it still expects a regular expression.

The name itself was a misnomer, it was mostly to handle int values rather than exact values.

For filtering on matching str/byte values, we can use the ValueRangeFilter.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #567 🦕

It derives from ValueRegexFilter, so it still expects a regular expression.

The name itself was a misnomer, it was mostly to handle int values rather than exact values.

For filtering on matching str/byte values, we can use the ValueRangeFilter.
@Mariatta Mariatta requested review from a team as code owners August 4, 2022 20:03
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: bigtable Issues related to the googleapis/python-bigtable API. labels Aug 4, 2022
@Mariatta Mariatta added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 5, 2022
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 5, 2022
Comment on lines +471 to +474
When passing non-integer ``value``, it must be valid RE2 patterns. See Google's
`RE2 reference`_ for the accepted syntax.

.. _RE2 reference: https://github.com/google/re2/wiki/Syntax
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong. I think the value needs to be properly escaped. ie if I pass the number 46 (ascii for .), it will match every single byte value

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spoke offline, the current behavior is very surprising and not very useful. In case users using the current behavior, we can't change it.

Instead I propose that we add a new LiteralValueFilter that

  1. for ints converts them into bytestrings using the current logic
  2. for strs converts them to bytestrings
  3. accepts bytestrings as is
  4. once everything is normalized to a bytestring, iterate over the bytes and properly escape the bytes to encure they don't get interpreted as control characters. Example: https://github.com/googleapis/java-bigtable/blob/main/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RegexUtil.java#L53-L81
  5. Deprecate ExactValueFilter and encourage people to migrate to the new filter
  6. Next major version drop ExactValueFilter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a LiteralValueFilter implementation PR for the v3 branch: #767 (review)

@Mariatta Mariatta added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Nov 15, 2022
@meredithslota meredithslota changed the title Docs: Update the docstring for ExactValueFilter docs: Update the docstring for ExactValueFilter Jan 20, 2023
@daniel-sanche
Copy link
Contributor

Closing in favor of #767

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/python-bigtable API. size: xs Pull request size is extra small. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cloud Bigtable: CheckAndMutateRow : ExactValueFilter
4 participants