Repository navigation
feat(firestore): add DML stages, literals source, and atomic execution option to Android SDK pipelines - #8524
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
|
The public api surface has changed for the subproject firebase-firestore: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
|
The public api surface has changed for the subproject firebase-firestore: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
1 similar comment
|
The public api surface has changed for the subproject firebase-firestore: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
|
The public api surface has changed for the subproject firebase-firestore: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
1 similar comment
|
The public api surface has changed for the subproject firebase-firestore: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
|
The public api surface has changed for the subproject firebase-firestore: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
46c5156 to
7661b92
Compare
|
The public api surface has changed for the subproject firebase-firestore: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
1 similar comment
|
The public api surface has changed for the subproject firebase-firestore: Please update the api.txt files for the subprojects being affected by this change by running ./gradlew ${subproject}:generateApiTxtFile. Also perform a major/minor bump accordingly. |
7661b92 to
3e65b9b
Compare
…erals source, and atomic execution option to Android SDK pipelines - Implement DeleteStage, UpdateStage, InsertStage, UpsertStage, and LiteralsSource in stage.kt - Add literals() source method to PipelineSource and delete(), update(), insert(), upsert() to Pipeline in Pipeline.kt - Add withAtomic() execution option to ExecuteOptions and wire proto request (newTransaction + autoCommitTransaction) - Add DmlTests.kt unit test suite verifying proto generation for all stages - Add integration test methods in PipelineTest.java BUG=b/545136695 TAG=agy
…quest and add serialization tests - Add bool auto_commit_transaction = 9 to firestore.proto - Serialize autoCommitTransaction = true when options.hasAtomic() is enabled - Add unit tests verifying autoCommitTransaction is set for atomic and omitted for non-atomic - Refine expression aliases and UserDataReader literal map encoding in Pipeline stages BUG=b/545234002 TAG=agy
…r cross-platform alignment
…arameters and use additionalFields array
…llability, and exclude atomic from options - In Pipeline.kt, allow nullable Timestamp? in PipelineResultObserver.onComplete and default to Timestamp.now() in ObserverSnapshotTask to prevent NPE and timeout on DML streams. - Filter out 'atomic' from StructuredPipeline.options to avoid INVALID_ARGUMENT: Unsupported option: atomic. - In stage.kt, always encode 1 MapValue argument in UpsertStage matching UpdateStage and backend expectations. - Remove erroneous reserved checks in RemoveFieldsStage that prevented removing document ID (__name__). - Remove unrequested update(List<Selectable>) overload from Pipeline.kt. - Regenerate api.txt with generateApiTxtFile and add unit test assertions.
3e65b9b to
6767828
Compare
## Changes
- Expressions nested in map/list values in `literals()` are now
evaluated (the backend used to reject them as `FUNCTION_VALUE`).
- FieldValue sentinels in `literals()` fail with an error naming
`literals()` and the field path.
- Empty field names in maps inside literal lists are left to the
backend.
- `insert`/`upsert` use explicit overloads taking a String path or
`CollectionReference`; the insert collection is optional.
- Removed the List overloads `upsert(List)`, `literals(List)`,
`documents(List)` and `documentsByPath(List)`.
- Removed `Expression.as()`, an undocumented duplicate of `alias()`.
- KDoc for the DML stages, `literals`, `withAtomic` and `documents`
## API Change Decisions
No released stage method takes a List of inputs (List parameters only
appear for values, like `array()`), so the List overloads are gone and
`update(List)` wasn't added. Callers can spread a list.
The released Pipeline API has no default arguments or nullable stage
parameters, and takes collections by path or reference
(`PipelineSource.collection`). The new overloads follow that:
- `insert()`, `insert(String)`, `insert(CollectionReference)`,
`insert(Expression)`, `insert(String, Expression)`,
`insert(CollectionReference, Expression)`
- `upsert(vararg Selectable)`, `upsert(String)`,
`upsert(CollectionReference)`, `upsert(String, Expression)`,
`upsert(CollectionReference, Expression)`
A target upsert no longer takes extra fields, because an array parameter
breaks the vararg convention and a trailing vararg would collide with
`(String, Expression)`; use `addFields(...).upsert(collection, id)`.
There's no `upsert(Expression)`: `Field` is both an `Expression` and a
`Selectable`, so `upsert(field("x"))` would pick the ID overload. A
reference from another Firestore instance gets the
`PipelineSource.collection` error.
Summary
Adds full DML stages (Delete, Update, Insert, Upsert), Literals source, and atomic execution option to the Android SDK (
firebase-android-sdk) Firestore Pipelines subsystem to achieve parity with Web and Node SDKs.Key Changes
stage.kt: AddedDeleteStage,UpdateStage,InsertStage,UpsertStage, andLiteralsSource.options.kt: AddedhasAtomic()helper method toInternalOptions.Pipeline.kt:withAtomic(atomic: Boolean)method toExecuteOptions.toExecutePipelineRequestto configurenewTransaction(readWrite) andautoCommitTransaction = truewhenatomicis enabled.literals(vararg data: Map<String, Any?>)source builder method toPipelineSource.delete(),update(...),insert(...), andupsert(...)stage builder methods toPipeline.DmlTests.ktverifying proto generation and options encoding for all stages.PipelineTest.java.Buganizer Ticket
Fixes http://b/545136695 (under umbrella http://b/500350942)