-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Adding score_cast_func argument to zrank, zrevrank and zunion - for consistency with the other sorted sets commands #3795
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
Adding score_cast_func argument to zrank, zrevrank and zunion - for consistency with the other sorted sets commands #3795
Conversation
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.
Pull Request Overview
This PR adds consistency to Redis sorted set commands by adding the score_cast_func
parameter to zrank
, zrevrank
, and zunion
commands, aligning them with other sorted set operations. It also ensures that score_cast_func
is properly applied to both RESP2 and RESP3 protocol responses.
- Adds
score_cast_func
parameter tozrank
,zrevrank
, andzunion
commands for consistency - Introduces new parser helper functions to handle score casting for rank operations in both RESP2 and RESP3
- Updates test cases to verify the new functionality works correctly with custom score cast functions
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
redis/commands/core.py | Adds score_cast_func parameter to zrank , zrevrank , and zunion methods |
redis/_parsers/helpers.py | Introduces new parser functions for handling score casting in rank operations for both RESP protocols |
tests/test_commands.py | Adds comprehensive test coverage for the new score_cast_func parameter functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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.
Nits
…onsistency with the other sorted sets commands
2e86cfc
to
914de46
Compare
…p version problem
… versions we have hanging multiprocessing tests
…ior - sometimes processes hang and cause action timeouts. Enabling all long running pipeline jobs to be started after the initial fast checks.
…onsistency with the other sorted sets commands (#3795) * Adding score_cast_func argument to zrank, zrevrank and zunion - for consistency with the other sorted sets commands * Adding async tests; Add docstrings info for the new arg; removed unused option * Applying review comments * Try to fix the failing tests with Python 3.9 - it looks like a new dep version problem * Restricting some lib versions for tests with PyPy Python - with newer versions we have hanging multiprocessing tests * Restricting all test deps to specific versions for PyPy tests * Skipping multiprocessing tests with PyPY Python due to unstable behavior - sometimes processes hang and cause action timeouts. Enabling all long running pipeline jobs to be started after the initial fast checks. * Restricting lib requirements for Python 3.9 and fix an pubsub flaky test
Pull Request check-list
Please make sure to review and check all of these items:
NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.
Description of change
This change is adding score_cast_func argument to the commands that had with_score/s argument - this way all commands expose consistent pattern how to handle the responses.
Another change added here is adding the usage of the configured score_cast_func for RESP3 responses as well - with the current code this argument value was completely ignored for resp3 responses.
Fixes #3300