Skip to content

Remove usage of OPERATOR_UNSPECIFIED and use the real OR operator. #3888

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 1 commit into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,7 @@ StructuredQuery.CompositeFilter.Operator encodeCompositeFilterOperator(
case AND:
return StructuredQuery.CompositeFilter.Operator.AND;
case OR:
// TODO(orquery): Use OPERATOR_OR once it's available.
return StructuredQuery.CompositeFilter.Operator.OPERATOR_UNSPECIFIED;
return StructuredQuery.CompositeFilter.Operator.OR;
default:
throw fail("Unrecognized composite filter type.");
}
Expand All @@ -713,8 +712,7 @@ com.google.firebase.firestore.core.CompositeFilter.Operator decodeCompositeFilte
switch (op) {
case AND:
return com.google.firebase.firestore.core.CompositeFilter.Operator.AND;
// TODO(orquery): Use OPERATOR_OR once it's available.
case OPERATOR_UNSPECIFIED:
case OR:
return com.google.firebase.firestore.core.CompositeFilter.Operator.OR;
default:
throw fail("Only AND and OR composite filter types are supported.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,6 @@ protected static Filter computeDistributedNormalForm(Filter filter) {
* @return the terms in the DNF transform.
*/
public static List<Filter> getDnfTerms(CompositeFilter filter) {
// TODO(orquery): write the DNF transform algorithm here.
// For now, assume all inputs are of the form AND(A, B, ...). Therefore the resulting DNF form
// is the same as the input.
if (filter.getFilters().isEmpty()) {
return Collections.emptyList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,7 @@ public void testEncodesCompositeFiltersOnDeeperCollections() {
Filter.newBuilder()
.setCompositeFilter(
StructuredQuery.CompositeFilter.newBuilder()
// TODO(orquery): Replace with Operator.OR once it's available.
.setOp(CompositeFilter.Operator.OPERATOR_UNSPECIFIED)
.setOp(CompositeFilter.Operator.OR)
.addFilters(
Filter.newBuilder()
.setFieldFilter(
Expand Down