docs(arrow-convert): add a compile-checked doctest for reading ArrowData back into Rust - #2899
docs(arrow-convert): add a compile-checked doctest for reading ArrowData back into Rust#2899phil-opp wants to merge 1 commit into
Conversation
…ata back into Rust ArrowData is the type every node receives its inputs as, and the TryFrom<&ArrowData> impls are the read counterpart to IntoArrow, but the type carried only a one-line doc and the conversions were exercised only by cfg(test) unit tests. Add a runnable doctest that round-trips a Vec<f32> and a scalar through IntoArrow -> ArrowData -> try_into, and shows that a type mismatch is a recoverable error rather than a panic, so the read contract is both documented and pinned. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CCyEn8YqaYQYwh3RLjEZ7B
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Automated review by Claude — fully automated, no human in the loop. No issues found. The doctest exercises the real Generated by Claude Code |
|
Closing as a duplicate of #3084, which documents the same API more completely: it states the contract of both conversion shapes (scalar conversions require exactly one element and no nulls; slice/ |
Issue
ArrowData(libraries/arrow-convert/src/lib.rs) is the type every dora node receives its inputs as, and theTryFrom<&ArrowData>impls are the read counterpart toIntoArrow. ButArrowDatacarried only a single-line doc comment, and the conversions were exercised only by#[cfg(test)]unit tests — there was no compile-checked example documenting the intended read pattern or its null/type contract.IntoArrow(the Rust→Arrow direction) already has a good runnable doctest; the inverse direction had none.Fix
Expand the
ArrowDatadoc comment with a runnable# Examplethat:Vec<f32>throughIntoArrow→ArrowData→try_into(bothVec<f32>and borrowed&[f32]);u8);Err, not a panic.Pure documentation addition — no code behavior changes.
Validation
cargo test -p dora-arrow-convert --doc— the new doctest (and the existingIntoArrowone) pass.cargo fmt --all -- --check— clean.Generated by Claude Code