Skip to content

Firestore Spec Tests: Port JS PR 7229 (optimized query resumption using bloom filter) #4929

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 5 commits into from
Apr 25, 2023
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 @@ -420,6 +420,22 @@ private Query parseQuery(Object querySpec) throws JSONException {
}
}

private static QueryPurpose parseQueryPurpose(Object value) {
if (!(value instanceof Integer)) {
throw new IllegalArgumentException("invalid query purpose: " + value);
}
switch ((Integer) value) {
case 0:
return QueryPurpose.LISTEN;
case 1:
return QueryPurpose.EXISTENCE_FILTER_MISMATCH;
case 3:
return QueryPurpose.LIMBO_RESOLUTION;
default:
throw new IllegalArgumentException("unknown query purpose value: " + value);
}
}

private DocumentViewChange parseChange(JSONObject jsonDoc, DocumentViewChange.Type type)
throws JSONException {
long version = jsonDoc.getLong("version");
Expand Down Expand Up @@ -1027,7 +1043,7 @@ private void validateExpectedState(@Nullable JSONObject expectedState) throws JS

QueryPurpose purpose = QueryPurpose.LISTEN;
if (queryDataJson.has("targetPurpose")) {
purpose = QueryPurpose.values()[queryDataJson.getInt("targetPurpose")];
purpose = parseQueryPurpose(queryDataJson.get("targetPurpose"));
}

TargetData targetData =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@
}
],
"resumeToken": "",
"targetPurpose": 2
"targetPurpose": 3
},
"2": {
"queries": [
Expand Down
Loading