Skip to main content

Module rules

Module rules 

Source
Expand description

Metadata-only rewrite rules for the optimizer (Layers 1 and 2 of the execution model).

Reduce rules are the cheapest transformations in the execution pipeline: they operate purely on array structure and metadata without reading any data buffers.

There are two kinds of reduce rules:

  • ArrayReduceRule (Layer 1) – a self-rewrite where an array simplifies itself. Example: a FilterArray with an all-true mask removes the filter wrapper.

  • ArrayParentReduceRule (Layer 2) – a child-driven rewrite where a child rewrites its parent. Example: a DictArray child of a ScalarFnArray pushes the scalar function into the dictionary values.

Rules are collected into ReduceRuleSet and ParentRuleSet respectively, and evaluated by the optimizer in a fixpoint loop until no more rules apply.

Structs§

ParentReduceRuleAdapter
Bridges a concrete ArrayParentReduceRule<V, R> to the type-erased DynArrayParentReduceRule<V> trait. Created by ParentRuleSet::lift.
ParentRuleSet
A set of parent reduction rules for a specific child array encoding.
ReduceRuleSet
A collection of ArrayReduceRules registered for a specific encoding.

Traits§

ArrayParentReduceRule
A metadata-only rewrite rule where a child encoding rewrites its parent (Layer 2).
ArrayReduceRule
A metadata-only rewrite rule that transforms an array based on its own structure (Layer 1).
DynArrayParentReduceRule
Type-erased version of ArrayParentReduceRule used for dynamic dispatch within ParentRuleSet.