donghao526 commented on code in PR #3130:
URL: https://github.com/apache/kvrocks/pull/3130#discussion_r2485507594
##########
src/commands/cmd_tdigest.cc:
##########
@@ -176,6 +176,53 @@ class CommandTDigestAdd : public Commander {
std::vector<double> values_;
};
+class CommandTDigestRevRank : public Commander {
+ public:
+ Status Parse(const std::vector<std::string> &args) override {
+ key_name_ = args[1];
+
+ std::unordered_set<std::string> unique_inputs_set(args.begin() + 2,
args.end());
+ origin_inputs_.assign(args.begin() + 2, args.end());
+
+ unique_inputs_.reserve(unique_inputs_set.size());
+ size_t i = 0;
+ for (const auto &input : unique_inputs_set) {
+ auto value = ParseFloat(input);
+ if (!value) {
+ return {Status::RedisParseErr, errValueIsNotFloat};
+ }
+ unique_inputs_.push_back(*value);
+ unique_inputs_order_[input] = i++;
+ }
Review Comment:
The origin_inputs_ vector stores the correct order of the origin inputs. So
the order of the results is deterministic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]