Skip to content

Commit

Permalink
Refine the statement
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Mar 27, 2024
1 parent 8615942 commit 2a2e0ba
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions velox/docs/develop/scalar-functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,15 @@ 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, VectorFunctionMetadata's
defaultNullBehavior must be set to false when it is registered. See the below
defaultNullBehavior must be set to false during registration. See the below
"Registration" section.

.. code-block:: c++

auto metadata = 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
all inputs are not null for all “rows".
Expand Down Expand Up @@ -637,8 +643,13 @@ dictionary or constant encoded. However, a deterministic function that takes
a single argument and has default null behavior is guaranteed to receive its
only input as a flat or constant vector. By default, a function is assumed to
be deterministic. If that’s not the case, VectorFunctionMetadata's deterministic
must be set to false when such function is registered. See the below "Registration"
section.
must be set to false during registration. See the below "Registration" section.

.. code-block:: c++

auto metadata = exec::VectorFunctionMetadataBuilder()
.deterministic(false)
.build();

Note that :ref:`decoded-vector` can be used to get a flat vector-like interface to any
vector. A helper class exec::DecodedArgs can be used to decode multiple arguments.
Expand Down Expand Up @@ -865,17 +876,9 @@ Use exec::registerVectorFunction to register a stateless vector function.

exec::registerVectorFunction takes a name, a list of supported signatures
and unique_ptr to an instance of the function. It is optional to provide
metadata flag to set deterministic or defaultNullBehavior.

.. code-block:: c++

auto metadata = exec::VectorFunctionMetadataBuilder()
.deterministic(false)
.defaultNullBehavior(false)
.build();

An optional “overwrite” flag specifies whether to overwrite a function if a
function with the specified name already exists.
metadata flag to set deterministic or defaultNullBehavior. An optional
“overwrite” flag specifies whether to overwrite a function if a function
with the specified name already exists.

Use exec::registerStatefulVectorFunction to register a stateful vector
function.
Expand Down

0 comments on commit 2a2e0ba

Please sign in to comment.