mattp5657 opened a new pull request, #4399:
URL: https://github.com/apache/iggy/pull/4399
## Which issue does this PR address?
Closes #4308
## Rationale
`owned_value_to_serde_json` only borrowed the `OwnedValue` tree, so it
allocated a fresh `String` per string leaf and key even when the
caller already owned the value and dropped it right after converting.
## What changed?
Added `owned_value_into_serde_json`, a consuming variant that moves
those strings and keys instead of copying them. The borrowing function
stays for out-of-tree plugins that only have a reference; both share
one `static_node_to_serde_json` helper so their NaN/Infinity-to-null
handling can't diverge.
Six call sites now use the consuming function: `http_sink`, both
`surrealdb_sink` document builders, the Avro encoder, and
`s3_sink`/`delta_sink` (their batches turned out to already be owned
higher up). `meilisearch_sink`'s own private duplicate of this
conversion is deleted in favor of the shared one.
`s3_sink::format_raw_message` had the same clone-before-drop shape one
layer down and is fixed the same way.
## Test coverage
`convert.rs`: a parity test across every `StaticNode` variant plus
populated containers, and a pointer-identity test proving the move
isn't a hidden clone. http_sink's 7 redundant conversion-function
tests are deleted (duplicated SDK-level coverage with no sink-specific
value of their own).
s3_sink: offset/timestamp threading through the S3 key, plus a
mid-batch-rotation test covering what a single flush can't observe;
literal-value tests for the base64/raw-JSON arms; `Payload::Text` vs
`Proto` behavior pinned now that they share a match arm.
surrealdb_sink: coverage for `build_json_payload_document`'s `Json`
arm. delta_sink: a mixed valid/invalid batch test.
## Local Execution
- `cargo test -p <crate>`, isolated per crate: sdk (192 lib + 10 + 21
integration), s3_sink (81), delta_sink (36), http_sink (51),
surrealdb_sink (41), meilisearch_sink (22). All passing.
- `fmt` / `sort --no-format` / `clippy --all-features --all-targets -D
warnings`: clean.
- `prek run`: passed.
## AI Usage
Claude was used in the generation of this PR.
--
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]