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 #363

Merged
merged 18 commits into from
Jun 19, 2024

Conversation

GumpacG
Copy link

@GumpacG GumpacG commented Jun 13, 2024

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

**Description
Dependent on valkey-io#1528

According to valkey-io#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);
- sort(String key, SortStandaloneOptions sortStandaloneOptions);
- sort(String key, SortOptions sortOptions, SortStandaloneOptions sortStandaloneOptions);
- sortReadOnly(String key, SortStandaloneOptions sortStandaloneOptions);
- sortReadOnly(String key, SortOptions sortOptions, SortStandaloneOptions sortStandaloneOptions);
- sortWithStore(String key, String destination, SortOptions sortOptions, SortStandaloneOptions sortStandaloneOptions);
- sortWithStore(String key, String destination, SortStandaloneOptions sortStandaloneOptions);

APIs supported in cluster 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);

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

@GumpacG GumpacG marked this pull request as ready for review June 15, 2024 23:08
@acarbonetto
Copy link

Should mention in the description that this PR is dependent on valkey-io#1528

Copy link

@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.

You missed one spot

@GumpacG GumpacG merged commit d227806 into java/integ_guiang_sort Jun 19, 2024
44 checks passed
GumpacG added a commit that referenced this pull request Jun 20, 2024
* 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]>
GumpacG added a commit that referenced this pull request Jun 21, 2024
* 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]>
acarbonetto pushed a commit that referenced this pull request Jun 22, 2024
* Java: Add `SORT` and `SORT_RO` commands (#363)

Co-authored-by: Yury-Fridlyand <[email protected]>
@GumpacG GumpacG deleted the java/dev_guiang_sort branch June 27, 2024 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants