fv-plan 0.4.0

The FusionVault transform executor on Apache DataFusion: inline row steps and relational reshapes (join, aggregate, window, union) over Arrow, with the value dialect translated into the plan, spatial SQL, file sources, and build orchestration checked against the published conformance vectors.
Documentation
//! The DataFusion-backed transform executor.
//!
//! Two execution paths:
//!   • inline row ops (select/rename/drop/filter/applyExpression) — dynamic-typed, row-wise, carrying
//!     the bespoke value dialect → executed in Rust via the frozen-vectored `fv-value`. Vectored
//!     against the published contract's `step-kind` conformance vectors.
//!   • reshapes (join/aggregate/window/union) — cardinality/shape changes that need a relational
//!     engine → executed on DataFusion (SQL planner over a MemTable), with Value↔Arrow at the edges.
//!
//! Governance (gate, lineage, expectations semantics, labels) stays in the control plane; this is
//! execution only.

/// Every Rust code block in the README is compiled and run as a doctest.
#[cfg(doctest)]
#[doc = include_str!("../README.md")]
pub struct ReadmeDoctests;

pub mod build;
pub mod compute;
pub mod convert;
pub mod decimate_udaf;
pub mod inline;
pub mod reshape;
pub mod row;
pub mod session;
pub mod sources;
pub mod udf;

pub use build::{
    run_build, run_build_with, run_build_with_native, Build, BuildRecord, ComputeRunner, ExpResult, NoComputeRuntime,
};
pub use compute::KineticsRunner;
pub use inline::{apply_step, apply_steps, Step, StepError};
pub use reshape::{aggregate, join, union, window, Aggregation, Input, LocalSqlRunner, SqlRunner, WindowFn};
pub use row::Row;

/// Milliseconds since the Unix epoch (the wall clock a build record is stamped with).
pub fn now_ms() -> i64 {
    std::time::SystemTime::now()
        .duration_since(std::time::UNIX_EPOCH)
        .map(|d| d.as_millis() as i64)
        .unwrap_or(0)
}

/// True if `op` is a whole-transform step (a reshape, raw sql, or a container) — i.e. NOT an inline
/// row op. Such a step must be a transform's only step. The single source for this classification.
pub fn is_whole_transform_op(op: &str) -> bool {
    reshape::NATIVE_OPS.contains(&op) || op == "sql" || op == "container" || op == "wasm"
}

/// Smoke check that DataFusion is wired (used by the crate's integration test).
pub async fn datafusion_smoke() -> usize {
    use datafusion::arrow::array::Int64Array;
    use datafusion::arrow::datatypes::{DataType, Field, Schema};
    use datafusion::arrow::record_batch::RecordBatch;
    use datafusion::prelude::SessionContext;
    use std::sync::Arc;

    let schema = Arc::new(Schema::new(vec![Field::new("a", DataType::Int64, true)]));
    let batch = RecordBatch::try_new(schema, vec![Arc::new(Int64Array::from(vec![1, 2, 3]))]).unwrap();
    let ctx = SessionContext::new();
    let df = ctx.read_batch(batch).unwrap();
    df.collect().await.unwrap().iter().map(|b| b.num_rows()).sum()
}