-
Notifications
You must be signed in to change notification settings - Fork 53
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
Add NOSCORES option to ZSCAN & NOVALUES option to HSCAN #2174
Conversation
* at even indices and the value is at odd indices. If options.noValues is set to <code>true | ||
* </code>, the second element will only contain the fields without the values. |
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.
* at even indices and the value is at odd indices. If options.noValues is set to <code>true | |
* </code>, the second element will only contain the fields without the values. | |
* at even indices and the value is at odd indices. If <code>options.noValues</code> is set to <code>true</code>, the second element will only contain the fields without the values. |
and rerun spotless
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.
using andrews suggestion
@@ -732,7 +733,8 @@ public interface HashBaseCommands { | |||
* </code> returned on the last iteration of the result. The second element is always an | |||
* <code>Array</code> of the subset of the hash held in <code>key</code>. The array in the | |||
* second element is always a flattened series of <code>String</code> pairs, where the key is | |||
* at even indices and the value is at odd indices. | |||
* at even indices and the value is at odd indices. If options.noValues is set to <code>true |
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.
same here
@@ -2790,7 +2790,8 @@ CompletableFuture<Map<GlideString, Double>> zinterWithScores( | |||
* <code> | |||
* Array</code> of the subset of the sorted set held in <code>key</code>. The array in the | |||
* second element is always a flattened series of <code>String</code> pairs, where the value | |||
* is at even indices and the score is at odd indices. | |||
* is at even indices and the score is at odd indices. If options.noScores is to <code>true |
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.
same
@@ -2827,7 +2828,8 @@ CompletableFuture<Map<GlideString, Double>> zinterWithScores( | |||
* <code> | |||
* Array</code> of the subset of the sorted set held in <code>key</code>. The array in the | |||
* second element is always a flattened series of <code>String</code> pairs, where the value | |||
* is at even indices and the score is at odd indices. | |||
* is at even indices and the score is at odd indices. If options.noScores is to <code>true |
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.
same
@@ -7052,7 +7052,9 @@ public <ArgType> T zscan(@NonNull ArgType key, @NonNull ArgType cursor) { | |||
* the <code>cursor</code> returned on the last iteration of the sorted set. The second | |||
* element is always an <code>Array</code> of the subset of the sorted set held in <code>key | |||
* </code>. The array in the second element is always a flattened series of <code>String | |||
* </code> pairs, where the value is at even indices and the score is at odd indices. | |||
* </code> pairs, where the value is at even indices and the score is at odd indices. If | |||
* options.noScores is to <code>true</code>, the second element will only contain the members |
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.
same
@@ -729,6 +729,24 @@ export async function transactionTest( | |||
responseData.push(["hset(key4, { [field]: value })", 1]); | |||
baseTransaction.hscan(key4, "0"); | |||
responseData.push(['hscan(key4, "0")', ["0", [field, value]]]); | |||
|
|||
if (gte(version, "7.9.0")) { |
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 (gte(version, "7.9.0")) { | |
if (gte(version, "8.0.0")) { |
@@ -972,6 +990,25 @@ export async function transactionTest( | |||
responseData.push(["zadd(key12, { one: 1, two: 2 })", 2]); | |||
baseTransaction.zscan(key12, "0"); | |||
responseData.push(['zscan(key12, "0")', ["0", ["one", "1", "two", "2"]]]); | |||
|
|||
if (gte(version, "7.9.0")) { |
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 (gte(version, "7.9.0")) { | |
if (gte(version, "8.0.0")) { |
@@ -10020,6 +10020,16 @@ async def test_zscan(self, glide_client: GlideClusterClient): | |||
assert result[result_cursor_index] != b"0" | |||
assert len(result[result_collection_index]) >= 0 | |||
|
|||
# Test no_scores option | |||
if not await check_if_server_version_lt(glide_client, "7.9.0"): |
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 not await check_if_server_version_lt(glide_client, "7.9.0"): | |
if not await check_if_server_version_lt(glide_client, "8.0.0"): |
Same here - need to find a way to make this check pass with RC
@@ -10137,6 +10147,16 @@ async def test_hscan(self, glide_client: GlideClusterClient): | |||
assert result[result_cursor_index] != b"0" | |||
assert len(result[result_collection_index]) >= 0 | |||
|
|||
# Test no_values option | |||
if not await check_if_server_version_lt(glide_client, "7.9.0"): |
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.
same
@@ -306,6 +306,9 @@ async def transaction_test( | |||
args.append([b"0", [key3.encode(), b"10.5"]]) | |||
transaction.hscan(key4, "0", match="*", count=10) | |||
args.append([b"0", [key3.encode(), b"10.5"]]) | |||
if not await check_if_server_version_lt(glide_client, "7.9.0"): |
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.
same
@@ -696,7 +696,8 @@ public interface HashBaseCommands { | |||
* </code> returned on the last iteration of the result. The second element is always an | |||
* <code>Array</code> of the subset of the hash held in <code>key</code>. The array in the | |||
* second element is always a flattened series of <code>String</code> pairs, where the key is |
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.
* second element is always a flattened series of <code>String</code> pairs, where the key is | |
* second element is a flattened series of <code>String</code> pairs, where the key is |
@@ -732,7 +733,8 @@ public interface HashBaseCommands { | |||
* </code> returned on the last iteration of the result. The second element is always an | |||
* <code>Array</code> of the subset of the hash held in <code>key</code>. The array in the | |||
* second element is always a flattened series of <code>String</code> pairs, where the key is |
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.
* second element is always a flattened series of <code>String</code> pairs, where the key is | |
* second element is a flattened series of <code>String</code> pairs, where the key is |
@@ -696,7 +696,8 @@ public interface HashBaseCommands { | |||
* </code> returned on the last iteration of the result. The second element is always an | |||
* <code>Array</code> of the subset of the hash held in <code>key</code>. The array in the | |||
* second element is always a flattened series of <code>String</code> pairs, where the key is | |||
* at even indices and the value is at odd indices. | |||
* at even indices and the value is at odd indices. If options.noValues is set to <code>true |
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.
You will need to add import glide.api.models.commands.scan.HScanOptions.HScanOptionsBuilder;
* at even indices and the value is at odd indices. If options.noValues is set to <code>true | |
* at even indices and the value is at odd indices. If {@link HScanOptionsBuilder#noValues} is set to <code>true |
@@ -732,7 +733,8 @@ public interface HashBaseCommands { | |||
* </code> returned on the last iteration of the result. The second element is always an | |||
* <code>Array</code> of the subset of the hash held in <code>key</code>. The array in the | |||
* second element is always a flattened series of <code>String</code> pairs, where the key is | |||
* at even indices and the value is at odd indices. | |||
* at even indices and the value is at odd indices. If options.noValues is set to <code>true |
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.
You will need to add import glide.api.models.commands.scan.HScanOptions.HScanOptionsBuilder;
* at even indices and the value is at odd indices. If options.noValues is set to <code>true | |
* at even indices and the value is at odd indices. If {@link HScanOptionsBuilder#noValues} is set to <code>true |
@@ -2790,7 +2790,8 @@ CompletableFuture<Map<GlideString, Double>> zinterWithScores( | |||
* <code> | |||
* Array</code> of the subset of the sorted set held in <code>key</code>. The array in the | |||
* second element is always a flattened series of <code>String</code> pairs, where the value | |||
* is at even indices and the score is at odd indices. | |||
* is at even indices and the score is at odd indices. If options.noScores is to <code>true |
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.
You will need to add import glide.api.models.commands.scan.ZScanOptions.ZScanOptionsBuilder;
* is at even indices and the score is at odd indices. If options.noScores is to <code>true | |
* is at even indices and the score is at odd indices. If {@link ZScanOptionsBuilder#noScores} is to <code>true |
node/src/Transaction.ts
Outdated
* Command Response - An `Array` of the `cursor` and the subset of the sorted set held by `key`. | ||
* The first element is always the `cursor` for the next iteration of results. `0` will be the `cursor` | ||
* returned on the last iteration of the sorted set. The second element is always an `Array` of the subset | ||
* of the sorted set held in `key`. The `Array` in the second element is always a flattened series of | ||
* `String` pairs, where the value is at even indices and the score is at odd indices. | ||
* If options.noScores is to `true`, the second element will only contain the members without scores. |
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 options.noScores is to `true`, the second element will only contain the members without scores. | |
* If `options.noScores` is to `true`, the second element will only contain the members without scores. |
`String` pairs, where the value is at even indices and the score is at odd indices. | ||
The first element is always the `cursor` for the next iteration of results. `0` will be the `cursor` | ||
returned on the last iteration of the sorted set. The second element is always an `Array` of the subset | ||
of the sorted set held in `key`. The `Array` in the second element is always a flattened series of |
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.
of the sorted set held in `key`. The `Array` in the second element is always a flattened series of | |
of the sorted set held in `key`. The `Array` in the second element is a flattened series of |
@@ -6196,13 +6219,15 @@ async def hscan( | |||
count (Optional[int]): `COUNT` is a just a hint for the command for how many elements to fetch from the hash. | |||
`COUNT` could be ignored until the hash is large enough for the `SCAN` commands to represent the results | |||
as compact single-allocation packed encoding. | |||
no_values (bool): If `True`, the command will not return values the fields in the hash. Since Valkey "8.0.0". | |||
|
|||
Returns: | |||
List[Union[bytes, List[bytes]]]: An `Array` of the `cursor` and the subset of the hash held by `key`. | |||
The first element is always the `cursor` for the next iteration of results. `0` will be the `cursor` | |||
returned on the last iteration of the hash. The second element is always an `Array` of the subset of the | |||
hash held in `key`. The `Array` in the second element is always a flattened series of `String` pairs, |
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.
hash held in `key`. The `Array` in the second element is always a flattened series of `String` pairs, | |
hash held in `key`. The `Array` in the second element is a flattened series of `String` pairs, |
`String` pairs, where the value is at even indices and the score is at odd indices. | ||
The first element is always the `cursor` for the next iteration of results. `0` will be the `cursor` | ||
returned on the last iteration of the sorted set. The second element is always an `Array` of the subset | ||
of the sorted set held in `key`. The `Array` in the second element is always a flattened series of |
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.
of the sorted set held in `key`. The `Array` in the second element is always a flattened series of | |
of the sorted set held in `key`. The `Array` in the second element is a flattened series of |
subset of the hash then there could be a case where the result is empty although there are items that | ||
match the pattern specified. This is due to the default `COUNT` being `10` which indicates that it will | ||
only fetch and match `10` items from the list. | ||
count (Optional[int]): `COUNT` is a just a hint for the command for how many elements to fetch from the hash. | ||
`COUNT` could be ignored until the hash is large enough for the `SCAN` commands to represent the results | ||
as compact single-allocation packed encoding. | ||
no_values (bool): If `True`, the command will not return values the fields in the hash. Since Valkey "8.0.0". | ||
|
||
Returns: | ||
List[Union[bytes, List[bytes]]]: An `Array` of the `cursor` and the subset of the hash held by `key`. | ||
The first element is always the `cursor` for the next iteration of results. `0` will be the `cursor` | ||
returned on the last iteration of the hash. The second element is always an `Array` of the subset of the | ||
hash held in `key`. The `Array` in the second element is always a flattened series of `String` pairs, |
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.
hash held in `key`. The `Array` in the second element is always a flattened series of `String` pairs, | |
hash held in `key`. The `Array` in the second element is a flattened series of `String` pairs, |
Signed-off-by: Shoham Elias <[email protected]>
Signed-off-by: Shoham Elias <[email protected]>
fdefbc4
to
ed814f3
Compare
Signed-off-by: Shoham Elias <[email protected]>
--------- Signed-off-by: Shoham Elias <[email protected]>
--------- Signed-off-by: Shoham Elias <[email protected]>
No description provided.