-
Notifications
You must be signed in to change notification settings - Fork 578
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
Allow IN queries with arrays of documentIds #560
Conversation
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.
Some minor suggestions, but I think this basically looks good to me. There might be some clever better way to organize, but it didn't jump out at me.
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Show resolved
Hide resolved
+ ")."); | ||
if (op == Operator.IN) { | ||
validateDisjunctiveOperatorValueArray(value, op); | ||
List referenceList = new ArrayList(); |
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.
Prefer generic versions of List<>
for type-safety, so this would be List<ReferenceValue>
.
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.
ArrayValue.fromList()
requires List<FieldValue>
, so I'm using that 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.
FWIW, if we wanted to make this work, we could change ArrayValue
to wrap a List<? extends FieldValue>
instead of List<FieldValue>
(read https://dzone.com/articles/covariance-and-contravariance for context). Probably fine to leave as-is though.
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
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.
Once again, thanks for the detailed review and explanations. Learning a lot :)
+ ")."); | ||
if (op == Operator.IN) { | ||
validateDisjunctiveOperatorValueArray(value, op); | ||
List referenceList = new ArrayList(); |
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.
ArrayValue.fromList()
requires List<FieldValue>
, so I'm using that 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.
Couple nits left.
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/Query.java
Show resolved
Hide resolved
+ ")."); | ||
if (op == Operator.IN) { | ||
validateDisjunctiveOperatorValueArray(value, op); | ||
List referenceList = new ArrayList(); |
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.
FWIW, if we wanted to make this work, we could change ArrayValue
to wrap a List<? extends FieldValue>
instead of List<FieldValue>
(read https://dzone.com/articles/covariance-and-contravariance for context). Probably fine to leave as-is though.
I think I renamed |
Notes for @mikelehen:
validateAndCalculateReferenceValue
, but I'm not sure how else to refactor it without having almost identical code copied.validateAndCalculateReferenceValue
?