1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Add combine functions for various floating-point aggregates.

This allows parallel aggregation to use them.  It may seem surprising
that we use float8_combine for both float4_accum and float8_accum
transition functions, but that's because those functions differ only
in the type of the non-transition-state argument.

Haribabu Kommi, reviewed by David Rowley and Tomas Vondra
This commit is contained in:
Robert Haas
2016-04-08 13:44:50 -04:00
parent 38627f6878
commit af025eed53
5 changed files with 159 additions and 46 deletions

View File

@ -12743,7 +12743,7 @@ NULL baz</literallayout>(3 rows)</entry>
<type>double precision</type> for a floating-point argument,
otherwise the same as the argument data type
</entry>
<entry>All types apart from floating-point types</entry>
<entry>Yes</entry>
<entry>the average (arithmetic mean) of all input values</entry>
</row>
@ -13001,7 +13001,7 @@ NULL baz</literallayout>(3 rows)</entry>
<type>bigint</type> arguments, otherwise the same as the
argument data type
</entry>
<entry>All types apart from floating-point types</entry>
<entry>Yes</entry>
<entry>sum of <replaceable class="parameter">expression</replaceable> across all input values</entry>
</row>
@ -13153,7 +13153,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>correlation coefficient</entry>
</row>
@ -13174,7 +13174,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>population covariance</entry>
</row>
@ -13195,7 +13195,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>sample covariance</entry>
</row>
@ -13212,7 +13212,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>average of the independent variable
(<literal>sum(<replaceable class="parameter">X</replaceable>)/<replaceable class="parameter">N</replaceable></literal>)</entry>
</row>
@ -13230,7 +13230,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>average of the dependent variable
(<literal>sum(<replaceable class="parameter">Y</replaceable>)/<replaceable class="parameter">N</replaceable></literal>)</entry>
</row>
@ -13248,7 +13248,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>bigint</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>number of input rows in which both expressions are nonnull</entry>
</row>
@ -13268,7 +13268,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>y-intercept of the least-squares-fit linear equation
determined by the (<replaceable
class="parameter">X</replaceable>, <replaceable
@ -13288,7 +13288,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>square of the correlation coefficient</entry>
</row>
@ -13308,7 +13308,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry>slope of the least-squares-fit linear equation determined
by the (<replaceable class="parameter">X</replaceable>,
<replaceable class="parameter">Y</replaceable>) pairs</entry>
@ -13327,7 +13327,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry><literal>sum(<replaceable
class="parameter">X</replaceable>^2) - sum(<replaceable
class="parameter">X</replaceable>)^2/<replaceable
@ -13348,7 +13348,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry><literal>sum(<replaceable
class="parameter">X</replaceable>*<replaceable
class="parameter">Y</replaceable>) - sum(<replaceable
@ -13372,7 +13372,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<entry>
<type>double precision</type>
</entry>
<entry>No</entry>
<entry>Yes</entry>
<entry><literal>sum(<replaceable
class="parameter">Y</replaceable>^2) - sum(<replaceable
class="parameter">Y</replaceable>)^2/<replaceable
@ -13399,7 +13399,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<type>double precision</type> for floating-point arguments,
otherwise <type>numeric</type>
</entry>
<entry>All types apart from floating-point types</entry>
<entry>Yes</entry>
<entry>historical alias for <function>stddev_samp</function></entry>
</row>
@ -13423,7 +13423,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<type>double precision</type> for floating-point arguments,
otherwise <type>numeric</type>
</entry>
<entry>All types apart from floating-point types</entry>
<entry>Yes</entry>
<entry>population standard deviation of the input values</entry>
</row>
@ -13447,7 +13447,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<type>double precision</type> for floating-point arguments,
otherwise <type>numeric</type>
</entry>
<entry>All types apart from floating-point types</entry>
<entry>Yes</entry>
<entry>sample standard deviation of the input values</entry>
</row>
@ -13467,7 +13467,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<type>double precision</type> for floating-point arguments,
otherwise <type>numeric</type>
</entry>
<entry>All types apart from floating-point types</entry>
<entry>Yes</entry>
<entry>historical alias for <function>var_samp</function></entry>
</row>
@ -13491,7 +13491,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<type>double precision</type> for floating-point arguments,
otherwise <type>numeric</type>
</entry>
<entry>All types apart from floating-point types</entry>
<entry>Yes</entry>
<entry>population variance of the input values (square of the population standard deviation)</entry>
</row>
@ -13515,7 +13515,7 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
<type>double precision</type> for floating-point arguments,
otherwise <type>numeric</type>
</entry>
<entry>All types apart from floating-point types</entry>
<entry>Yes</entry>
<entry>sample variance of the input values (square of the sample standard deviation)</entry>
</row>
</tbody>