LindaSummer commented on code in PR #2803:
URL: https://github.com/apache/kvrocks/pull/2803#discussion_r1972722863
##########
tests/gocase/unit/type/tdigest/tdigest_test.go:
##########
@@ -141,4 +141,66 @@ func tdigestTests(t *testing.T, configs
util.KvrocksServerConfigs) {
require.EqualValues(t, 0, info.TotalCompressions)
}
})
+
+ t.Run("tdigest.add with different arguments", func(t *testing.T) {
+ keyPrefix := "tdigest_add_"
+
+ // Satisfy the number of parameters
+ require.ErrorContains(t, rdb.Do(ctx, "TDIGEST.ADD").Err(),
errMsgWrongNumberArg)
+ require.ErrorContains(t, rdb.Do(ctx, "TDIGEST.ADD",
keyPrefix+"key").Err(), errMsgWrongNumberArg)
+ require.ErrorContains(t, rdb.Do(ctx, "TDIGEST.ADD",
keyPrefix+"key", "abc").Err(), "not a valid float")
Review Comment:
Maybe we could follow current redis stack's error message to keep
compatibility. 😊
##########
src/commands/cmd_tdigest.cc:
##########
@@ -131,6 +131,44 @@ class CommandTDigestInfo : public Commander {
std::string key_name_;
};
+class CommandTDigestAdd : public Commander {
+ public:
+ Status Parse(const std::vector<std::string> &args) override {
+ key_name_ = args[1];
+
+ values_.reserve(args.size() - 2);
+ for (size_t i = 2; i < args.size(); i++) {
+ auto value = ParseFloat(args[i]);
+ if (!value) {
+ return {Status::RedisParseErr, errValueIsNotFloat};
Review Comment:
I test this case in redis stack latest image, the error message is `error
parsing val parameter`.
Maybe we could follow current redis's error message if possible.😊
--
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]