-
Notifications
You must be signed in to change notification settings - Fork 472
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 support of the SORT command #2262
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.
Good job. Thank you for providing such comprehensive test cases.
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.
I'll take a carefully pass tonight, just some minor comments now
Actually I'm thinking to specify a special command tag for such commands that loads all of the data structure, like this one, and HRANDFIELD.. |
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.
Sort is too complex here, I'll dive into it later, thanks for the contribution
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.
The implementation looks generally good to me.
See if @mapleFU or others have any concern.
/// If `args.alpha` is false, `RedisSortObject.v` will be taken as double for comparison | ||
/// If `args.alpha` is true and `args.sortby` is not empty, `RedisSortObject.v` will be taken as string for comparison | ||
/// If `args.alpha` is true and `args.sortby` is empty, the comparison is by `RedisSortObject.obj`. |
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.
So why do here has std::variant
and a std::string
? We should use only variant
or double + string
composite?
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.
I think it is feasible to only use std::variant<std::string, double>
, but this may require distinguishing between two types of std::string
: BY(RedisSortObject.v) and the sort key itself(RedisSortObject.obj), resulting in unclear sorting logic.
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.
Sigh, I think maybe struct or other is ok, since the passed in argument ( RedisSortObject
) is defined by args
. It cannot have another state ( like holding a string when !args.alpha
), and this introduce a double-checking here.
std::variant
seems has same space usage as struct {double; string;}
. But both is ok for me
Co-authored-by: mwish <maplewish117@gmail.com>
Will merge in 1-days if no negative comments |
Quality Gate passedIssues Measures |
Add support of the SORT command (apache#2262) Co-authored-by: 纪华裕 <jihuayu123@gmail.com> Co-authored-by: hulk <hulk.website@gmail.com> Co-authored-by: mwish <maplewish117@gmail.com>
issues: #1952