You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "yezhizi (via GitHub)" <gi...@apache.org> on 2025/09/11 12:05:33 UTC

[PR] feat(ts): Add `TS.INCRBY` command [kvrocks]

yezhizi opened a new pull request, #3171:
URL: https://github.com/apache/kvrocks/pull/3171

   Part of #3048 
   
   In the current implementation, `TS.INCRBY` defaults to using `0` as the timestamp when `TIMESTAMP` is not specified, which differs from Redis' native behavior (using the server's timestamp). 
   This feature could be implemented in the future, along with the `TS.ADD key * value` syntax to support automatically using the server's timestamp.
   
   
   ```
   127.0.0.1:6666>  TS.INCRBY a 232 TIMESTAMP 1657811829000
   (integer) 1657811829000
   127.0.0.1:6666> TS.INCRBY a 157 TIMESTAMP 1657811829000
   (integer) 1657811829000
   127.0.0.1:6666> TS.INCRBY a 432 TIMESTAMP 1657811829000
   (integer) 1657811829000
   127.0.0.1:6666> ts.get a
   1) 1) (integer) 1657811829000
      2) (double) 821
   127.0.0.1:6666> ts.incrby a 100 TIMESTAMP 50
   (error) ERR timestamp must be equal to or higher than the maximum existing timestamp
   127.0.0.1:6666> 
   ```


-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(ts): Add `TS.INCRBY` and `TS.DECRBY` command [kvrocks]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3171:
URL: https://github.com/apache/kvrocks/pull/3171#issuecomment-3288533012

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=3171) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [33 New issues](https://sonarcloud.io/project/issues?id=apache_kvrocks&pullRequest=3171&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_kvrocks&pullRequest=3171&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_kvrocks&pullRequest=3171&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [70.5% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=3171&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1.3% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=3171&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=3171)
   
   


-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(ts): Add `TS.INCRBY` command [kvrocks]

Posted by "yezhizi (via GitHub)" <gi...@apache.org>.
yezhizi commented on PR #3171:
URL: https://github.com/apache/kvrocks/pull/3171#issuecomment-3280517770

   Also add `TS.DECRBY` command : )


-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(ts): Add `TS.INCRBY` command [kvrocks]

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice commented on code in PR #3171:
URL: https://github.com/apache/kvrocks/pull/3171#discussion_r2340604734


##########
src/commands/cmd_timeseries.cc:
##########
@@ -978,6 +978,67 @@ class CommandTSMRange : public CommandTSRangeBase, public CommandTSMGetBase {
   TSMRangeOption option_;
 };
 
+class CommandTSIncrBy : public CommandTSCreateBase {
+ public:
+  CommandTSIncrBy() { registerDefaultHandlers(); }
+  Status Parse(const std::vector<std::string> &args) override {
+    if (args.size() < 3) {
+      return {Status::RedisParseErr, "wrong number of arguments for 'ts.incrby' command"};
+    }

Review Comment:
   can be removed. it will be checked in other place.



-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(ts): Add `TS.INCRBY` and `TS.DECRBY` command [kvrocks]

Posted by "PragmaTwice (via GitHub)" <gi...@apache.org>.
PragmaTwice merged PR #3171:
URL: https://github.com/apache/kvrocks/pull/3171


-- 
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: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org