You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
This PR implements the Query Pipeline Subquery API in the Android SDK,
enabling complex data retrieval patterns including joins, aggregations
on related collections, and value binding.
## New API
### Pipeline
- **`define(aliasedExpression: AliasedExpression, ...)`**: Defines one
or more variables in the pipeline's scope for internal reuse.
- **`define(stage: DefineStage)`**: Overload for defining variables
using a `DefineStage` object.
- **`toScalarExpression()`**: Converts the pipeline into an expression
that evaluates to a single scalar result.
- **`toArrayExpression()`**: Converts the pipeline into an expression
that evaluates to an array of results.
- **[subcollection(path:
String)](cci:1://file:///Users/cheryllin/Desktop/firebase-sdk/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Pipeline.kt:1132:4-1151:5)**:
Initializes a pipeline scoped to a subcollection for use in subqueries.
- **[subcollection(source:
SubcollectionSource)](cci:1://file:///Users/cheryllin/Desktop/firebase-sdk/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/Pipeline.kt:1132:4-1151:5)**:
Overload for creating subcollection pipelines with a specific source.
### Expression
- **[variable(name:
String)](cci:1://file:///Users/cheryllin/Desktop/firebase-sdk/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/pipeline/expressions.kt:5332:4-5346:70)**:
Creates an expression that refers to a variable defined in the pipeline
scope.
-
**[currentDocument()](cci:1://file:///Users/cheryllin/Desktop/firebase-sdk/firebase-android-sdk/firebase-firestore/src/main/java/com/google/firebase/firestore/pipeline/expressions.kt:5348:4-5363:94)**:
Creates an expression that refers to the current document being
processed.
## Implementation Details
- `toScalarExpression` and `toArrayExpression` handle the execution of
sub-pipelines and format the results based on the output structure
(unwrapping single fields or returning maps for multiple fields).
- Validations are added to ensure relative subcollection pipelines are
used correctly within a parent context.
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
method public final com.google.firebase.firestore.pipeline.Expression floor();
1034
1046
method public static final com.google.firebase.firestore.pipeline.Expression floor(com.google.firebase.firestore.pipeline.Expression numericExpr);
1035
1047
method public static final com.google.firebase.firestore.pipeline.Expression floor(String numericField);
1048
+
method public final com.google.firebase.firestore.pipeline.Expression getField(com.google.firebase.firestore.pipeline.Expression keyExpression);
1049
+
method public static final com.google.firebase.firestore.pipeline.Expression getField(com.google.firebase.firestore.pipeline.Expression expression, com.google.firebase.firestore.pipeline.Expression keyExpression);
1050
+
method public static final com.google.firebase.firestore.pipeline.Expression getField(com.google.firebase.firestore.pipeline.Expression expression, String key);
1051
+
method public final com.google.firebase.firestore.pipeline.Expression getField(String key);
1052
+
method public static final com.google.firebase.firestore.pipeline.Expression getField(String fieldName, com.google.firebase.firestore.pipeline.Expression keyExpression);
1053
+
method public static final com.google.firebase.firestore.pipeline.Expression getField(String fieldName, String key);
1036
1054
method public final com.google.firebase.firestore.pipeline.BooleanExpression greaterThan(com.google.firebase.firestore.pipeline.Expression other);
1037
1055
method public static final com.google.firebase.firestore.pipeline.BooleanExpression greaterThan(com.google.firebase.firestore.pipeline.Expression left, com.google.firebase.firestore.pipeline.Expression right);
1038
1056
method public static final com.google.firebase.firestore.pipeline.BooleanExpression greaterThan(com.google.firebase.firestore.pipeline.Expression left, Object right);
method public final com.google.firebase.firestore.pipeline.Expression unixSecondsToTimestamp();
1305
1323
method public static final com.google.firebase.firestore.pipeline.Expression unixSecondsToTimestamp(com.google.firebase.firestore.pipeline.Expression expr);
1306
1324
method public static final com.google.firebase.firestore.pipeline.Expression unixSecondsToTimestamp(String fieldName);
1325
+
method public static final com.google.firebase.firestore.pipeline.Expression variable(String name);
1307
1326
method public static final com.google.firebase.firestore.pipeline.Expression vector(com.google.firebase.firestore.VectorValue vector);
1308
1327
method public static final com.google.firebase.firestore.pipeline.Expression vector(double[] vector);
1309
1328
method public final com.google.firebase.firestore.pipeline.Expression vectorLength();
method public final T withOption(String key, long value);
1774
1799
}
1775
1800
1801
+
public final class SubcollectionSource extends com.google.firebase.firestore.pipeline.Stage<com.google.firebase.firestore.pipeline.SubcollectionSource> {
1802
+
method public static com.google.firebase.firestore.pipeline.SubcollectionSource of(String path);
1803
+
field public static final com.google.firebase.firestore.pipeline.SubcollectionSource.Companion Companion;
1804
+
}
1805
+
1806
+
public static final class SubcollectionSource.Companion {
1807
+
method public com.google.firebase.firestore.pipeline.SubcollectionSource of(String path);
1808
+
}
1809
+
1776
1810
public final class UnnestOptions extends com.google.firebase.firestore.pipeline.AbstractOptions<com.google.firebase.firestore.pipeline.UnnestOptions> {
1777
1811
ctor public UnnestOptions();
1778
1812
method public com.google.firebase.firestore.pipeline.UnnestOptions withIndexField(String indexField);
0 commit comments