Skip to content

Commit

Permalink
Update deterministic part
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Mar 27, 2024
1 parent 02b87f6 commit 3e42dc0
Showing 1 changed file with 7 additions and 5 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 @@ -643,14 +643,16 @@ of the function arguments. These vectors are not necessarily flat and may be
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, the function must override
isDeterministic method to return false.
be deterministic. If that’s not the case, VectorFunctionMetadata's deterministic
must be set to false when such function is registered.

.. code-block:: c++

bool isDeterministic() const override {
return false;
}
exec::registerVectorFunction(
"plus_random",
PlusRandomIntegerFunction::signatures(),
std::make_unique<PlusRandomIntegerFunction>(),
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

0 comments on commit 3e42dc0

Please sign in to comment.