LindaSummer commented on code in PR #2811:
URL: https://github.com/apache/kvrocks/pull/2811#discussion_r1977157820
##########
src/commands/cmd_tdigest.cc:
##########
@@ -168,7 +168,69 @@ class CommandTDigestAdd : public Commander {
std::vector<double> values_;
};
+class CommandTDigestMin : public Commander {
+ public:
+ Status Parse(const std::vector<std::string> &args) override {
+ key_name_ = args[1];
+ return Status::OK();
+ }
+
+ Status Execute(engine::Context &ctx, Server *srv, Connection *conn,
std::string *output) override {
+ TDigest tdigest(srv->storage, conn->GetNamespace());
+ TDigestMetadata metadata;
+ auto s = tdigest.GetMetaData(ctx, key_name_, &metadata);
+ if (!s.ok()) {
+ if (s.IsNotFound()) {
+ return {Status::RedisExecErr, errKeyNotFound};
+ }
+ return {Status::RedisExecErr, s.ToString()};
+ }
+
+ if (metadata.total_observations == 0) {
+ return {Status::RedisExecErr, errValueIsNotExists};
Review Comment:
Hi @mapleFU ,
Thanks very much for this link.❤️
I had seeking for a long time for redis's native tdigest implementation
during my development but didn't find it. 😆
Best Regards,
Edward
--
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]