-
Notifications
You must be signed in to change notification settings - Fork 59
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
Node: Add ZUNIONSTORE command #1550
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.
Please add cross slot test
0d178ee
to
42fd636
Compare
42fd636
to
e13fb1c
Compare
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.
See comments.
* @param destination - The key of the destination sorted set. | ||
* @param keys - The keys of the sorted sets with possible formats: | ||
* string[] - for keys only. | ||
* KeyWeight[] - for weighted keys with score multipliers. |
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.
Does weighted is clear to the user? I don't know what its mean so i would like to have an explantation in the docs, but if it's normally known to the user it is not necessary.
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.
On Java, we linked to the documentation for WeightedKeys object. Is it easy to jump to KeyWeight object on PyCharm?
* await client.zadd("key1", {"member1": 10.5, "member2": 8.2}) | ||
* await client.zadd("key2", {"member1": 9.5}) | ||
* await client.zunionStore("my_sorted_set", ["key1", "key2"]) // Output: 2 - Indicates that the sorted set "my_sorted_set" contains two elements. | ||
* await client.zrangeWithScores("my_sorted_set", RangeByIndex(0, -1)) // Output: {'member1': 20, 'member2': 8.2} - "member1" is now stored in "my_sorted_set" with score of 20 and "member2" with score of 8.2. |
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.
Can you add an example of using weighted?
* await client.zrangeWithScores("my_sorted_set", RangeByIndex(0, -1)) // Output: {'member1': 10.5, 'member2': 8.2} - "member1" is now stored in "my_sorted_set" with score of 10.5 and "member2" with score of 8.2. | ||
* ``` | ||
*/ | ||
public zunionStore( |
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.
This should be in lowercase
public zunionStore( | |
public zunionstore( |
Please update examples too
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.
we're not too consistent with the *store
naming
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.
It is a single word command name, so in user API we do the same.
In internal API it is in camel case
* @param aggregationType - Specifies the aggregation strategy to apply when combining the scores of elements. See `AggregationType`. | ||
* Command Response - The number of elements in the resulting sorted set stored at `destination`. | ||
*/ | ||
public zunionStore( |
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.
public zunionStore( | |
public zunionstore( |
* await client.zrangeWithScores("my_sorted_set", RangeByIndex(0, -1)) // Output: {'member1': 10.5, 'member2': 8.2} - "member1" is now stored in "my_sorted_set" with score of 10.5 and "member2" with score of 8.2. | ||
* ``` | ||
*/ | ||
public zunionStore( |
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.
we're not too consistent with the *store
naming
* | ||
* When in cluster mode, `destination` and all keys in `keys` must map to the same hash slot. | ||
* | ||
* See https://valkey.io/commands/zunionstore/ for more details. |
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.
* See https://valkey.io/commands/zunionstore/ for more details. | |
* @see {@link https://valkey.io/commands/zunionstore/|valkey.io} for details. |
* When in cluster mode, `destination` and all keys in `keys` must map to the same hash slot. | ||
* | ||
* See https://valkey.io/commands/zunionstore/ for more details. | ||
|
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.
* If `destination` already exists, it is overwritten. Otherwise, a new sorted set will be created. | ||
* To get the result directly, see `zunion_withscores`. | ||
* | ||
* See https://valkey.io/commands/zunionstore/ for more details. |
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.
* See https://valkey.io/commands/zunionstore/ for more details. | |
* @see {@link https://valkey.io/commands/zunionstore/|valkey.io} for details. |
* To get the result directly, see `zunion_withscores`. | ||
* | ||
* See https://valkey.io/commands/zunionstore/ for more details. | ||
|
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.
Closing as #2145 took its place. |
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.