-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add IN and ARRAY_CONTAINS_ANY (not publicly exposed) #3492
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
Firestore/core/src/firebase/firestore/core/key_field_in_filter.cc
Outdated
Show resolved
Hide resolved
void ValidateDisjunctiveFilterElements(const model::FieldValue& field_value, | ||
const core::Filter::Operator op) const; | ||
|
||
model::FieldValue ParseDocumentIdValue( |
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.
Please add a comment describing what this does. From its name I'm not really sure what it does at all.
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.
Given this comment and the way you're using it. I'm not entirely sure I understand why this name is associated with "DocumentId". Your description doesn't mention it. Fundamentally this name is problematic because there's never really such a thing as a "document ID value". Document IDs are associated with the field of a filter, not the value.
Some ideas for how to resolve this (assuming I'm even understanding correctly):
-
Since your description is "Parses the given FieldValue into a Reference", shouldn't this name be something like ParseReferenceValue or maybe ParseExpectedReferenceValue?
-
Or maybe the issue is that we're parsing a reference value because we're expecting that whenever you supply a value for a document ID field? In that case you might consider naming this ParseValueForDocumentIdFilter or something like that.
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.
Thanks for breaking it down. The intention is that this method is called to validate that a provided FieldValue is indeed a valid Reference value, since References can also be Strings.
In that case, it makes sense to call it ParseExpectedReferenceValue
, since we are parsing that an "expected" Reference value is actually a valid Reference value.
void ValidateDisjunctiveFilterElements(const model::FieldValue& field_value, | ||
const core::Filter::Operator op) const; | ||
|
||
model::FieldValue ParseDocumentIdValue( |
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.
Given this comment and the way you're using it. I'm not entirely sure I understand why this name is associated with "DocumentId". Your description doesn't mention it. Fundamentally this name is problematic because there's never really such a thing as a "document ID value". Document IDs are associated with the field of a filter, not the value.
Some ideas for how to resolve this (assuming I'm even understanding correctly):
-
Since your description is "Parses the given FieldValue into a Reference", shouldn't this name be something like ParseReferenceValue or maybe ParseExpectedReferenceValue?
-
Or maybe the issue is that we're parsing a reference value because we're expecting that whenever you supply a value for a document ID field? In that case you might consider naming this ParseValueForDocumentIdFilter or something like that.
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.
LGTM
This is a combination of multiple ports and backports in the Android and web SDKs. Here are some of the main ones 1, 2, 3.
Some questions I ran into:
FieldValue
. Because we pass the type in as atype_describer
lambda, I'm not sure how to get the underlying value, which results in a confusing error message.findFilterOperator()
from android was not worth the effort b/c of array passing in C++. After talking with Gil, we decided to just add checks for array and disjunctive operators intoFSTQuery
. The name I came up with could definitely be better. Please advise :D