From 1c856bc8ac1ab5f5ad0939d21057d30c96f29147 Mon Sep 17 00:00:00 2001 From: Masha Basmanova Date: Thu, 5 Oct 2023 13:46:34 -0700 Subject: [PATCH] Expand documentation for map_agg (#6911) Summary: Clarify that inputs with NULL or duplicate keys are ignored. Pull Request resolved: https://github.com/facebookincubator/velox/pull/6911 Reviewed By: xiaoxmeng Differential Revision: D49954059 Pulled By: mbasmanova fbshipit-source-id: ad054d79acc2045724050685e15a97abbbba3515 --- velox/docs/functions/presto/aggregate.rst | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/velox/docs/functions/presto/aggregate.rst b/velox/docs/functions/presto/aggregate.rst index aa5f314f9b2e..6f72eaa0031f 100644 --- a/velox/docs/functions/presto/aggregate.rst +++ b/velox/docs/functions/presto/aggregate.rst @@ -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 @@ -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``. @@ -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. @@ -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. @@ -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. @@ -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. @@ -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)