Skip to content

Index Evaluation #2963

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 6 commits into from
Sep 16, 2021
Merged

Index Evaluation #2963

merged 6 commits into from
Sep 16, 2021

Conversation

schmidt-sebastian
Copy link
Contributor

This PR adds the code that is needed to add documents to the Index and to run queries against the Index.

Couple changes from previous PRs:

  • The schema now uses collection_groups and no longer collection_ids. This was true before but it also now reflected in the names.
  • Since we use collection groups, the schema actually needs to contain the relative path of the document rather than just the document ID.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 8, 2021

Coverage Report

Affected SDKs

  • firebase-firestore

    SDK overall coverage changed from 41.45% (191700a) to 42.86% (6c576b9d) by +1.41%.

    Click to show coverage changes in 14 files.
    Filename Base (191700a) Head (6c576b9d) Diff
    AsyncQueue.java 77.00% 78.00% +1.00%
    Bound.java 47.83% 56.36% +8.54%
    DirectionalIndexByteEncoder.java 0.00% 100.00% +100.00%
    FieldIndex.java 63.33% 76.47% +13.14%
    FirestoreIndexValueWriter.java 0.00% 30.99% +30.99%
    Index.java 0.00% 29.34% +29.34%
    IndexByteEncoder.java ? 75.00% ?
    IntMath.java 0.00% 41.67% +41.67%
    LocalSerializer.java 89.71% 97.95% +8.24%
    MemoryIndexManager.java 94.44% 85.00% -9.44%
    OrderedCodeWriter.java 0.00% 30.77% +30.77%
    SQLiteIndexManager.java 65.52% 96.36% +30.85%
    SQLitePersistence.java 83.24% 84.86% +1.62%
    Target.java 95.92% 96.73% +0.81%

Test Logs

Notes

HTML coverage reports can be produced locally with ./gradlew <product>:checkCoverage.
Report files are located at <product-build-dir>/reports/jacoco/.

Head commit (6c576b9d) is created by Prow via merging commits: 191700a adbac78.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 8, 2021

Binary Size Report

Affected SDKs

  • firebase-firestore

    Type Base (191700a) Head (6c576b9d) Diff
    aar 1.19 MB 1.20 MB +7.12 kB (+0.6%)
    apk (release) 3.24 MB 3.24 MB +2.61 kB (+0.1%)

Test Logs

Notes

Head commit (6c576b9d) is created by Prow via merging commits: 191700a adbac78.

Copy link
Contributor

@wu-hui wu-hui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good.

I will do another review for comments and code structure later.

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Sep 13, 2021
@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Sep 15, 2021
Copy link
Contributor

@wu-hui wu-hui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one test I cannot find, but LGTM anyways.

@@ -176,6 +176,8 @@ public void addIndexEntries(Document document) {
if (fieldIndex == null) return null;

Bound lowerBound = target.getLowerBound(fieldIndex);
String lowerBoundOp = lowerBound.isBefore() ? ">=" : ">"; // `startAt()` versus `startAfter()`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not related to this PR, but what do you think about changing isBefore to isIncluded?

This way we can do lower.isIncluded ? ">=" : ">" and upper.isIncluded ? "<=" : "<". We need to change this everywhere and still keep the API for startAt and startAfter though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brian is also confused about this (so am I). I will send a follow-up PR to do a rename.

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Sep 16, 2021
@schmidt-sebastian schmidt-sebastian merged commit da62838 into master Sep 16, 2021
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/indexencoding branch September 16, 2021 15:16
@firebase firebase locked and limited conversation to collaborators Oct 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants