PragmaTwice commented on code in PR #1841:
URL: https://github.com/apache/kvrocks/pull/1841#discussion_r1382332814


##########
src/types/redis_json.cc:
##########
@@ -230,4 +230,43 @@ rocksdb::Status Json::ArrLen(const std::string &user_key, 
const std::string &pat
 
   return rocksdb::Status::OK();
 }
+
+rocksdb::Status Json::StrAppend(const std::string &user_key, const std::string 
&path, const std::string &value,
+                                std::vector<uint64_t> &append_cnt) {
+  auto ns_key = AppendNamespacePrefix(user_key);
+  JsonMetadata metadata;
+  JsonValue json_val;
+  auto s = read(ns_key, &metadata, &json_val);
+  if (!s.ok()) return s;
+
+  auto append_res = json_val.StrAppend(path, value, append_cnt);
+  if (!append_res) return rocksdb::Status::InvalidArgument(append_res.Msg());
+  // need Reverse order
+  std::reverse(append_cnt.begin(), append_cnt.end());
+
+  bool need_overwrite = false;
+  for (auto append : append_cnt) {
+    if (append > 0) {

Review Comment:
   The `max` situation is missed here.



-- 
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]

Reply via email to