Skip to content

Make FieldIndex an AutoValue #3147

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
Nov 19, 2021
Merged

Make FieldIndex an AutoValue #3147

merged 6 commits into from
Nov 19, 2021

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Nov 18, 2021

This changes FIeldIndex to be an AutoValue with the goal to make it easier to extend and add new properties.

@google-cla google-cla bot added the cla: yes Override cla label Nov 18, 2021
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 18, 2021

Coverage Report

Affected SDKs

  • firebase-firestore

    SDK overall coverage changed from 45.04% (0e5ccca) to 44.98% (57e62061) by -0.06%.

    Filename Base (0e5ccca) Head (57e62061) Diff
    AutoValue_FieldIndex.java ? 55.56% ?
    AutoValue_FieldIndex_Segment.java 56.52% 33.33% -23.19%
    FieldIndex.java 88.06% 100.00% +11.94%
    FirebaseFirestore.java 38.15% 37.71% -0.44%
    LocalSerializer.java 89.54% 90.73% +1.19%
    PatchMutation.java 100.00% 98.39% -1.61%
    SQLiteIndexManager.java 95.97% 95.72% -0.25%
    SetMutation.java 97.14% 94.29% -2.86%

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 (57e62061) is created by Prow via merging commits: 0e5ccca a75fb63.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 18, 2021

Binary Size Report

Affected SDKs

  • firebase-firestore

    Type Base (0e5ccca) Head (57e62061) Diff
    aar 1.22 MB 1.22 MB +583 B (+0.0%)
    apk (release) 3.32 MB 3.32 MB +180 B (+0.0%)

Test Logs

Notes

Head commit (57e62061) is created by Prow via merging commits: 0e5ccca a75fb63.

}
parsedIndices.add(fieldIndex);
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 think this is an actual bug. I changed the test to catch this.

Choose a reason for hiding this comment

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

I don't fully follow. What was the original bug?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It adds an the same index multiple times if it has more than one field.

@@ -29,132 +28,64 @@
@Config(manifest = Config.NONE)
public class FieldIndexTest {

@Test
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These tests are not needed anymore since equals() is generated.

Copy link

@thebrianchen thebrianchen left a comment

Choose a reason for hiding this comment

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

super clean, love this!

}
parsedIndices.add(fieldIndex);

Choose a reason for hiding this comment

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

I don't fully follow. What was the original bug?

List<FieldIndex.Segment> segments =
serializer.decodeFieldIndexSegments(Index.parseFrom(row.getBlob(2)));
SnapshotVersion updateTime =
new SnapshotVersion(new Timestamp(row.getLong(3), row.getInt(4)));

Choose a reason for hiding this comment

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

Seconds are stored in SQLite as INTEGER, does it auto-convert to long?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

INTEGER means non-floating number of any storage size for SQLite: https://www.sqlite.org/datatype3.html

@schmidt-sebastian schmidt-sebastian merged commit 710046b into master Nov 19, 2021
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/autovalue branch November 19, 2021 02:10
@firebase firebase locked and limited conversation to collaborators Dec 20, 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