1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
//! `send_arrow` — publishing arrow-rs data straight onto an output
//! (blueprint §9.1's `send_arrow(ArrayRef) [arrow-interop]`), behind this
//! crate's `arrow-interop` feature.
//!
//! ```text
//! arrow_array::RecordBatch ──TryFrom──► astrs_data::RecordBatch ──► send_batch
//! (astrs-data's `arrow-interop` bridge)
//! ```
//!
//! Nothing here re-implements a conversion: every byte of the mapping already
//! lives in `astrs_data::interop`, and this module is the two lines that put
//! its output on the wire.
//!
//! # Why the argument is generic rather than `arrow_array::ArrayRef`
//!
//! Because `astrs-node-api` must not become a direct parent of arrow-rs. The
//! workspace's `deny.toml` bans the four `arrow-*` crates outright and then
//! re-admits them through a `wrappers` list naming exactly one crate —
//! `astrs-data` — so the whole workspace has a single, auditable arrow-rs
//! edge (blueprint §6.1, §18.1). Adding `arrow-array` to this crate's
//! manifest would create a second one and fail `cargo deny check bans` on any
//! run that activates the feature.
//!
//! A crate that does not depend on arrow-rs cannot *name* an arrow-rs type,
//! so the parameter is named by the **conversion** instead: any `A` for which
//! `astrs-data`'s bridge provides `RecordBatch: TryFrom<&A>`. Today that is
//! precisely `arrow_array::RecordBatch`, so the call site reads exactly as it
//! would with a concrete signature —
//!
//! ```ignore
//! out.send_arrow(&arrow_batch, meta)?;
//! ```
//!
//! — while this crate's dependency graph stays arrow-free. A single
//! `arrow_array::ArrayRef` reaches the same path through
//! [`RawOutput::send_array`](crate::output::RawOutput::send_array) after
//! `astrs_data::interop::from_arrow_array`, or by wrapping it in a one-column
//! `arrow_array::RecordBatch`.
//!
//! # Why its own error type
//!
//! The conversion fails with `astrs_data::interop::InteropError`, which
//! [`NodeError`] has no variant for — deliberately: `NodeError` is the
//! *default* build's public surface, and a variant that exists only under a
//! non-default feature would make the enum's shape feature-dependent. So the
//! two failure modes are kept apart in [`ArrowSendError`], which is
//! `#[error(transparent)]` on both arms: the rendered message is the
//! underlying error's own, and `source()` reaches it, so nothing is hidden by
//! the extra layer.
use RecordBatch;
use InteropError;
use Metadata;
use crateNodeError;
use crate;
/// Either half of a `send_arrow` can fail: the conversion, or the send.
///
/// See the [module docs](self) for why this is a separate type rather than a
/// [`NodeError`] variant.
/// Result alias for the `send_arrow` family.
pub type ArrowSendResult<T = > = Result;
/// Converts `value` through `astrs-data`'s arrow bridge and publishes the
/// result on `raw`.
///
/// The one implementation both [`RawOutput::send_arrow`] and
/// [`Output::send_arrow`] call.