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 aDType+ aVec<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 throughArithmeticOp/ComparisonOp.ColumnData: the inner enum holding the dense buffer. Most callers go throughColumnrather than touching this directly.SparseColumn: opt-in sparse encoding (paired value buffer + index-of-non-fill positions). Stored alongside the denseColumnfor backwards compat when consumers only needColumn.ValidityMask: per-cell missing-value bitmap. Stored onColumn; 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>perDataFrame(one column per data column) plus a separateIndexfrom fp-index for the row labels. - fp-index uses
Columninternally for some MultiIndex level storage.
Structs§
- Column
- Crack
Index - Adaptive crack index for progressive column partitioning.
- Float64
DotA Panel - A shared left-hand (
A) panel fordf.dot: thekA-columns built once asFloat64DotInputs and shared (Arc) across allnoutput 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-privateFloat64DotInput. - Sparse
Column - Validity
Mask
Enums§
- Arithmetic
Op - Column
Data - AG-10: Typed array representation for vectorized batch execution.
- Column
Error - Comparison
Op - 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.1target feature, which the rounding fast paths (python_floor_div_f64, floor/ceil/ trunc/round kernels) need to lower to a singleroundsd/roundpdinstead of a libm call.
Functions§
- affine_
positions - The rows
start + i * step,i in 0..len, of an affine selection thataffine_positions_fitits source. - affine_
positions_ fit - Whether every row
start + i * step,i in 0..len, of an affine selection (astart::stepslice,stepnegative for a backwards one) lies in0..source_len(br-frankenpandas-e00f7). - argmax_
f64 - The first position of the greatest of float
valuesholding no NaN; seeargmin_f64. - argmax_
i64 - The first position of the greatest of
values; seeargmin_i64. - argmin_
f64 - The first position of the least of float
valuesholding no NaN (an all-valid float column’s buffer; numpy’s argmin, ties - -0.0 and 0.0 among them - to the first),Nonewhen empty: four lanes a vector where the CPU has AVX2 (fp_dot_kernel::argmin_f64), a scan otherwise (br-frankenpandas-e186m). - argmin_
i64 - The first position of the least of
values(numpy’s argmin, ties to the first),Nonewhen empty: compared as the ints they are - a scan throughas f64could not tell two ints past 2^53 apart. - 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.
- compare_
i64_ scalar data[i] <op> sover ints, eight lanes a step where the CPU has AVX2: thei64sibling ofcompare_f64_scalar(an index’s ints against a number read it too; br-frankenpandas-e186m).- cov_
cross_ sums - The centered cross-sums of a covariance matrix’s upper triangle (pair
(a, b),b >= a, in that order), each pair summed over the rows in row order: fp-dot-kernel’s four-pairs-a-step kernel where the CPU has AVX2, the same loop at the baseline ISA else - the same bits either way (br-frankenpandas-jy2f4). - elementwise_
last_ worker_ count - How many workers the last elementwise float map on this thread split across.
1means it ran serially.0means 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. - max_i64
- The greatest of
values,Nonewhen empty; seemin_i64. - min_i64
- The least of
values,Nonewhen empty: four lanes a vector where the CPU has AVX2 (fp_dot_kernel::min_i64- an int64 compare has no earlier instruction, and the baseline’s emulated one made Series.min of a million ints 0.17 ms, pandas 0.09; br-frankenpandas-e186m), sixteen independent lanes otherwise. Exact: an integer min in any order. - mul_
i64_ by_ number - numpy_
cast_ sum_ i64 - numpy’s float64 total of int64
values- the cast-buffered pairwise sum pandas’ int64 mean divides (fp_dot_kernel::numpy_cast_sum_i64) - where the CPU has AVX2;Noneotherwise, the caller’s own reduction summing them the same way (br-frankenpandas-e186m). - numpy_
var_ i64 - numpy’s float64 variance of int64
valueswithddof- pandas’ int64 nanvar, fp-types’PandasReductions::varbit for bit (fp_dot_kernel::numpy_var_i64) - where the CPU has AVX2 and there are more values thanddof;Noneotherwise, the caller’s reduction answering (br-frankenpandas-e186m). - pct_
change_ values data[i] / data[i - periods] - 1.0for every row with a rowperiodsback, the firstperiodsrows 0.0 (a caller’s mask clears them): fp-dot-kernel’s 4-lane kernel where the CPU has AVX2 - the guard is not optional, that crate emits AVX2 unconditionally - else the baseline 2-lane map, the same bits either way (br-frankenpandas-faizi).- power_
by_ number base ** exponentas 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
f64slice (br-frankenpandas-wgyn4): the permutation orderingvaluesascending (or descending), equal values keeping original order.f64_radix_keyis order-preserving for finite/inf and the counting sort is stable. CALLER GUARANTEES no NaN (NaN has no radix order) and no-0.0when the consumer needstotal_cmpordering —f64_radix_keynormalizes-0.0→+0.0(matchingpartial_cmp/==, NOTtotal_cmp). - radix_
argsort_ i64 - Stable LSD radix argsort of an
i64slice (br-frankenpandas-y5s15): the permutation that ordersvaluesascending (or descending), equal values keeping their original order. Bit-identical to a stablesort_by(i64::cmp):i64_radix_keyis order-preserving and the counting sort is stable; descending flips the key (!key) so equal values still keep original order (matching a reversed comparator whoseEqualarm doesn’t reorder). Reusable for any all-Int64 ordering (index labels, single columns). - radix_
argsort_ multi_ u64 - Stable LSD radix lexsort over several
u64key columns (br-frankenpandas-lnsu6). Returns the permutation that orders rows lexicographically bykeys_by_col[0], thenkeys_by_col[1], …, with equal rows keeping their original order — exactly a stable multi-keysort_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_policyis called. - set_
elementwise_ write_ once - Install a write-once override for THIS THREAD.
- sum_i64
- The wrapping sum of
values(numpy’s int64 sum): four lanes a vector where the CPU has AVX2 (fp_dot_kernel::sum_i64), the baseline’s two otherwise. Wrapping addition is associative: the serial fold’s sum. - 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_argsortbut takes&[&[u8]]directly, so callers that already hold validated UTF-8 byte spans (groupby keys, contiguous-Utf8 columns) skip thefrom_utf8re-validation needed to build&[&str]. Byte order == UTF-8 lexicographic order, so the permutation is identical.