@@ -32,6 +32,11 @@ AVG(numeric_field) <1>
3232include-tagged::{sql-specs}/docs/docs.csv-spec[aggAvg]
3333--------------------------------------------------
3434
35+ ["source","sql",subs="attributes,macros"]
36+ --------------------------------------------------
37+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggAvgScalars]
38+ --------------------------------------------------
39+
3540[[sql-functions-aggs-count]]
3641==== `COUNT`
3742
@@ -82,6 +87,10 @@ COUNT(ALL field_name) <1>
8287include-tagged::{sql-specs}/docs/docs.csv-spec[aggCountAll]
8388--------------------------------------------------
8489
90+ ["source","sql",subs="attributes,macros"]
91+ --------------------------------------------------
92+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggCountAllScalars]
93+ --------------------------------------------------
8594
8695[[sql-functions-aggs-count-distinct]]
8796==== `COUNT(DISTINCT)`
@@ -105,6 +114,11 @@ COUNT(DISTINCT field_name) <1>
105114include-tagged::{sql-specs}/docs/docs.csv-spec[aggCountDistinct]
106115--------------------------------------------------
107116
117+ ["source","sql",subs="attributes,macros"]
118+ --------------------------------------------------
119+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggCountDistinctScalars]
120+ --------------------------------------------------
121+
108122[[sql-functions-aggs-first]]
109123==== `FIRST/FIRST_VALUE`
110124
@@ -194,6 +208,11 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[firstWithTwoArgsAndGroupBy]
194208include-tagged::{sql-specs}/docs/docs.csv-spec[firstValueWithTwoArgsAndGroupBy]
195209--------------------------------------------------------------------------
196210
211+ ["source","sql",subs="attributes,macros"]
212+ --------------------------------------------------------------------------
213+ include-tagged::{sql-specs}/docs/docs.csv-spec[firstValueWithTwoArgsAndGroupByScalars]
214+ --------------------------------------------------------------------------
215+
197216[NOTE]
198217`FIRST` cannot be used in a HAVING clause.
199218[NOTE]
@@ -289,6 +308,11 @@ include-tagged::{sql-specs}/docs/docs.csv-spec[lastWithTwoArgsAndGroupBy]
289308include-tagged::{sql-specs}/docs/docs.csv-spec[lastValueWithTwoArgsAndGroupBy]
290309-------------------------------------------------------------------------
291310
311+ ["source","sql",subs="attributes,macros"]
312+ -------------------------------------------------------------------------
313+ include-tagged::{sql-specs}/docs/docs.csv-spec[lastValueWithTwoArgsAndGroupByScalars]
314+ -------------------------------------------------------------------------
315+
292316[NOTE]
293317`LAST` cannot be used in `HAVING` clause.
294318[NOTE]
@@ -317,6 +341,11 @@ MAX(field_name) <1>
317341include-tagged::{sql-specs}/docs/docs.csv-spec[aggMax]
318342--------------------------------------------------
319343
344+ ["source","sql",subs="attributes,macros"]
345+ --------------------------------------------------
346+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggMaxScalars]
347+ --------------------------------------------------
348+
320349[NOTE]
321350`MAX` on a field of type <<text, `text`>> or <<keyword, `keyword`>> is translated into
322351<<sql-functions-aggs-last>> and therefore, it cannot be used in `HAVING` clause.
@@ -369,6 +398,11 @@ SUM(field_name) <1>
369398include-tagged::{sql-specs}/docs/docs.csv-spec[aggSum]
370399--------------------------------------------------
371400
401+ ["source","sql",subs="attributes,macros"]
402+ --------------------------------------------------
403+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggSumScalars]
404+ --------------------------------------------------
405+
372406[[sql-functions-aggs-statistics]]
373407[float]
374408=== Statistics
@@ -397,6 +431,16 @@ https://en.wikipedia.org/wiki/Kurtosis[Quantify] the shape of the distribution o
397431include-tagged::{sql-specs}/docs/docs.csv-spec[aggKurtosis]
398432--------------------------------------------------
399433
434+ [NOTE]
435+ ====
436+ `KURTOSIS` cannot be used on top of scalar functions or operators but only directly on a field. So, for example,
437+ the following is not allowed and an error is returned:
438+ [source, sql]
439+ ---------------------------------------
440+ SELECT KURTOSIS(salary / 12.0), gender FROM emp GROUP BY gender
441+ ---------------------------------------
442+ ====
443+
400444[[sql-functions-aggs-mad]]
401445==== `MAD`
402446
@@ -421,6 +465,11 @@ https://en.wikipedia.org/wiki/Median_absolute_deviation[Measure] the variability
421465include-tagged::{sql-specs}/docs/docs.csv-spec[aggMad]
422466--------------------------------------------------
423467
468+ ["source","sql",subs="attributes,macros"]
469+ --------------------------------------------------
470+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggMadScalars]
471+ --------------------------------------------------
472+
424473[[sql-functions-aggs-percentile]]
425474==== `PERCENTILE`
426475
@@ -449,6 +498,11 @@ of input values in the field `field_name`.
449498include-tagged::{sql-specs}/docs/docs.csv-spec[aggPercentile]
450499--------------------------------------------------
451500
501+ ["source","sql",subs="attributes,macros"]
502+ --------------------------------------------------
503+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggPercentileScalars]
504+ --------------------------------------------------
505+
452506[[sql-functions-aggs-percentile-rank]]
453507==== `PERCENTILE_RANK`
454508
@@ -477,6 +531,11 @@ of input values in the field `field_name`.
477531include-tagged::{sql-specs}/docs/docs.csv-spec[aggPercentileRank]
478532--------------------------------------------------
479533
534+ ["source","sql",subs="attributes,macros"]
535+ --------------------------------------------------
536+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggPercentileRankScalars]
537+ --------------------------------------------------
538+
480539[[sql-functions-aggs-skewness]]
481540==== `SKEWNESS`
482541
@@ -501,6 +560,16 @@ https://en.wikipedia.org/wiki/Skewness[Quantify] the asymmetric distribution of
501560include-tagged::{sql-specs}/docs/docs.csv-spec[aggSkewness]
502561--------------------------------------------------
503562
563+ [NOTE]
564+ ====
565+ `SKEWNESS` cannot be used on top of scalar functions but only directly on a field. So, for example, the following is
566+ not allowed and an error is returned:
567+ [source, sql]
568+ ---------------------------------------
569+ SELECT SKEWNESS(ROUND(salary / 12.0, 2), gender FROM emp GROUP BY gender
570+ ---------------------------------------
571+ ====
572+
504573[[sql-functions-aggs-stddev-pop]]
505574==== `STDDEV_POP`
506575
@@ -525,6 +594,11 @@ Returns the https://en.wikipedia.org/wiki/Standard_deviations[population standar
525594include-tagged::{sql-specs}/docs/docs.csv-spec[aggStddevPop]
526595--------------------------------------------------
527596
597+ ["source","sql",subs="attributes,macros"]
598+ --------------------------------------------------
599+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggStddevPopScalars]
600+ --------------------------------------------------
601+
528602[[sql-functions-aggs-sum-squares]]
529603==== `SUM_OF_SQUARES`
530604
@@ -549,6 +623,11 @@ Returns the https://en.wikipedia.org/wiki/Total_sum_of_squares[sum of squares] o
549623include-tagged::{sql-specs}/docs/docs.csv-spec[aggSumOfSquares]
550624--------------------------------------------------
551625
626+ ["source","sql",subs="attributes,macros"]
627+ --------------------------------------------------
628+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggSumOfSquaresScalars]
629+ --------------------------------------------------
630+
552631[[sql-functions-aggs-var-pop]]
553632==== `VAR_POP`
554633
@@ -572,3 +651,9 @@ Returns the https://en.wikipedia.org/wiki/Variance[population variance] of input
572651--------------------------------------------------
573652include-tagged::{sql-specs}/docs/docs.csv-spec[aggVarPop]
574653--------------------------------------------------
654+
655+
656+ ["source","sql",subs="attributes,macros"]
657+ --------------------------------------------------
658+ include-tagged::{sql-specs}/docs/docs.csv-spec[aggVarPopScalars]
659+ --------------------------------------------------
0 commit comments