Repository navigation
JSON.NUMINCRBY parsing broken for RESP2 - #3933
Merged
a-TODO-rov merged 4 commits intoOct 6, 2026
Merged
Conversation
Signed-off-by: yordantsintsov <yordan.tsintsov@gmail.com>
a-TODO-rov
approved these changes
Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On RESP2,
JSON.NUMINCRBYwith a JSONPath ($...) returned[0]instead of the new values, andnullfor non-numeric paths. RedisJSON sends RESP2 results as one bulk string of JSON text ([1928.5,2072.5]), whichNumberListOutputtried to parse as a single number and fell back to0. RESP3 was not affected.Key Decisions & Assumptions
NumberListOutputnow recognizes a bulk string of the form[...]and parses each element, turningnullintonull.JsonParser, because Jackson is optional andNUMINCRBYshouldn't require it. This relies on the reply always being a flat list of numbers andnull.NumberFormatis replaced byLong.parseLongwith aDouble.parseDoublefallback.Behavioral / Conceptual Changes
[1928.5, 2072.5]instead of[0], and[null]instead of[0]for non-numeric paths.1929.5used to parse as19295.2.0) is now aDoubleinstead of aLong, matching RESP3.Testing
RedisJsonResp2IntegrationTestsreruns the whole JSON integration suite on RESP2, and new tests cover multiple paths and a non-numeric path. Unit tests cover the RESP2 array forms, number types and locale independence.RedisJsonIntegrationTestsnow uses one client per class instead of one per test, which also stops leaking clients.Note
Medium Risk
Changes shared command reply decoding for JSON.NUMINCRBY on RESP2; behavior is better covered by tests but relies on a simple comma-split for JSON array text rather than a full JSON parser.
Overview
Fixes RESP2 handling for
JSON.NUMINCRBYwhen RedisJSON returns match results as a single bulk string of JSON text (e.g.[1928.5,2072.5]or[null]).NumberListOutputnow treats[...]replies as a flat list of numbers/nullinstead of parsing the whole string as one number (which produced[0]).Number parsing drops
NumberFormatin favor ofLong.parseLong/Double.parseDouble, so decimals are not mangled under non-English locales and numeric types stay closer to RESP3 (e.g.2.0asDouble).Tests add
RedisJsonResp2IntegrationTests(full JSON suite on RESP2), integration cases for multi-path increment and non-numeric paths, and unit coverage for array forms and locale behavior.RedisJsonIntegrationTestsuses one client per class via overridablegetOptions().Reviewed by Cursor Bugbot for commit f3e9e32. Bugbot is set up for automated code reviews on this repo. Configure here.