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

Java: Add SORT and SORT_RO commands #1611

Merged
merged 9 commits into from
Jun 22, 2024

Conversation

GumpacG
Copy link
Collaborator

@GumpacG GumpacG commented Jun 19, 2024

https://redis.io/docs/latest/commands/sort/
https://redis.io/docs/latest/commands/sort_ro/

**Description
Dependent on #1528

According to #1439 (comment) and Python implementation for SORT and SORT_RO, BY and GET are only supported in standalone client. Then STORE required it’s own function as it has a different return type.

StandaloneOptions adds BY and GET options to the command. SortOptions adds LIMIT, GET, ASC, DESC, LIMIT, and STORE.

APIs supported in standalone client:

- sort(String key);
- sort(String key, SortOptions sortOptions);
- sortReadOnly(String key);
- sortReadOnly(String key, SortOptions sortOptions);
- sortWithStore(String key, String destination);
- sortWithStore(String key, String destination, SortOptions sortOptions);

APIs supported in cluster client:

- sort(String key);
- sort(String key, SortClusterOptions sortClusterOptions);
- sortReadOnly(String key);
- sortReadOnly(String key, SortOptions sortClusterOptions);
- sortWithStore(String key, String destination);
- sortWithStore(String key, String destination, SortClusterOptions sortClusterOptions);

Note: Javadocs are based off of #1439 and #1528.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@GumpacG GumpacG requested a review from a team as a code owner June 19, 2024 21:03
@Yury-Fridlyand Yury-Fridlyand added the java issues and fixes related to the java client label Jun 19, 2024
Copy link
Collaborator

@acarbonetto acarbonetto left a comment

Choose a reason for hiding this comment

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

Please rename sortoptions and rebase.

@Yury-Fridlyand
Copy link
Collaborator

Please resolve conflicts and update PR description to reflect new names

Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

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

Please update PR description - one more time

@GumpacG
Copy link
Collaborator Author

GumpacG commented Jun 21, 2024

Updated the PR description, thanks!

GumpacG and others added 9 commits June 21, 2024 15:26
* Added test

* Added child classes

* Needs cleaning up and store needs separate functions

* Simplified sort apis

* Separated sortOptions and sortStandAloneOptions

* Added tests

* Added IT and UT

* Revert to Builder from SuperBuilder

* Added javadocs

* Added transaction tests

* Addressed comments

* Spotless

* Added SortBaseOptions

* Addressed docs comments

* Fixed comment

* Refactor sortWithStore to sortStore

* Addressed comments

* Update java/client/src/main/java/glide/api/commands/GenericBaseCommands.java

Co-authored-by: Yury-Fridlyand <[email protected]>

---------

Co-authored-by: Yury-Fridlyand <[email protected]>
@Yury-Fridlyand Yury-Fridlyand merged commit 2438d8b into valkey-io:main Jun 22, 2024
46 checks passed
@Yury-Fridlyand Yury-Fridlyand deleted the java/integ_guiang_sort branch June 22, 2024 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
java issues and fixes related to the java client
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants