Skip to main content

Crate fp_columnar

Crate fp_columnar 

Source
Expand description

Columnar storage layer for frankenpandas — provides the Column container that backs every DataFrame column and Series value buffer in fp-frame.

A column is a typed value buffer (DType) plus a separate ValidityMask tracking which cells are missing. This split mirrors Apache Arrow’s storage layout and lets the type system enforce correctness on the dense-value side while keeping pandas-style missing-value semantics (NullKind::Null, NullKind::NaN, NullKind::NaT) on the validity side.

§Public surface

  • Column: the public columnar container. Built from a DType + a Vec<Scalar>. Exposes value access (Column::value, Column::values), reductions (Column::sum, Column::mean, Column::count, the nan-aware aggregations from fp-types), and typed binary operations dispatched through ArithmeticOp / ComparisonOp.
  • ColumnData: the inner enum holding the dense buffer. Most callers go through Column rather than touching this directly.
  • SparseColumn: opt-in sparse encoding (paired value buffer + index-of-non-fill positions). Stored alongside the dense Column for backwards compat when consumers only need Column.
  • ValidityMask: per-cell missing-value bitmap. Stored on Column; exposed for users that want to compose masks directly (logical masking, conditional updates, etc.).
  • ArithmeticOp / ComparisonOp: enum tags for typed binary-op dispatch (used by fp-frame’s expression engine and Series arithmetic).
  • CrackIndex: an internal positional index used by the “cracking” optimisation for repeated boolean-mask filters.

§Error reporting

ColumnError enumerates the failure modes (length mismatch, dtype mismatch, missing-value-in-required-slot, etc.). All Column-mutating fns return Result<_, ColumnError> so callers get explicit error categories.

§Relationship to other crates

  • fp-types supplies the DType / Scalar / NullKind / nan* reduction primitives this crate composes on top of.
  • fp-frame stores a Vec<Column> per DataFrame (one column per data column) plus a separate Index from fp-index for the row labels.
  • fp-index uses Column internally for some MultiIndex level storage.

Structs§

Column
CrackIndex
Adaptive crack index for progressive column partitioning.
Float64DotAPanel
A shared left-hand (A) panel for df.dot: the k A-columns built once as Float64DotInputs and shared (Arc) across all n output columns of a single dot product, so construction is O(k) once + O(n) Arc bumps instead of O(n·k). Opaque handle over the crate-private Float64DotInput.
SparseColumn
ValidityMask

Enums§

ArithmeticOp
ColumnData
AG-10: Typed array representation for vectorized batch execution.
ColumnError
ComparisonOp
Element-wise comparison operations that produce Bool-typed columns.

Constants§

BUILT_WITH_SSE41
Whether THIS build of fp-columnar was compiled with the x86 +sse4.1 target feature, which the rounding fast paths (python_floor_div_f64, floor/ceil/ trunc/round kernels) need to lower to a single roundsd/roundpd instead of a libm call.

Functions§

affine_positions
The rows start + i * step, i in 0..len, of an affine selection that affine_positions_fit its source.
affine_positions_fit
Whether every row start + i * step, i in 0..len, of an affine selection (a start::step slice, step negative for a backwards one) lies in 0..source_len (br-frankenpandas-e00f7).
cached_available_parallelism
std::thread::available_parallelism(), resolved ONCE per process.
clear_elementwise_witness_policy
Drop this thread’s policy override and fall back to the environment base.
clear_elementwise_write_once
Drop this thread’s write-once override.
elementwise_last_worker_count
How many workers the last elementwise float map on this thread split across. 1 means it ran serially. 0 means no such map has run on this thread.
elementwise_witness_policy_in_effect
The (max_workers, par_min) an elementwise float map on this thread would use right now. Provenance for a bench row: the setting an arm actually ran under, read from the same place the kernel reads it.
power_by_number
base ** exponent as numpy’s power loop computes a float array raised to one number: an exponent of 2 squares, 0.5 takes the square root and -1 the reciprocal - each correctly rounded, where glibc’s pow misses by an ulp about once in 1400 values, and the root keeps -0.0 and makes -inf NaN (pow’s 0.0 and inf) - any other exponent is pow. An array of exponents is pow throughout, as numpy computes it (br-frankenpandas-pucep).
radix_argsort_f64
Stable LSD radix argsort of an f64 slice (br-frankenpandas-wgyn4): the permutation ordering values ascending (or descending), equal values keeping original order. f64_radix_key is order-preserving for finite/inf and the counting sort is stable. CALLER GUARANTEES no NaN (NaN has no radix order) and no -0.0 when the consumer needs total_cmp ordering — f64_radix_key normalizes -0.0→+0.0 (matching partial_cmp/==, NOT total_cmp).
radix_argsort_i64
Stable LSD radix argsort of an i64 slice (br-frankenpandas-y5s15): the permutation that orders values ascending (or descending), equal values keeping their original order. Bit-identical to a stable sort_by(i64::cmp): i64_radix_key is order-preserving and the counting sort is stable; descending flips the key (!key) so equal values still keep original order (matching a reversed comparator whose Equal arm doesn’t reorder). Reusable for any all-Int64 ordering (index labels, single columns).
radix_argsort_multi_u64
Stable LSD radix lexsort over several u64 key columns (br-frankenpandas-lnsu6). Returns the permutation that orders rows lexicographically by keys_by_col[0], then keys_by_col[1], …, with equal rows keeping their original order — exactly a stable multi-key sort_by. The least-significant digit overall is the last column’s low byte, so the columns are processed in reverse (each an 8-pass stable counting sort that threads the running permutation), making the first column the most significant. O(n·k) and comparison-free. All key vectors must have the same length; callers bake per-column ascending/descending into the keys.
set_elementwise_witness_policy
Install a policy override for THIS THREAD, replacing the environment base until clear_elementwise_witness_policy is called.
set_elementwise_write_once
Install a write-once override for THIS THREAD.
utf8_msd_argsort
Stable MSD byte-radix argsort over UTF-8 strings.
utf8_msd_argsort_bytes
MSD byte-radix argsort over raw byte spans (br-frankenpandas-prk0a). Same stable lexicographic ordering as utf8_msd_argsort but takes &[&[u8]] directly, so callers that already hold validated UTF-8 byte spans (groupby keys, contiguous-Utf8 columns) skip the from_utf8 re-validation needed to build &[&str]. Byte order == UTF-8 lexicographic order, so the permutation is identical.

Type Aliases§

Utf8ArcBuffers