@@ -163,10 +163,58 @@ message AggregationQuery {
163163 [(google.api.field_behavior ) = OPTIONAL ];
164164 }
165165
166+ // Sum of the values of the requested property.
167+ //
168+ // * Only numeric values will be aggregated. All non-numeric values
169+ // including `NULL` are skipped.
170+ //
171+ // * If the aggregated values contain `NaN`, returns `NaN`. Infinity math
172+ // follows IEEE-754 standards.
173+ //
174+ // * If the aggregated value set is empty, returns 0.
175+ //
176+ // * Returns a 64-bit integer if all aggregated numbers are integers and the
177+ // sum result does not overflow. Otherwise, the result is returned as a
178+ // double. Note that even if all the aggregated values are integers, the
179+ // result is returned as a double if it cannot fit within a 64-bit signed
180+ // integer. When this occurs, the returned value will lose precision.
181+ //
182+ // * When underflow occurs, floating-point aggregation is non-deterministic.
183+ // This means that running the same query repeatedly without any changes to
184+ // the underlying values could produce slightly different results each
185+ // time. In those cases, values should be stored as integers over
186+ // floating-point numbers.
187+ message Sum {
188+ // The property to aggregate on.
189+ PropertyReference property = 1 ;
190+ }
191+
192+ // Average of the values of the requested property.
193+ //
194+ // * Only numeric values will be aggregated. All non-numeric values
195+ // including `NULL` are skipped.
196+ //
197+ // * If the aggregated values contain `NaN`, returns `NaN`. Infinity math
198+ // follows IEEE-754 standards.
199+ //
200+ // * If the aggregated value set is empty, returns `NULL`.
201+ //
202+ // * Always returns the result as a double.
203+ message Avg {
204+ // The property to aggregate on.
205+ PropertyReference property = 1 ;
206+ }
207+
166208 // The type of aggregation to perform, required.
167209 oneof operator {
168210 // Count aggregator.
169211 Count count = 1 ;
212+
213+ // Sum aggregator.
214+ Sum sum = 2 ;
215+
216+ // Average aggregator.
217+ Avg avg = 3 ;
170218 }
171219
172220 // Optional. Optional name of the property to store the result of the
@@ -342,8 +390,9 @@ message PropertyFilter {
342390 //
343391 // Requires:
344392 //
345- // * That `value` is a non-empty `ArrayValue` with at most 10 values.
346- // * No other `IN` or `NOT_IN` is in the same query.
393+ // * That `value` is a non-empty `ArrayValue`, subject to disjunction
394+ // limits.
395+ // * No `NOT_IN` is in the same query.
347396 IN = 6 ;
348397
349398 // The given `property` is not equal to the given `value`.
@@ -359,15 +408,15 @@ message PropertyFilter {
359408 // Requires:
360409 //
361410 // * That `value` is an entity key.
362- // * No other `HAS_ANCESTOR` is in the same query .
411+ // * All evaluated disjunctions must have the same `HAS_ANCESTOR` filter .
363412 HAS_ANCESTOR = 11 ;
364413
365414 // The value of the `property` is not in the given array.
366415 //
367416 // Requires:
368417 //
369418 // * That `value` is a non-empty `ArrayValue` with at most 10 values.
370- // * No other `IN`, `NOT_IN`, `NOT_EQUAL` is in the same query.
419+ // * No other `OR`, ` IN`, `NOT_IN`, `NOT_EQUAL` is in the same query.
371420 // * That `field` comes first in the `order_by`.
372421 NOT_IN = 13 ;
373422 }
0 commit comments