Firestore/pipelines#276
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements the Firestore Pipelines API, introducing a framework for complex, multi-stage data transformations and aggregations. The changes include a comprehensive set of new classes for expressions, aggregate functions, and pipeline stages, as well as integration into the Transaction API and a new usage example. Feedback from the review identifies an unnecessary empty file that should be removed and suggests adding a validation check to the rawStage method to prevent potential runtime errors when handling empty input data.
| @@ -0,0 +1 @@ | |||
|
|
|||
| Pipeline rawStage(Map<String, dynamic> data) { | ||
| return Pipeline._( | ||
| firestore: firestore, | ||
| stages: [..._stages, _RawStage(data)], | ||
| ); | ||
| } |
There was a problem hiding this comment.
The rawStage method does not validate that the data map is non-empty. Passing an empty map will cause a StateError in _stageToProto when accessing data.keys.first. Please add a validation check.
| Pipeline rawStage(Map<String, dynamic> data) { | |
| return Pipeline._( | |
| firestore: firestore, | |
| stages: [..._stages, _RawStage(data)], | |
| ); | |
| } | |
| Pipeline rawStage(Map<String, dynamic> data) { | |
| if (data.isEmpty) { | |
| throw ArgumentError('Raw stage data cannot be empty'); | |
| } | |
| return Pipeline._( | |
| firestore: firestore, | |
| stages: [..._stages, _RawStage(data)], | |
| ); | |
| } |
No description provided.