Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Mar 27, 2024
1 parent 7e77201 commit 02b87f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions velox/docs/develop/scalar-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion velox/expression/VectorFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down

0 comments on commit 02b87f6

Please sign in to comment.