Signatures, Volatility, and the Type-Coercion Lattice: How DataFusion's UDF Metadata Drives the Optimizer
A UDF’s Signature is three orthogonal promises: which types it accepts, how it coerces them, and whether its result is repeatable.
A UDF’s Signature is three orthogonal promises: which types it accepts, how it coerces them, and whether its result is repeatable.
DataFusion aggregates are state machines: update_batch feeds them rows, state() serializes them, merge_batch combines them across partitions.
Scalar UDFs receive whole Arrow arrays per batch, not one ScalarValue per row — ColumnarValue is the currency that makes that possible.
DataFusion’s approx_percentile_cont compresses values into weighted centroids whose state can be merged across partitions — approximately, not exactly.