Skip to content

Commit

Permalink
Expand documentation for map_agg (#6911)
Browse files Browse the repository at this point in the history
Summary:
Clarify that inputs with NULL or duplicate keys are ignored.

Pull Request resolved: #6911

Reviewed By: xiaoxmeng

Differential Revision: D49954059

Pulled By: mbasmanova

fbshipit-source-id: ad054d79acc2045724050685e15a97abbbba3515
  • Loading branch information
mbasmanova authored and facebook-github-bot committed Oct 5, 2023
1 parent 0ea72cb commit 1c856bc
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions velox/docs/functions/presto/aggregate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ depending on the order of input values.
General Aggregate Functions
---------------------------

.. function:: arbitrary(x) -> [same as input]
.. function:: arbitrary(x) -> [same as x]

Returns an arbitrary non-null value of ``x``, if one exists.

.. function:: array_agg(x) -> array<[same as input]>
.. function:: array_agg(x) -> array<[same as x]>

Returns an array created from the input ``x`` elements. Ignores null
inputs if :doc:`presto.array_agg.ignore_nulls <../../configs>` is set
Expand Down Expand Up @@ -93,6 +93,7 @@ General Aggregate Functions
Returns the value of ``x`` associated with the maximum value of ``y`` over all input values.

.. function:: max_by(x, y, n) -> array([same as x])
:noindex:

Returns n values of ``x`` associated with the n largest values of ``y`` in descending order of ``y``.

Expand All @@ -101,30 +102,33 @@ General Aggregate Functions
Returns the value of ``x`` associated with the minimum value of ``y`` over all input values.

.. function:: min_by(x, y, n) -> array([same as x])
:noindex:

Returns n values of ``x`` associated with the n smallest values of ``y`` in ascending order of ``y``.

.. function:: max(x) -> [same as input]
.. function:: max(x) -> [same as x]

Returns the maximum value of all input values.
``x`` must not contain nulls when it is complex type.

.. function:: max(x, n) -> array<[same as x]>
:noindex:

Returns ``n`` largest values of all input values of ``x``.
``n`` must be a positive integer and not exceed 10'000.

.. function:: min(x) -> [same as input]
.. function:: min(x) -> [same as x]

Returns the minimum value of all input values.
``x`` must not contain nulls when it is complex type.

.. function:: min(x, n) -> array<[same as x]>
:noindex:

Returns ``n`` smallest values of all input values of ``x``.
``n`` must be a positive integer and not exceed 10'000.

.. function:: multimap_agg(key, value) -> map(K,array(V))
.. function:: multimap_agg(K key, V value) -> map(K,array(V))

Returns a multimap created from the input ``key`` / ``value`` pairs.
Each key can be associated with multiple values.
Expand Down Expand Up @@ -190,7 +194,7 @@ General Aggregate Functions
-- (1, 3.0)
-- (2, 30.0)

.. function:: set_agg(x) -> array<[same as input]>
.. function:: set_agg(x) -> array<[same as x]>

Returns an array created from the distinct input ``x`` elements.
``x`` must not contain nulls when it is complex type.
Expand All @@ -212,7 +216,7 @@ General Aggregate Functions

Returns ARRAY[1, 2, 3, 4]

.. function:: sum(x) -> [same as input]
.. function:: sum(x) -> [same as x]

Returns the sum of all input values.

Expand All @@ -227,7 +231,7 @@ Bitwise Aggregate Functions

Returns the bitwise OR of all input values in 2's complement representation.

.. function:: bitwise_xor_agg(x) -> [same as input]
.. function:: bitwise_xor_agg(x) -> [same as x]

Returns the bitwise XOR of all input values in 2's complement representation.

Expand All @@ -236,9 +240,9 @@ Bitwise Aggregate Functions
Map Aggregate Functions
-----------------------

.. function:: map_agg(key, value) -> map(K,V)
.. function:: map_agg(K key, V value) -> map(K,V)

Returns a map created from the input ``key`` / ``value`` pairs.
Returns a map created from the input ``key`` / ``value`` pairs. Inputs with NULL or duplicate keys are ignored.

.. function:: map_union(map(K,V)) -> map(K,V)

Expand Down

0 comments on commit 1c856bc

Please sign in to comment.