Skip to content

QueryEngine clean up #3646

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
Apr 13, 2022
Merged
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 @@ -41,7 +41,7 @@
* the result set is equivalent across all implementations.
*
* <p>The Query engine will use indexed-based execution if a user has configured any index that can
* be used to execute query (via {@link FirebaseFirestore#setIndexConfiguation}). Otherwise, the
* be used to execute query (via {@link FirebaseFirestore#setIndexConfiguration}). Otherwise, the
* engine will try to optimize the query by re-using a previously persisted query result. If that is
* not possible, the query will be executed via a full collection scan.
*
Expand Down Expand Up @@ -86,8 +86,7 @@ public ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
ImmutableSortedSet<DocumentKey> remoteKeys) {
hardAssert(initialized, "initialize() not called");

ImmutableSortedMap<DocumentKey, Document> result =
performQueryUsingIndex(query, query.toTarget());
ImmutableSortedMap<DocumentKey, Document> result = performQueryUsingIndex(query);
if (result != null) {
return result;
}
Expand All @@ -104,13 +103,13 @@ public ImmutableSortedMap<DocumentKey, Document> getDocumentsMatchingQuery(
* Performs an indexed query that evaluates the query based on a collection's persisted index
* values. Returns {@code null} if an index is not available.
*/
private @Nullable ImmutableSortedMap<DocumentKey, Document> performQueryUsingIndex(
Query query, Target target) {
private @Nullable ImmutableSortedMap<DocumentKey, Document> performQueryUsingIndex(Query query) {
if (query.matchesAllDocuments()) {
// Don't use index queries that can be executed by scanning the collection.
return null;
}

Target target = query.toTarget();
IndexType indexType = indexManager.getIndexType(target);

if (indexType.equals(IndexType.NONE)) {
Expand Down