Add FPHA (floating-point homogeneous array) arg support to JSON.SET#4011
Open
petyaslavova wants to merge 5 commits intomasterfrom
Open
Add FPHA (floating-point homogeneous array) arg support to JSON.SET#4011petyaslavova wants to merge 5 commits intomasterfrom
petyaslavova wants to merge 5 commits intomasterfrom
Conversation
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
vladvildanov
requested changes
Apr 1, 2026
redis/commands/json/commands.py
Outdated
| pieces.extend(["FPHA", fpha.value]) | ||
| else: | ||
| try: | ||
| fpha_enum = FPHAType(fpha.upper()) |
Collaborator
There was a problem hiding this comment.
I think it does makes sense to move this data validation into a FPHAType object itself
vladvildanov
approved these changes
Apr 2, 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.

Add FPHA (floating-point homogeneous array) support to JSON.SET
This PR adds support for the
FPHA(Floating-Point Homogeneous Array) argument inJSON.SET, available in Redis 8.8+. The newfphaparameter allows users to specify a floating-point storage type (BF16,FP16,FP32, orFP64) for numeric arrays, enabling memory optimization by forcing Redis to store all floating-point values in an array using a specific precision.The parameter is added to
set(),set_file(), andset_path()methods, with full sync/async parity including all@overloadsignatures and theAsyncJSONclass overrides.A new
FPHAType(str, Enum)is introduced and exported fromredis.commands.jsonfor convenient, type-safe usage (e.g.,fpha=FPHAType.FP32). Plain strings are also accepted and validated client-side — invalid values raise aDataErrorbefore reaching the server. Case-insensitive string input is supported (e.g.,"fp32"is normalized to"FP32").Tests cover all FPHA types, enum usage, case-insensitive input, combination with
NX/XXmodifiers, and client-side validation of invalid types. Server-dependent tests are gated behind@skip_if_server_version_lt("8.7.0"), while client-side validation tests run unconditionally.Note
Medium Risk
Extends the
JSON.SETcommand builder and related helpers (set_file/set_path) with a new argument, which could affect request serialization and error handling for JSON writes. Risk is limited by client-side validation and targeted tests but still touches a core command path.Overview
Adds support for the RedisJSON
JSON.SETFPHA modifier via a newfphaparameter (acceptingFPHATypeenum or case-insensitive strings) onset(),set_file(), andset_path()across sync and asyncio clients.Introduces
FPHATypewith client-side validation (invalid values raiseDataError) and wiresFPHA <type>into the constructedJSON.SETargument list when provided. Updates tests (sync + asyncio) to cover valid FPHA types, enum usage, case-insensitivity, NX/XX interaction, and invalid-type validation, with server-version-gated cases usingskip_if_server_version_lt.Written by Cursor Bugbot for commit 5160c0c. This will update automatically on new commits. Configure here.