Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

Commit fb884d1

Browse files
authored
Merge branch 'main' into dl/map-expressions
2 parents a7c849b + 7b105c5 commit fb884d1

19 files changed

Lines changed: 2283 additions & 142 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If you are using Maven without the BOM, add this to your dependencies:
4949
If you are using Gradle 5.x or later, add this to your dependencies:
5050

5151
```Groovy
52-
implementation platform('com.google.cloud:libraries-bom:26.76.0')
52+
implementation platform('com.google.cloud:libraries-bom:26.77.0')
5353
5454
implementation 'com.google.cloud:google-cloud-firestore'
5555
```

generation_config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
gapic_generator_version: 2.67.0
2-
googleapis_commitish: dd3d17addb94bd4a392a5270795c11a27a1334fc
3-
libraries_bom_version: 26.76.0
2+
googleapis_commitish: 798823426715215eccca4d7e7ee4c814843045d7
3+
libraries_bom_version: 26.77.0
44
libraries:
55
- api_shortname: firestore
66
name_pretty: Cloud Firestore

google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/expressions/AggregateFunction.java

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,111 @@ public static AggregateFunction maximum(Expression expression) {
214214
return new AggregateFunction("maximum", expression);
215215
}
216216

217+
/**
218+
* Creates an aggregation that finds the first value of a field across multiple stage inputs.
219+
*
220+
* @param fieldName The name of the field to find the first value of.
221+
* @return A new {@link AggregateFunction} representing the first aggregation.
222+
*/
223+
@BetaApi
224+
public static AggregateFunction first(String fieldName) {
225+
return new AggregateFunction("first", fieldName);
226+
}
227+
228+
/**
229+
* Creates an aggregation that finds the first value of an expression across multiple stage
230+
* inputs.
231+
*
232+
* @param expression The expression to find the first value of.
233+
* @return A new {@link AggregateFunction} representing the first aggregation.
234+
*/
235+
@BetaApi
236+
public static AggregateFunction first(Expression expression) {
237+
return new AggregateFunction("first", expression);
238+
}
239+
240+
/**
241+
* Creates an aggregation that finds the last value of a field across multiple stage inputs.
242+
*
243+
* @param fieldName The name of the field to find the last value of.
244+
* @return A new {@link AggregateFunction} representing the last aggregation.
245+
*/
246+
@BetaApi
247+
public static AggregateFunction last(String fieldName) {
248+
return new AggregateFunction("last", fieldName);
249+
}
250+
251+
/**
252+
* Creates an aggregation that finds the last value of an expression across multiple stage inputs.
253+
*
254+
* @param expression The expression to find the last value of.
255+
* @return A new {@link AggregateFunction} representing the last aggregation.
256+
*/
257+
@BetaApi
258+
public static AggregateFunction last(Expression expression) {
259+
return new AggregateFunction("last", expression);
260+
}
261+
262+
/**
263+
* Creates an aggregation that collects all values of a field across multiple stage inputs into an
264+
* array.
265+
*
266+
* <p>If the expression resolves to an absent value, it is converted to `null`. The order of
267+
* elements in the output array is not stable and shouldn't be relied upon.
268+
*
269+
* @param fieldName The name of the field to collect values from.
270+
* @return A new {@link AggregateFunction} representing the array_agg aggregation.
271+
*/
272+
@BetaApi
273+
public static AggregateFunction arrayAgg(String fieldName) {
274+
return new AggregateFunction("array_agg", fieldName);
275+
}
276+
277+
/**
278+
* Creates an aggregation that collects all values of an expression across multiple stage inputs
279+
* into an array.
280+
*
281+
* <p>If the expression resolves to an absent value, it is converted to `null`. The order of
282+
* elements in the output array is not stable and shouldn't be relied upon.
283+
*
284+
* @param expression The expression to collect values from.
285+
* @return A new {@link AggregateFunction} representing the array_agg aggregation.
286+
*/
287+
@BetaApi
288+
public static AggregateFunction arrayAgg(Expression expression) {
289+
return new AggregateFunction("array_agg", expression);
290+
}
291+
292+
/**
293+
* Creates an aggregation that collects all distinct values of a field across multiple stage
294+
* inputs into an array.
295+
*
296+
* <p>If the expression resolves to an absent value, it is converted to `null`. The order of
297+
* elements in the output array is not stable and shouldn't be relied upon.
298+
*
299+
* @param fieldName The name of the field to collect values from.
300+
* @return A new {@link AggregateFunction} representing the array_agg_distinct aggregation.
301+
*/
302+
@BetaApi
303+
public static AggregateFunction arrayAggDistinct(String fieldName) {
304+
return new AggregateFunction("array_agg_distinct", fieldName);
305+
}
306+
307+
/**
308+
* Creates an aggregation that collects all distinct values of an expression across multiple stage
309+
* inputs into an array.
310+
*
311+
* <p>If the expression resolves to an absent value, it is converted to `null`. The order of
312+
* elements in the output array is not stable and shouldn't be relied upon.
313+
*
314+
* @param expression The expression to collect values from.
315+
* @return A new {@link AggregateFunction} representing the array_agg_distinct aggregation.
316+
*/
317+
@BetaApi
318+
public static AggregateFunction arrayAggDistinct(Expression expression) {
319+
return new AggregateFunction("array_agg_distinct", expression);
320+
}
321+
217322
/**
218323
* Assigns an alias to this aggregate.
219324
*

0 commit comments

Comments
 (0)