Skip to content

Port Filter/Target changes #5929

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
Jan 31, 2022
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

This is a pretty liberal port of https://github.com/firebase/firebase-android-sdk/pull/3237/files that also brings in a bunch of Indexing functionality from the Android SDK (as the PR touches a bunch of this functionality).

The PR also cleans up an existing naming issue of isDocumentTarget and renames it to follow the pattern className+methodName. In the tests, the PR simplifies the bound method.

@changeset-bot
Copy link

changeset-bot bot commented Jan 25, 2022

⚠️ No Changeset found

Latest commit: 189e18d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 25, 2022

Size Report 1

Affected Products

  • @firebase/firestore

    TypeBase (6555aa7)Merge (e8789aa)Diff
    browser229 kB229 kB+62 B (+0.0%)
    esm5286 kB286 kB+66 B (+0.0%)
    main456 kB456 kB+118 B (+0.0%)
    module229 kB229 kB+62 B (+0.0%)
    react-native229 kB229 kB+62 B (+0.0%)
  • @firebase/firestore-lite

    TypeBase (6555aa7)Merge (e8789aa)Diff
    browser72.7 kB72.7 kB+35 B (+0.0%)
    esm586.0 kB86.0 kB+40 B (+0.0%)
    main125 kB125 kB+44 B (+0.0%)
    module72.7 kB72.7 kB+35 B (+0.0%)
    react-native72.9 kB72.9 kB+35 B (+0.0%)
  • bundle

    12 size changes

    TypeBase (6555aa7)Merge (e8789aa)Diff
    firestore (Persistence)230 kB230 kB+67 B (+0.0%)
    firestore (Query Cursors)189 kB189 kB+58 B (+0.0%)
    firestore (Query)190 kB190 kB+58 B (+0.0%)
    firestore (Read data once)179 kB179 kB+58 B (+0.0%)
    firestore (Realtime updates)181 kB181 kB+58 B (+0.0%)
    firestore (Transaction)163 kB163 kB+45 B (+0.0%)
    firestore (Write data)163 kB163 kB+45 B (+0.0%)
    firestore-lite (Query Cursors)56.6 kB56.6 kB+36 B (+0.1%)
    firestore-lite (Query)59.6 kB59.7 kB+36 B (+0.1%)
    firestore-lite (Read data once)44.1 kB44.2 kB+36 B (+0.1%)
    firestore-lite (Transaction)61.5 kB61.5 kB+36 B (+0.1%)
    firestore-lite (Write data)47.0 kB47.0 kB+36 B (+0.1%)

  • firebase

    TypeBase (6555aa7)Merge (e8789aa)Diff
    firebase-compat.js754 kB754 kB+67 B (+0.0%)
    firebase-firestore-compat.js281 kB281 kB+67 B (+0.0%)
    firebase-firestore-lite.js249 kB249 kB+111 B (+0.0%)
    firebase-firestore.js775 kB775 kB+385 B (+0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/S1eN1NtYNt.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jan 25, 2022

Size Analysis Report 1

This report is too large (648,103 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/ZI4c2vh4MS.html

@ehsannas
Copy link
Contributor

Sorry I've fallen behind on this. I'll take a look soon.

left: Value | undefined,
right: Value | undefined
): Value | undefined {
if (left === undefined && right === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the first if block is not needed. Same for valuesMin

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to think about this for a bit but you are right. Fixed.


/**
* Returns a lower bound of field values that can be used as a starting point to
* scan the index defined by `fieldIndex`}`. Returns `null` if no lower bound
Copy link
Contributor

Choose a reason for hiding this comment

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

extra }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -513,6 +771,7 @@ export class ArrayContainsAnyFilter extends FieldFilter {
}
}

// TODO(indexing): Change Bound.before to "inclusive"
Copy link
Contributor

Choose a reason for hiding this comment

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

+1. I found inclusive/exclusive terminology easier to understand than before/!before.

case Operator.NOT_EQUAL:
// NotIn/NotEqual is always a suffix
values.push(fieldFilter.value);
return values;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it guaranteed that EQUAL and IN come before NOT_IN and NOT_EQUAL during these iterations?
I know this is the same way the code is written in the Android SDK. I'm just curious where does this guarantee come from? and I'm thinking whether this will continue to work for sub-targets that we create for dnf terms in the future.

No action needed for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had to think about this a bit when I ported (and also recently added a unit test for it - https://github.com/firebase/firebase-android-sdk/pull/3351/files#diff-216e85d9cb7dc6a9ca6b6bf1ae2d9e7751d20a13802e9a7c97a8f517b0bff67cR128). The index encoding order is not specified by the query but rather the index. The order that the values is encoded in is specific to the index.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try to improve the comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 Thanks

@schmidt-sebastian schmidt-sebastian merged commit d04b608 into master Jan 31, 2022
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/porttargetchanges branch January 31, 2022 23:22
@firebase firebase locked and limited conversation to collaborators Mar 3, 2022
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