Expand description
Registry of the declared properties of every scalar function variant.
The stable LIR schema (see lir_schema.rs in mz-compute-types) pins the
shape of UnaryFunc, BinaryFunc and VariadicFunc: their
variants and payloads. It cannot see the properties the optimizer and the
renderer rely on, such as null propagation, error behavior, monotonicity
and output typing, nor the function bodies themselves. A change to any of
those changes the meaning of a stored LIR plan without changing its
serialized form.
FuncRegistry::build records those properties for one representative
instance of every variant, and tests/func_registry.rs in
mz-compute-types compares the result against checked-in snapshots, one
per half of Record. The module exists only under the func-registry feature,
which that test enables. Production builds carry none of it. For #[sqlfunc]
functions the record also carries the declaration text, the types-only
signature and a fingerprint of the function body, see SqlFuncSource,
and the output type is probed at the column types the parameter types
map to, see ColumnTypeProbe.
Variants whose payload cannot be constructed without data need a
representative Sample in this module. Building the registry panics
and names the variant otherwise. Samples may also be given for a
constructible variant, to probe its output type at chosen input types or
to record payloads whose properties differ, see Sample.
Structs§
- Binary
Func Properties - Column
Type Probe - Resolves a Rust parameter type to its column type by autoref
specialization:
(&ColumnTypeProbe::<T>(PhantomData)).column_type()picksProbeColumnTypewhenT: AsColumnTypeandProbeColumnTypeFallbackotherwise.#[sqlfunc]emits that expression for each parameter, which is how it can ask for a column type without knowing whether one exists. - Func
Registry - The registry of every variant of the three scalar function enums, keyed
by canonical variant name (see
FuncName) as described onSample. - Func
Source - Where a record’s properties came from.
- Record
- One registry entry: the properties that decide what a stored plan using the function computes, and the source they were read from.
- Sample
- A representative instance of a function variant.
- Unary
Func Properties - Variadic
Func Properties
Traits§
- Probe
Column Type - The specialized arm of
ColumnTypeProbe. - Probe
Column Type Fallback - The fallback arm of
ColumnTypeProbe, reached through one more autoref thanProbeColumnTypeso it only applies when that one does not.