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
//! Columnar batch accumulation for blocking operators
//!
//! Blocking operators (Sort/TopN) buffer all input before producing output.
//! Instead of buffering `Vec<Vec<Value>>` rows, rows are accumulated
//! column-major: homogeneous columns stay raw
//! (`Vec<i64>`/`Vec<f64>`/`Vec<i32>`/`Vec<bool>`/`Vec<i64>` days/`Vec<Arc<str>>`)
//! so that ordering operates on scalars without constructing one `Value`
//! per row. Columns that mix kinds (or hit NULLs) degrade to
//! [`BatchColumn::Fallback`], keeping the exact `Value` semantics of the
//! row-based path.
//!
//! ## Relationship to `TypedColumn`
//!
//! `TypedColumn` models a fixed-kind column inside a `DataChunk` for batch
//! expression evaluation, while `BatchColumn` models a column whose kind is
//! decided by its first append (`BatchColumn::Empty` until then) and which
//! supports accumulation (append/gather/permute). The two intentionally
//! share a variant set so `append_typed` can move a chunk's typed columns
//! into a batch without re-inspecting values; keep them in sync when adding
//! a kind.
//!
//! ## Relationship to `MaterializedBatch`
//!
//! Other blocking operators (aggregate, distinct, materialize, window) keep
//! their state in `linkrs_core::columnar::MaterializedBatch`, which is
//! column-oriented but stores one `Vec<Value>` per column and therefore does
//! not get the typed-scalar treatment. Treat `MaterializedBatch` as the
//! spill and persistence form; the in-memory streaming fast path uses
//! `TypedColumn` and `ColumnarBatch`.
use Arc;
use cratecolumn_variants;
use crateEdgeHeaderColumn;
use Decimal128Value;
use Value;
pub use ColumnarBatch;
// Column-major accumulation of one output column across chunks.
//
// The variant set is declared once by `column_variants!` in
// `columnar_common` and shared with `TypedColumn`; `len`, `is_empty`, and
// `estimated_size` are generated from that list.
// Accumulable blocking-operator state; see `columnar_common` for the list.
column_variants!;