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

[PR] Fix JSON.STRLEN and JSON.OBJLEN path bug [kvrocks]

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

   <img width="326" alt="5e7fd4968ee28ef848c9ac5160fe4b0" src="https://github.com/apache/kvrocks/assets/127465317/e75c0f4a-e4f0-416d-b011-49f7b4d7f7fe">
   <img width="466" alt="98ccdac6d5360ea5434d34345ff77c7" src="https://github.com/apache/kvrocks/assets/127465317/8668657a-3ce7-4392-a6d3-7679986074c6">
   JSON.STRLEN and JSON.OBJLEN have path not return null


-- 
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] Fix JSON.STRLEN and JSON.OBJLEN path bug [kvrocks]

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

   ![image](https://github.com/apache/kvrocks/assets/127465317/aa6f2c9f-b078-4f4c-bb30-284b1a297b2a)
   These errors seem to have nothing to do with the changes I made this time
   please help retry


-- 
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] Fix JSON.STRLEN and JSON.OBJLEN path bug [kvrocks]

Posted by "git-hulk (via GitHub)" <gi...@apache.org>.
git-hulk commented on code in PR #2336:
URL: https://github.com/apache/kvrocks/pull/2336#discussion_r1617045839


##########
src/commands/cmd_json.cc:
##########
@@ -559,9 +561,11 @@ class CommandJsonStrLen : public Commander {
 
     Optionals<uint64_t> results;
     auto s = json.StrLen(args_[1], path, &results);
-    if (s.IsNotFound()) {
+    if (s.IsNotFound() && args_.size() == 2) {
       *output = conn->NilString();
       return Status::OK();
+    } else if (s.IsNotFound() && args_.size() == 3) {
+      return {Status::RedisExecErr, "could not perform this operation on a key that doesn't exist"};
     }

Review Comment:
   ```suggestion
       if (s.IsNotFound()) {
         if (args_.size() == 2) {
           *output = conn->NilString();
           return Status::OK();
         } else {
           return {Status::RedisExecErr, "could not perform this operation on a key that doesn't exist"};
         }
       }
   ```



##########
src/commands/cmd_json.cc:
##########
@@ -382,9 +382,11 @@ class CommandJsonObjLen : public Commander {
 
     Optionals<uint64_t> results;
     auto s = json.ObjLen(args_[1], path, &results);
-    if (s.IsNotFound()) {
+    if (s.IsNotFound() && args_.size() == 2) {
       *output = conn->NilString();
       return Status::OK();
+    } else if (s.IsNotFound() && args_.size() == 3) {
+      return {Status::RedisExecErr, "Path '" + args_[2] + "' does not exist or not an object"};
     }

Review Comment:
   ```suggestion
       if (s.IsNotFound()) {
         if (args_.size() == 2) {
           *output = conn->NilString();
           return Status::OK();
         } else {
           return {Status::RedisExecErr, "Path '" + args_[2] + "' does not exist or not an object"};
         }
       }
   ```



-- 
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] Fix JSON.[STRLEN|OBJLEN] response inconsistently with Redis when the path doesn't exist [kvrocks]

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

   ## [![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=2336) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_kvrocks&pullRequest=2336&resolved=false&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=2336&resolutions=WONTFIX)
   
   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=2336&resolved=false&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [61.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=2336&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=2336&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=2336)
   
   


-- 
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] Fix JSON.STRLEN and JSON.OBJLEN path bug [kvrocks]

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

   @jackyyyyyssss Thanks for your fix.


-- 
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] Fix JSON.[STRLEN|OBJLEN] response inconsistently with Redis when the path doesn't exist [kvrocks]

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


-- 
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] Fix JSON.STRLEN and JSON.OBJLEN path bug [kvrocks]

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

   ## [![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=2336) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_kvrocks&pullRequest=2336&resolved=false&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=2336&resolutions=WONTFIX)
   
   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=2336&resolved=false&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [61.4% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=2336&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=2336&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=2336)
   
   


-- 
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] Fix JSON.STRLEN and JSON.OBJLEN path bug [kvrocks]

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

   ## [![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=2336) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [4 New issues](https://sonarcloud.io/project/issues?id=apache_kvrocks&pullRequest=2336&resolved=false&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=2336&resolutions=WONTFIX)
   
   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=2336&resolved=false&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [61.2% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=2336&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_kvrocks&pullRequest=2336&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_kvrocks&pullRequest=2336)
   
   


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