Skip to content

Commit a62c01a

Browse files
committed
1. Add code samples to comments
2. Updated Null/Nan semantics for online execution 3. Validate for duplicated aliases 4. Add new functions
1 parent 07892d9 commit a62c01a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+7491
-3553
lines changed

firebase-firestore/api.txt

Lines changed: 806 additions & 771 deletions
Large diffs are not rendered by default.

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/AggregationTest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,8 @@ public void testCannotPerformMoreThanMaxAggregations() {
400400

401401
assertThat(e, instanceOf(FirebaseFirestoreException.class));
402402
FirebaseFirestoreException firestoreException = (FirebaseFirestoreException) e;
403-
if (isRunningAgainstEmulator()) {
404-
assertEquals(FirebaseFirestoreException.Code.UNKNOWN, firestoreException.getCode());
405-
} else {
406-
assertEquals(FirebaseFirestoreException.Code.INVALID_ARGUMENT, firestoreException.getCode());
407-
assertTrue(firestoreException.getMessage().contains("maximum number of aggregations"));
408-
}
403+
assertEquals(FirebaseFirestoreException.Code.INVALID_ARGUMENT, firestoreException.getCode());
404+
assertTrue(firestoreException.getMessage().contains("maximum number of aggregations"));
409405
}
410406

411407
@Test

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/PipelineTest.java

Lines changed: 933 additions & 206 deletions
Large diffs are not rendered by default.

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/QueryToPipelineTest.java

Lines changed: 41 additions & 49 deletions
Large diffs are not rendered by default.

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/RealtimePipelineTest.kt

Lines changed: 116 additions & 104 deletions
Large diffs are not rendered by default.

firebase-firestore/src/androidTest/java/com/google/firebase/firestore/testutil/IntegrationTestUtil.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
import com.google.firebase.firestore.FirebaseFirestoreSettings;
3939
import com.google.firebase.firestore.ListenerRegistration;
4040
import com.google.firebase.firestore.MetadataChanges;
41+
import com.google.firebase.firestore.Pipeline;
4142
import com.google.firebase.firestore.PipelineResult;
42-
import com.google.firebase.firestore.PipelineSnapshot;
4343
import com.google.firebase.firestore.Query;
4444
import com.google.firebase.firestore.QuerySnapshot;
4545
import com.google.firebase.firestore.Source;
@@ -468,7 +468,7 @@ public static List<Map<String, Object>> querySnapshotToValues(QuerySnapshot quer
468468
}
469469

470470
public static List<Map<String, Object>> pipelineSnapshotToValues(
471-
PipelineSnapshot pipelineSnapshot) {
471+
Pipeline.Snapshot pipelineSnapshot) {
472472
List<Map<String, Object>> res = new ArrayList<>();
473473
for (PipelineResult result : pipelineSnapshot) {
474474
res.add(result.getData());
@@ -484,7 +484,7 @@ public static List<String> querySnapshotToIds(QuerySnapshot querySnapshot) {
484484
return res;
485485
}
486486

487-
public static List<String> pipelineSnapshotToIds(PipelineSnapshot pipelineResults) {
487+
public static List<String> pipelineSnapshotToIds(Pipeline.Snapshot pipelineResults) {
488488
List<String> res = new ArrayList<>();
489489
for (PipelineResult result : pipelineResults) {
490490
DocumentReference ref = result.getRef();
@@ -597,7 +597,7 @@ public static void checkQueryAndPipelineResultsMatch(Query query, String... expe
597597
} catch (Exception e) {
598598
throw new RuntimeException("Classic Query FAILED", e);
599599
}
600-
PipelineSnapshot docsFromPipeline;
600+
Pipeline.Snapshot docsFromPipeline;
601601
try {
602602
docsFromPipeline = waitFor(query.getFirestore().pipeline().createFrom(query).execute());
603603
} catch (Exception e) {

firebase-firestore/src/main/java/com/google/firebase/firestore/AggregateField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
package com.google.firebase.firestore;
1616

17-
import static com.google.firebase.firestore.pipeline.Expr.field;
17+
import static com.google.firebase.firestore.pipeline.Expression.field;
1818

1919
import androidx.annotation.NonNull;
2020
import androidx.annotation.Nullable;
@@ -232,7 +232,7 @@ private AverageAggregateField(@NonNull FieldPath fieldPath) {
232232
@NonNull
233233
@Override
234234
AliasedAggregate toPipeline() {
235-
return field(getFieldPath()).avg().alias(getAlias());
235+
return field(getFieldPath()).average().alias(getAlias());
236236
}
237237
}
238238
}

firebase-firestore/src/main/java/com/google/firebase/firestore/FirebaseFirestore.java

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -885,13 +885,33 @@ static void setClientLanguage(@NonNull String languageToken) {
885885
}
886886

887887
/**
888-
* Builds a new Pipeline from this Firestore instance.
889-
*
890-
* NOTE: Pipeline does not have realtime updates support and SDK cache access, it completely relies
891-
* on the connection to the server for the results, and does not augment the results with the SDK
892-
* cache. To get realtime updates and SDK cache access use {@code realTimePipeline()} instead.
893-
*
894-
* @return {@code PipelineSource} for this Firestore instance.
888+
* Creates a new {@link PipelineSource} to build and execute a data pipeline.
889+
*
890+
* <p>A pipeline is composed of a sequence of stages. Each stage processes the
891+
* output from the previous one, and the final stage's output is the result of the
892+
* pipeline's execution.
893+
*
894+
* <p><b>Example usage:</b>
895+
* <pre>{@code
896+
* Pipeline pipeline = firestore.pipeline()
897+
* .collection("books")
898+
* .where(Field("rating").isGreaterThan(4.5))
899+
* .sort(Field("rating").descending())
900+
* .limit(2);
901+
* }</pre>
902+
*
903+
* <p><b>Note on Execution:</b> The stages are conceptual. The Firestore backend may
904+
* optimize execution (e.g., reordering or merging stages) as long as the
905+
* final result remains the same.
906+
*
907+
* <p><b>Important Limitations:</b>
908+
* <ul>
909+
* <li>Pipelines operate on a <b>request/response basis only</b>.
910+
* <li>They do <b>not</b> utilize or update the local SDK cache.
911+
* <li>They do <b>not</b> support realtime snapshot listeners.
912+
* </ul>
913+
*
914+
* @return A {@code PipelineSource} to begin defining the pipeline's stages.
895915
*/
896916
@NonNull
897917
public PipelineSource pipeline() {

0 commit comments

Comments
 (0)