Interface LazyScalarFunction
- All Superinterfaces:
ScalarFunction
A scalar function that decides which of its arguments to evaluate — a special form.
Arguments arrive as deferred Arguments; one whose Argument.value()
is never called is never evaluated. That is what separates a conditional from an
ordinary three-argument function: in
IIf(IsNumeric(raw), CDbl(raw), 0)
the CDbl(raw) branch would fail on a row where raw is not numeric,
and on those rows it is not evaluated at all. A short-circuiting Coalesce
stops at its first non-NULL argument for the same reason.
Choose this only when skipping an argument is part of the function's meaning. A function that always reads every argument gains nothing and pays a call through the deferred wrapper for each one.
-
Method Summary
Modifier and TypeMethodDescriptioninvoke(FunctionContext context, List<Argument> arguments) Computes the result for one row, evaluating only the arguments it needs.Methods inherited from interface com.darkcollective.relix.function.ScalarFunction
name, pushdown, returnTypeFor, signature
-
Method Details
-
invoke
Computes the result for one row, evaluating only the arguments it needs.- Parameters:
context- the ambient state this call may readarguments- the deferred arguments, in call order; nevernulland of a length the declared arity accepts- Returns:
- the result value; never
null
-