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


##########
src/types/json.h:
##########
@@ -198,6 +198,23 @@ struct JsonValue {
     return count;
   }
 
+  Status ArrLen(std::string_view path, std::vector<uint64_t> &arr_lens) const {
+    try {
+      jsoncons::jsonpath::json_query(value, path,
+                                     [&arr_lens](const std::string & /*path*/, 
const jsoncons::json &basic_json) {
+                                       if (basic_json.is_array()) {
+                                         
arr_lens.push_back(static_cast<int64_t>(basic_json.size()));
+                                       } else {
+                                         arr_lens.push_back(-1);

Review Comment:
   Both is fine to me. Using flag number is a common sense in C++, you can 
refer to https://en.cppreference.com/w/cpp/string/basic_string/npos for more 
details.
   So basically the standard library is using (uint64_t)-1.



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