git-hulk commented on code in PR #1860:
URL: https://github.com/apache/kvrocks/pull/1860#discussion_r1375576634
##########
src/types/json.h:
##########
@@ -215,6 +215,23 @@ struct JsonValue {
return Status::OK();
}
+ Status ObjLen(std::string_view path, std::vector<std::optional<uint64_t>>
&obj_lens) const {
+ try {
+ jsoncons::jsonpath::json_query(value, path,
+ [&obj_lens](const std::string & /*path*/,
const jsoncons::json &basic_json) {
+ if (basic_json.is_array()) {
+
obj_lens.emplace_back(static_cast<uint64_t>(basic_json.size()));
Review Comment:
> JSON.OBJLEN returns an array of integer replies for each path specified as
the number of keys in the object or nil, if the matching JSON value is not an
object.
@isHuangXin I guess this means we should count the number of object fields
instead of array's length.
--
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]