fn reduce_greatest_least(e: &mut MirScalarExpr, column_types: &[ReprColumnType])Expand description
Simplifies a Greatest/Least call:
- Deduplicate structurally equal operands, keeping first occurrences.
Scalar evaluation is deterministic (the
And/OrandCoalescereducers already rely on this when they deduplicate), so duplicates of an expression contribute the same value — over whichgreatest/leastare idempotent — or the same error; keeping the first occurrence leaves unchanged which error surfaces. - Drop literal null operands: both functions ignore null inputs (they return the max/min of the non-null inputs, and null only when every input is null).
- A call left with a single operand is the identity on it — the call evaluates the operand once and returns it, null or not — and a call left with none is null.