Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c02ef30
save work
cherylEnkidu Feb 20, 2026
b65de3a
Fix breaking tests
cherylEnkidu Feb 23, 2026
8a4526f
Fix testSingleLookupScalarSubquery
cherylEnkidu Feb 23, 2026
097cdd5
Fix broken tests
cherylEnkidu Feb 24, 2026
ed82cd4
change syntax for define and return type of as function
cherylEnkidu Feb 24, 2026
7acdb11
add documentation and overload for getField()
cherylEnkidu Feb 24, 2026
d0f184a
change proto
cherylEnkidu Feb 26, 2026
cdb7f8a
chore: generate libraries at Thu Feb 26 19:35:06 UTC 2026
cloud-java-bot Feb 26, 2026
6af735f
format code
cherylEnkidu Feb 26, 2026
2efa8ec
add tests for toArrayExpression
cherylEnkidu Feb 26, 2026
c5bf66c
move the subquery test to independent file
cherylEnkidu Feb 26, 2026
6208313
Add tests for subcollection
cherylEnkidu Feb 26, 2026
e9b2d38
Format code
cherylEnkidu Feb 26, 2026
ef43220
refactor PipelineExpression
cherylEnkidu Feb 27, 2026
f68b095
Address feedbacks
cherylEnkidu Feb 27, 2026
710d015
Improve documentation
cherylEnkidu Feb 27, 2026
0bd670d
change the test
cherylEnkidu Feb 27, 2026
d7b6c69
Test subcollection used within Union stage
cherylEnkidu Mar 3, 2026
ce2b307
replace mapGet with getField
cherylEnkidu Mar 5, 2026
048f664
support subcollection in test
cherylEnkidu Mar 11, 2026
940848b
Merge branch 'main' into cheryl/subquery
cherylEnkidu Mar 11, 2026
36fb820
chore: generate libraries at Wed Mar 11 18:14:28 UTC 2026
cloud-java-bot Mar 11, 2026
63e742f
feat(firestore): Add arraySlice and arrayFilter
milaGGL Mar 18, 2026
06c62f4
Merge branch 'main' into mila/arraySlice-arrayFilter
milaGGL Mar 23, 2026
7daec8e
update tests
milaGGL Mar 24, 2026
b69c5e8
improve error message
cherylEnkidu Mar 24, 2026
11ee929
merge in main
cherylEnkidu Mar 24, 2026
0ea96aa
chore: generate libraries at Tue Mar 24 17:04:45 UTC 2026
cloud-java-bot Mar 24, 2026
913d44f
add decode support
cherylEnkidu Mar 24, 2026
ac994ac
Make the subquery test only run in nightly environment
cherylEnkidu Mar 24, 2026
625207d
Merge remote-tracking branch 'origin/cheryl/subquery' into mila/array…
milaGGL Mar 27, 2026
097ccc1
add arrayTransform
milaGGL Mar 28, 2026
2826e0e
Merge branch 'main' into mila/arraySlice-arrayFilter
milaGGL Mar 30, 2026
bba9eab
format
milaGGL Mar 30, 2026
d360f43
Merge branch 'mila/arraySlice-arrayFilter' of https://github.com/goog…
milaGGL Mar 30, 2026
b52ebd8
Merge branch 'main' into mila/arraySlice-arrayFilter
milaGGL Mar 30, 2026
dca7f0f
Merge branch 'main' into mila/arraySlice-arrayFilter
milaGGL Apr 1, 2026
5885993
update arraySlice function
milaGGL Apr 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2707,6 +2707,196 @@ public static Expression arrayReverse(String arrayFieldName) {
return arrayReverse(field(arrayFieldName));
}

/**
* Filters an array expression based on a predicate.
*
* @param array The expression representing the array to filter.
* @param alias The alias for the current element in the filter expression.
* @param filter The predicate boolean expression used to filter the elements.
* @return A new {@link Expression} representing the filtered array.
*/
@BetaApi
public static Expression arrayFilter(Expression array, String alias, BooleanExpression filter) {
return new FunctionExpression("array_filter", ImmutableList.of(array, constant(alias), filter));
}

/**
* Filters an array field based on a predicate.
*
* @param arrayFieldName The field name of the array to filter.
* @param alias The alias for the current element in the filter expression.
* @param filter The predicate boolean expression used to filter the elements.
* @return A new {@link Expression} representing the filtered array.
*/
@BetaApi
public static Expression arrayFilter(
String arrayFieldName, String alias, BooleanExpression filter) {
return arrayFilter(field(arrayFieldName), alias, filter);
}

/**
* Creates an expression that applies a provided transformation to each element in an array.
*
* @param array The expression representing the array to transform.
* @param elementAlias The alias for the current element in the transform expression.
* @param transform The expression used to transform the elements.
* @return A new {@link Expression} representing the transformed array.
*/
@BetaApi
public static Expression arrayTransform(
Expression array, String elementAlias, Expression transform) {
return new FunctionExpression(
"array_transform", ImmutableList.of(array, constant(elementAlias), transform));
}

/**
* Creates an expression that applies a provided transformation to each element in an array.
*
* @param arrayFieldName The field name of the array to transform.
* @param elementAlias The alias for the current element in the transform expression.
* @param transform The expression used to transform the elements.
* @return A new {@link Expression} representing the transformed array.
*/
@BetaApi
public static Expression arrayTransform(
String arrayFieldName, String elementAlias, Expression transform) {
return arrayTransform(field(arrayFieldName), elementAlias, transform);
}

/**
* Creates an expression that applies a provided transformation to each element in an array,
* providing the element's index to the transformation expression.
*
* @param array The expression representing the array to transform.
* @param elementAlias The alias for the current element in the transform expression.
* @param indexAlias The alias for the current index.
* @param transform The expression used to transform the elements.
* @return A new {@link Expression} representing the transformed array.
*/
@BetaApi
public static Expression arrayTransformWithIndex(
Expression array, String elementAlias, String indexAlias, Expression transform) {
return new FunctionExpression(
"array_transform",
ImmutableList.of(array, constant(elementAlias), constant(indexAlias), transform));
}

/**
* Creates an expression that applies a provided transformation to each element in an array,
* providing the element's index to the transformation expression.
*
* @param arrayFieldName The field name of the array to transform.
* @param elementAlias The alias for the current element in the transform expression.
* @param indexAlias The alias for the current index.
* @param transform The expression used to transform the elements.
* @return A new {@link Expression} representing the transformed array.
*/
@BetaApi
public static Expression arrayTransformWithIndex(
String arrayFieldName, String elementAlias, String indexAlias, Expression transform) {
return arrayTransformWithIndex(field(arrayFieldName), elementAlias, indexAlias, transform);
}

/**
* Creates an expression that returns a slice of an array.
*
* @param array The expression representing the array to slice.
* @param offset The starting index.
* @param length The number of elements to return.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public static Expression arraySlice(Expression array, Expression offset, Expression length) {
return new FunctionExpression("array_slice", ImmutableList.of(array, offset, length));
}

/**
* Creates an expression that returns a slice of an array.
*
* @param array The expression representing the array to slice.
* @param offset The starting index.
* @param length The number of elements to return.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public static Expression arraySlice(Expression array, int offset, int length) {
return arraySlice(array, constant(offset), constant(length));
}

/**
* Creates an expression that returns a slice of an array.
*
* @param arrayFieldName The field name of the array to slice.
* @param offset The starting index.
* @param length The number of elements to return.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public static Expression arraySlice(String arrayFieldName, int offset, int length) {
return arraySlice(field(arrayFieldName), constant(offset), constant(length));
}

/**
* Creates an expression that returns a slice of an array.
*
* @param arrayFieldName The field name of the array to slice.
* @param offset The starting index.
* @param length The number of elements to return.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public static Expression arraySlice(String arrayFieldName, Expression offset, Expression length) {
return arraySlice(field(arrayFieldName), offset, length);
}

/**
* Creates an expression that returns a slice of an array to its end.
*
* @param array The expression representing the array to slice.
* @param offset The expression representing the starting index.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public static Expression arraySliceToEnd(Expression array, Expression offset) {
return new FunctionExpression("array_slice", ImmutableList.of(array, offset));
}

/**
* Creates an expression that returns a slice of an array to its end.
*
* @param array The expression representing the array to slice.
* @param offset The starting index.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public static Expression arraySliceToEnd(Expression array, int offset) {
return arraySliceToEnd(array, constant(offset));
}

/**
* Creates an expression that returns a slice of an array to its end.
*
* @param arrayFieldName The field name of the array to slice.
* @param offset The starting index.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public static Expression arraySliceToEnd(String arrayFieldName, int offset) {
return arraySliceToEnd(field(arrayFieldName), constant(offset));
}

/**
* Creates an expression that returns a slice of an array to its end.
*
* @param arrayFieldName The field name of the array to slice.
* @param offset The expression representing the starting index.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public static Expression arraySliceToEnd(String arrayFieldName, Expression offset) {
return arraySliceToEnd(field(arrayFieldName), offset);
}

/**
* Creates an expression that checks if an array contains a specified element.
*
Expand Down Expand Up @@ -6583,6 +6773,91 @@ public final Expression arrayReverse() {
return arrayReverse(this);
}

/**
* Filters this array based on a predicate.
*
* @param alias The alias for the current element in the filter expression.
* @param filter The predicate boolean expression used to filter the elements.
* @return A new {@link Expression} representing the filtered array.
*/
@BetaApi
public final Expression arrayFilter(String alias, BooleanExpression filter) {
return arrayFilter(this, alias, filter);
}

/**
* Creates an expression that applies a provided transformation to each element in an array.
*
* @param elementAlias The alias for the current element in the transform expression.
* @param transform The expression used to transform the elements.
* @return A new {@link Expression} representing the transformed array.
*/
@BetaApi
public final Expression arrayTransform(String elementAlias, Expression transform) {
return arrayTransform(this, elementAlias, transform);
}

/**
* Creates an expression that applies a provided transformation to each element in an array,
* providing the element's index to the transformation expression.
*
* @param elementAlias The alias for the current element in the transform expression.
* @param indexAlias The alias for the current index.
* @param transform The expression used to transform the elements.
* @return A new {@link Expression} representing the transformed array.
*/
@BetaApi
public final Expression arrayTransformWithIndex(
String elementAlias, String indexAlias, Expression transform) {
return arrayTransformWithIndex(this, elementAlias, indexAlias, transform);
}

/**
* Returns a slice of this array.
*
* @param offset The starting index.
* @param length The number of elements to return.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public final Expression arraySlice(int offset, int length) {
return arraySlice(this, offset, length);
}

/**
* Returns a slice of this array.
*
* @param offset The starting index expressed as an Expression.
* @param length The number of elements to return expressed as an Expression.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public final Expression arraySlice(Expression offset, Expression length) {
return arraySlice(this, offset, length);
}

/**
* Returns a slice of this array to its end.
*
* @param offset The starting index.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public final Expression arraySliceToEnd(int offset) {
return arraySliceToEnd(this, offset);
}

/**
* Returns a slice of this array to its end.
*
* @param offset The starting index expressed as an Expression.
* @return A new {@link Expression} representing the array slice.
*/
@BetaApi
public final Expression arraySliceToEnd(Expression offset) {
return arraySliceToEnd(this, offset);
}

/**
* Creates an expression that checks if array contains a specific {@code element}.
*
Expand Down
Loading
Loading