diff --git a/velox/docs/develop/scalar-functions.rst b/velox/docs/develop/scalar-functions.rst index 8a8af2badaa07..fa728a8627708 100644 --- a/velox/docs/develop/scalar-functions.rst +++ b/velox/docs/develop/scalar-functions.rst @@ -581,14 +581,16 @@ process. This set may not include all the rows. By default, a vector function is assumed to have the default null behavior, e.g. null in any input produces a null result. In this case, the expression evaluation engine will exclude rows with nulls from the “rows” specified in the call to “apply”. If a -function has a different behavior for null inputs, it must override the -isDefaultNullBehavior method to return false. +function has a different behavior for null inputs, VectorFunctionMetadata's +defaultNullBehavior must be set to false when it is registered. .. code-block:: c++ - bool isDefaultNullBehavior() const override { - return false; - } + exec::registerStatefulVectorFunction( + prefix + "least", + leastSignatures(), + makeLeast, + exec::VectorFunctionMetadataBuilder().defaultNullBehavior(false).build()); In this case, the “rows” parameter will include rows with null inputs and the function will need to handle these. By default, the function can assume that diff --git a/velox/expression/VectorFunction.h b/velox/expression/VectorFunction.h index abffc882d7ff0..1c1c467bae8e9 100644 --- a/velox/expression/VectorFunction.h +++ b/velox/expression/VectorFunction.h @@ -45,7 +45,7 @@ class VectorFunction { /// vector as flat or constant, but not dictionary encoded. /// /// Single-argument functions that specify null-in-null-out behavior, e.g. - /// isDefaultNullBehavior returns true, will never see a null row in 'rows'. + /// defaultNullBehavior is true, will never see a null row in 'rows'. /// Hence, they can safely assume that args[0] vector is flat or constant and /// has no nulls in specified positions. ///