-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[realppl 6] offline ppl evaluation and tests #14852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either
Customization To customize 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 is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback. |
Generated by 🚫 Danger |
18f7d5c
to
f3752fa
Compare
3e452b5
to
1fe6a33
Compare
f3752fa
to
655d8cd
Compare
1fe6a33
to
e6ecc47
Compare
aea7b2d
to
06aaef3
Compare
e6ecc47
to
3f5c55e
Compare
06aaef3
to
8efed9e
Compare
6c0a698
to
9051e4f
Compare
8efed9e
to
7c0150f
Compare
9051e4f
to
e67b0ac
Compare
4e3240d
to
9706f02
Compare
e67b0ac
to
569cc6f
Compare
9706f02
to
edf7e9a
Compare
569cc6f
to
6add223
Compare
edf7e9a
to
cb6e366
Compare
6add223
to
9b9e2d9
Compare
cb6e366
to
3abafda
Compare
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements offline pipeline evaluation functionality and comprehensive testing for the Firestore C++ SDK. The changes enable data pipeline processing without requiring an active network connection, along with extensive test coverage for various pipeline scenarios.
- Adds utility functions for creating array and map values from vectors and pairs to support testing
- Implements comprehensive pipeline tests covering where, sort, limit, and various data semantics
- Introduces shared utilities for pipeline test execution and validation
Reviewed Changes
Copilot reviewed 29 out of 30 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
Firestore/core/test/unit/testutil/testutil.h |
Adds function declarations for ArrayFromVector and MapFromPairs |
Firestore/core/test/unit/testutil/testutil.cc |
Implements helper functions to create arrays and maps from C++ containers |
Firestore/core/test/unit/core/pipeline/where_test.cc |
Comprehensive where clause filtering tests with logical operations |
Firestore/core/test/unit/core/pipeline/utils.h |
Shared pipeline test utilities including serializer and document matchers |
Firestore/core/test/unit/core/pipeline/utils.cc |
Implementation of test utilities with database serializer |
Firestore/core/test/unit/core/pipeline/unicode_test.cc |
Tests for Unicode string handling in pipelines |
Firestore/core/test/unit/core/pipeline/sort_test.cc |
Comprehensive sorting tests with various data types and ordering |
Firestore/core/test/unit/core/pipeline/number_semantics_test.cc |
Tests for number comparison semantics including NaN and zero handling |
Firestore/core/test/unit/core/pipeline/null_semantics_test.cc |
Tests for null value handling in filtering and sorting operations |
Firestore/core/test/unit/core/pipeline/nested_properties_test.cc |
Tests for nested object property access and filtering |
Firestore/core/test/unit/core/pipeline/limit_test.cc |
Tests for result limiting functionality |
Firestore/core/test/unit/core/pipeline/inequality_test.cc |
Tests for inequality operators and range queries |
Firestore/core/test/unit/core/pipeline/error_handling_test.cc |
Tests for error scenarios and partial error handling |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Firestore/core/test/unit/core/pipeline/nested_properties_test.cc
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a major feature: offline evaluation for Firestore pipelines. It adds the necessary Evaluate
methods to various pipeline stages and a RunPipeline
function to execute them. A key part of this is the new RewriteStages
utility, which ensures deterministic ordering by adding stable sorts where needed. The PR also includes a comprehensive suite of new unit tests covering a wide range of query scenarios, including collection group queries, complex filters, disjunctive queries, and various data type semantics. This is a substantial and well-tested addition to the codebase. My review focuses on a critical compilation issue in the new tests, a minor typo in a new API, and a couple of suggestions for simplification and consistency.
return this->rewritten_stages_; | ||
} | ||
|
||
void RealtimePipeline::SetRewrittentStages( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
const std::vector<std::shared_ptr<EvaluableStage>>& stages() const; | ||
const std::vector<std::shared_ptr<EvaluableStage>>& rewritten_stages() const; | ||
|
||
void SetRewrittentStages(std::vector<std::shared_ptr<EvaluableStage>>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
absl::string_view name() const { | ||
return "documents"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name()
method here is not marked virtual
or override
. While DocumentsSource
doesn't inherit from EvaluableStage
(which has the pure virtual name()
method), it seems to follow a similar pattern. If the intent is for all stages to have a polymorphic name()
method, consider adding virtual absl::string_view name() const
to the base Stage
class for consistency. If not, this is fine, but it's a point of potential inconsistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change was applied in a later PR.
return this->rewritten_stages_; | ||
} | ||
|
||
void RealtimePipeline::SetRewrittentStages( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
const std::vector<std::shared_ptr<EvaluableStage>>& stages() const; | ||
const std::vector<std::shared_ptr<EvaluableStage>>& rewritten_stages() const; | ||
|
||
void SetRewrittentStages(std::vector<std::shared_ptr<EvaluableStage>>); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
model::PipelineInputOutputVector SortStage::Evaluate( | ||
const EvaluateContext& context, | ||
const model::PipelineInputOutputVector& inputs) const { | ||
model::PipelineInputOutputVector input_copy = inputs; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not take inputs
by copy instead of taking by reference and copying it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. The reason is not every stage needs to copy the inputs, some of them can work with a reference.
Also worth pointing out, documents are optimized for copy, the actual document content are usually not copied (they are held via shared_ptr).
absl::string_view name() const { | ||
return "documents"; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
#include "Firestore/Protos/nanopb/google/firestore/v1/document.nanopb.h" | ||
#include "Firestore/core/src/api/expressions.h" | ||
#include "Firestore/core/src/api/realtime_pipeline.h" | ||
#include "Firestore/core/src/api/stages.h" | ||
#include "Firestore/core/src/model/mutable_document.h" | ||
#include "Firestore/core/src/nanopb/message.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIUC This header file does not need any of these (23-28) headers. You should be able to remove all of these and only add a "forward declaration" on line 33:
class api::EvaluableStage;
This makes compilation faster, minimizes coupling of header files, and avoids false circular dependencies in the future. You will have to do the same imports in pipeline_util.cc
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the redundant headers instead.
3abafda
to
28cf5fa
Compare
No description provided.