MOD-14010 support Homogenues array floating point forcing(deserializa…#17
Open
AvivDavid23 wants to merge 22 commits intomasterfrom
Open
MOD-14010 support Homogenues array floating point forcing(deserializa…#17AvivDavid23 wants to merge 22 commits intomasterfrom
AvivDavid23 wants to merge 22 commits intomasterfrom
Conversation
|
Did you look at c2pa_cbor? |
| JsonValue::Float(n) => { | ||
| if n.is_finite() { | ||
| n.to_string() | ||
| } else { |
There was a problem hiding this comment.
Why infinite is converted to 0?
| } | ||
| } | ||
| JsonValue::Str(s) => { | ||
| format!("\"{}\"", s.replace('\\', "\\\\").replace('"', "\\\"")) |
There was a problem hiding this comment.
Use raw string literals when backslashes are involved (instead of the \\, \" etc.; here and elsewhere). It makes the code more readable .
Author
@galcohen-redislabs I can try that, although it doesnt have a major release, and very low usage: |
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.

…tion path only)
no production-quality Rust CBOR library implements RFC 8746 natively (the only candidate,
cbor_enhanced, has been unmaintained since 2020 and lacks F16-LE and BF16 support), so a thinIValue ↔ ciborium::Valueconversion layer is still neededSize comparison (vs JSON baseline)
Example payloads
1 — FP32 typed array (1 000 elements, stored with FPHA F32 tag)
2 — FP64 typed array (1 000 elements, stored with FPHA F64 tag)
3 — Heterogeneous float array (same data, no FPHA hint)
Same JSON as above; without an FPHA hint the array is stored as
ArrayHetero(each element tagged individually). zstd still achieves the same ratio because
the repeated tag bytes compress well.
4 — String-heavy object (50 keys)
{ "key_0": "value_0_some_longer_string_here", "key_1": "value_1_some_longer_string_here", "key_2": "value_2_some_longer_string_here", ... // 50 keys total }5 — Small mixed object
{ "name": "Alice", "age": 30, "scores": [1, 2, 3, null, true, "bonus"], "meta": {"active": true, "level": 42} }6 — Nested FP32 arrays + string
{ "a": [0.0, 0.1, 0.2, ...], // 100 F32 elements "b": [0.0, 0.1, 0.2, ...], // 100 F32 elements "label": "test" }7 — Big mixed JSON (200 records, heterogeneous embeddings)
[ { "id": 0, "name": "user_0", "active": true, "score": 0.0, "tags": ["alpha", "beta", "gamma"], "embedding": [0.0, 0.001, 0.002, ...] // 32 floats }, // ... 200 records total, repeated schema ]The repeated key names (
"id","name","active","score","tags","embedding")across 200 records are what zstd compresses so aggressively here.
8 — Repeated-string records (500 records, RED-141886 scenario)
[ {"id": 0, "status": "active", "region": "us-east-1", "tier": "free", "owner": "team-a", "count": 0}, {"id": 1, "status": "inactive", "region": "eu-west-1", "tier": "standard", "owner": "team-b", "count": 10}, // ... 500 records; status/region/tier/owner values repeat from a small fixed set ]Note
Medium Risk
Adds a new serialization format and changes core
IArrayerror types/behavior, which could affect downstream APIs and edge cases around numeric range/typed-array handling.Overview
Adds CBOR serialization for
IValuevia newcbormodule, including optional zstd compression and RFC 8746 typed-array tagging (plus a private BF16 tag) so typed numeric arrays round-trip without losing their element type.Extends JSON deserialization with an opt-in
IValueDeserSeed/FPHAConfigthat forces homogeneous float arrays to a chosenFloatTypeand rejects out-of-range values;IArraygainsFloatType,push_with_fp_type, and a newIJsonErrorto unify allocation + range errors.CI fuzzing is expanded (longer runtime, OOM/ RSS handling) and new fuzz targets cover CBOR decode and CBOR round-trip, alongside added unit tests for the new behaviors.
Written by Cursor Bugbot for commit 043b76c. This will update automatically on new commits. Configure here.