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

Fix for #1564: Return empty array instead of single element nil array in value array processor #1993

Merged
merged 4 commits into from
Feb 15, 2022

Conversation

NickCraver
Copy link
Collaborator

This changes the return of a nil result through the RedisValueArrayProcessor so that it's a [] instead of a single element [ nil ] in our handling.

This affects the following commands, which are multibulk when a count is provided (even if it's 1), otherwise they are bulkstring. This change affects the non-count case when it's null. Instead of a single element array with a nil value, we'd return an empty array as the Redis surface area intends:

  • LPOP/RPOP
  • SRANDMEMBER
  • SPOP

The other usages of RedisValueArrayProcessor are always multibulk and are not affected:

  • HMGET
  • HKEYS
  • HVALS
  • LRANGE
  • MGET
  • SDIFF
  • SINTER
  • SUNION
  • SMEMBERS
  • SORT
  • XCLAIM
  • Z(REV)RANGE
  • Z(REV)RANGEBYLEX
  • Z(REV)RANGEBYSCORE

This changes the return of a null result through the `RedisValueArrayProcessor` so that it's a `[]` instead of a `[ nil ]`.
@NickCraver NickCraver merged commit 4fb787c into main Feb 15, 2022
@NickCraver NickCraver deleted the craver/fix-1564 branch February 15, 2022 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RedisDatabase.SetPop() return an array with one element when the set is empty
2 participants