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
//! Single-row [`RecordBatch`] / stream builders shared by loader adapters.
//!
//! `uni-plugin-rhai`'s procedure adapter materializes the plugin's
//! returned rows into one `RecordBatch` and then wraps it in a
//! `RecordBatchStreamAdapter` yielding exactly one item. The 1-batch
//! stream pattern is generic and unrelated to rhai. This module hosts
//! the shared implementation so future adapters (custom in-process
//! procedures, builtin synthetic catalogs) reuse it.
//!
//! These helpers are pure Arrow utilities; they do **not** depend on any
//! plugin-loader feature gate.
// Rust guideline compliant
use ;
use ;
use SendableRecordBatchStream;
use RecordBatchStreamAdapter;
use stream;
/// Construct a single-row [`RecordBatch`] from the supplied schema and
/// column arrays.
///
/// Thin wrapper over `RecordBatch::try_new` whose only purpose is to
/// give shared call sites a named function (so the rhai loader, future
/// synthetic catalogs, and tests share a vocabulary).
///
/// # Errors
///
/// Propagates [`ArrowError::SchemaError`] / [`ArrowError::InvalidArgumentError`]
/// when the supplied columns do not match the schema (column count, type
/// mismatch, or row-count mismatch).
/// Wrap a single [`RecordBatch`] in a one-item
/// [`SendableRecordBatchStream`].
///
/// Used by procedure adapters whose plugin produced exactly one batch
/// (and by tests that need a stream-shaped fixture for a one-row
/// constant input). The yielded schema is `Arc`-cloned from the
/// supplied `batch`.