Skip to content

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

Merged
merged 6 commits into from
Aug 5, 2019

Conversation

thebrianchen
Copy link

@thebrianchen thebrianchen commented Aug 2, 2019

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:

  • Should I include the swift compile tests now, or wait until this is publicly exposed? If we're including the tests now, how do I import the internal header into swift?
  • I'm running into an issue of how to get the type of the underlying value of a FieldValue. Because we pass the type in as a type_describer lambda, I'm not sure how to get the underlying value, which results in a confusing error message.
  • Implementing 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 into FSTQuery. The name I came up with could definitely be better. Please advise :D

@thebrianchen thebrianchen requested a review from mikelehen August 2, 2019 00:43
@wilhuff wilhuff requested review from wilhuff and removed request for mikelehen August 2, 2019 16:43
@wilhuff wilhuff assigned wilhuff and unassigned mikelehen Aug 2, 2019
void ValidateDisjunctiveFilterElements(const model::FieldValue& field_value,
const core::Filter::Operator op) const;

model::FieldValue ParseDocumentIdValue(
Copy link
Contributor

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.

Copy link
Contributor

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):

  1. Since your description is "Parses the given FieldValue into a Reference", shouldn't this name be something like ParseReferenceValue or maybe ParseExpectedReferenceValue?

  2. 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.

Copy link
Author

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.

@wilhuff wilhuff assigned thebrianchen and unassigned wilhuff Aug 2, 2019
@thebrianchen thebrianchen requested a review from wilhuff August 2, 2019 22:25
@thebrianchen thebrianchen assigned wilhuff and unassigned thebrianchen Aug 2, 2019
void ValidateDisjunctiveFilterElements(const model::FieldValue& field_value,
const core::Filter::Operator op) const;

model::FieldValue ParseDocumentIdValue(
Copy link
Contributor

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):

  1. Since your description is "Parses the given FieldValue into a Reference", shouldn't this name be something like ParseReferenceValue or maybe ParseExpectedReferenceValue?

  2. 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.

@wilhuff wilhuff assigned thebrianchen and unassigned wilhuff Aug 4, 2019
@thebrianchen thebrianchen requested a review from wilhuff August 5, 2019 17:39
@thebrianchen thebrianchen assigned wilhuff and unassigned thebrianchen Aug 5, 2019
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wilhuff wilhuff assigned thebrianchen and unassigned wilhuff Aug 5, 2019
@thebrianchen thebrianchen merged commit 86b09fa into master Aug 5, 2019
@thebrianchen thebrianchen deleted the bc/in-queries branch August 5, 2019 18:47
@firebase firebase locked and limited conversation to collaborators Oct 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants