@@ -12,7 +12,7 @@ where `<agg>` references an [aggregate function](../aggregates/intro.md)
1212optionally structured as a [ field assignment] ( intro.md#field-assignment )
1313having the form:
1414```
15- [ <field> := ] <agg-func> ( [ all | distinct ] <expr> ) [ where <pred> ]
15+ [ <field> := ] <agg-func> ( [ all | distinct ] <expr> ) [ filter ( <pred> ) ]
1616```
1717and ` <grouping> ` is a grouping expression [ field assignment] ( intro.md#field-assignment )
1818having the form:
@@ -33,7 +33,7 @@ to the entire input optionally filtered by `<pred>`.
3333
3434In the first form, the ` aggregate ` operator consumes all of its input,
3535applies one or more aggregate functions ` <agg> ` to each input value
36- optionally filtered by a ` where ` clause and/or organized with the grouping
36+ optionally filtered by a ` filter ` clause and/or organized with the grouping
3737expressions specified after the ` by ` keyword, and at the end of input produces one
3838or more aggregations for each unique set of grouping key values.
3939
@@ -44,10 +44,10 @@ keyword without applying any aggregate functions.
4444The ` aggregate ` keyword is optional since it can be used as a
4545[ shortcut] ( intro.md#shortcuts ) .
4646
47- Each aggregate function ` <agg-func> ` may be optionally followed by a ` where ` clause,
47+ Each aggregate function ` <agg-func> ` may be optionally followed by a ` filter ` clause,
4848which applies a Boolean expression ` <pred> ` that indicates, for each input value,
4949whether to include it in the values operated upon by the aggregate function.
50- ` where ` clauses are analogous
50+ ` filter ` clauses are analogous
5151to the [ ` where ` ] ( where.md ) operator but apply their filter to the input
5252argument stream to the aggregate function.
5353
@@ -152,10 +152,10 @@ set:=union(v) by key:=k | sort
152152
153153---
154154
155- _ Use a ` where ` clause_
155+ _ Use a ` filter ` clause_
156156``` mdtest-spq
157157# spq
158- set:=union(v) where v > 1 by key:=k | sort
158+ set:=union(v) filter ( v > 1) by key:=k | sort
159159# input
160160{k:"foo",v:1}
161161{k:"bar",v:2}
@@ -169,11 +169,11 @@ set:=union(v) where v > 1 by key:=k | sort
169169
170170---
171171
172- _ Use a separate ` where ` clause on each aggregate function_
172+ _ Use a separate ` filter ` clause on each aggregate function_
173173``` mdtest-spq
174174# spq
175- set:=union(v) where v > 1,
176- array:=collect(v) where k=="foo"
175+ set:=union(v) filter ( v > 1) ,
176+ array:=collect(v) filter ( k=="foo")
177177 by key:=k
178178| sort
179179# input
@@ -189,11 +189,11 @@ array:=collect(v) where k=="foo"
189189
190190---
191191
192- _ Results are included for ` by ` groupings that generate null results when ` where `
192+ _ Results are included for ` by ` groupings that generate null results when ` filter `
193193clauses are used inside ` aggregate ` _
194194``` mdtest-spq
195195# spq
196- sum(v) where k=="bar" by key:=k | sort
196+ sum(v) filter ( k=="bar") by key:=k | sort
197197# input
198198{k:"foo",v:1}
199199{k:"bar",v:2}
0 commit comments