Skip to content

Commit 310ce36

Browse files
authored
Remove usage of OPERATOR_UNSPECIFIED and use the real OR operator. (#3888)
We had used OPERATOR_UNSPECIFIED in place of the OR enum because the proto was not ready. Now that the proto has been updated, we can remove those. Also found an out-of-date TODO and removed it.
1 parent 4cec8a4 commit 310ce36

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,7 @@ StructuredQuery.CompositeFilter.Operator encodeCompositeFilterOperator(
701701
case AND:
702702
return StructuredQuery.CompositeFilter.Operator.AND;
703703
case OR:
704-
// TODO(orquery): Use OPERATOR_OR once it's available.
705-
return StructuredQuery.CompositeFilter.Operator.OPERATOR_UNSPECIFIED;
704+
return StructuredQuery.CompositeFilter.Operator.OR;
706705
default:
707706
throw fail("Unrecognized composite filter type.");
708707
}
@@ -713,8 +712,7 @@ com.google.firebase.firestore.core.CompositeFilter.Operator decodeCompositeFilte
713712
switch (op) {
714713
case AND:
715714
return com.google.firebase.firestore.core.CompositeFilter.Operator.AND;
716-
// TODO(orquery): Use OPERATOR_OR once it's available.
717-
case OPERATOR_UNSPECIFIED:
715+
case OR:
718716
return com.google.firebase.firestore.core.CompositeFilter.Operator.OR;
719717
default:
720718
throw fail("Only AND and OR composite filter types are supported.");

firebase-firestore/src/main/java/com/google/firebase/firestore/util/LogicUtils.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,6 @@ protected static Filter computeDistributedNormalForm(Filter filter) {
298298
* @return the terms in the DNF transform.
299299
*/
300300
public static List<Filter> getDnfTerms(CompositeFilter filter) {
301-
// TODO(orquery): write the DNF transform algorithm here.
302-
// For now, assume all inputs are of the form AND(A, B, ...). Therefore the resulting DNF form
303-
// is the same as the input.
304301
if (filter.getFilters().isEmpty()) {
305302
return Collections.emptyList();
306303
}

firebase-firestore/src/test/java/com/google/firebase/firestore/remote/RemoteSerializerTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,7 @@ public void testEncodesCompositeFiltersOnDeeperCollections() {
702702
Filter.newBuilder()
703703
.setCompositeFilter(
704704
StructuredQuery.CompositeFilter.newBuilder()
705-
// TODO(orquery): Replace with Operator.OR once it's available.
706-
.setOp(CompositeFilter.Operator.OPERATOR_UNSPECIFIED)
705+
.setOp(CompositeFilter.Operator.OR)
707706
.addFilters(
708707
Filter.newBuilder()
709708
.setFieldFilter(

0 commit comments

Comments
 (0)