-
Notifications
You must be signed in to change notification settings - Fork 606
Add expected count to target #4574
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
Add expected count to target #4574
Conversation
Javadoc Changes:--- /home/runner/diff/original/firebase-kotlindoc/android/com/google/firebase/firestore/AggregateQuery.html 2023-01-23 22:36:44.833135283 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/android/com/google/firebase/firestore/AggregateQuery.html 2023-01-23 22:36:03.185297062 +0000
@@ -47,7 +47,7 @@
<tr>
<td width="40%"><code>@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html">Task</a><<a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateQuerySnapshot.html">AggregateQuerySnapshot</a>></code></td>
<td>
- <div><code><a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateQuery.html#get(com.google.firebase.firestore.AggregateSource)">get</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateSource.html">AggregateSource</a> source)</code></div>
+ <div><code><a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateQuery.html#get(com.google.firebase.firestore.AggregateSource)">get</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/Object.html">Object</a> source)</code></div>
<p>Executes this query.</p>
</td>
</tr>
@@ -122,7 +122,7 @@
</div>
<div><a name="get-com.google.firebase.firestore.AggregateSource-"></a><a name="get"></a>
<h3 class="api-name" id="get(com.google.firebase.firestore.AggregateSource)">get</h3>
- <pre class="api-signature no-pretty-print">public @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html">Task</a><<a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateQuerySnapshot.html">AggregateQuerySnapshot</a>> <a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateQuery.html#get(com.google.firebase.firestore.AggregateSource)">get</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateSource.html">AggregateSource</a> source)</pre>
+ <pre class="api-signature no-pretty-print">public @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html">Task</a><<a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateQuerySnapshot.html">AggregateQuerySnapshot</a>> <a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateQuery.html#get(com.google.firebase.firestore.AggregateSource)">get</a>(@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/Object.html">Object</a> source)</pre>
<p>Executes this query.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
@@ -133,7 +133,7 @@
</thead>
<tbody class="list">
<tr>
- <td width="40%"><code>@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/AggregateSource.html">AggregateSource</a> source</code></td>
+ <td width="40%"><code>@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/Object.html">Object</a> source</code></td>
<td>
<p>The source from which to acquire the aggregate results.</p>
</td> --- /home/runner/diff/original/firebase-kotlindoc/android/com/google/firebase/firestore/LoadBundleTaskProgress.html 2023-01-23 22:36:44.833135283 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/android/com/google/firebase/firestore/LoadBundleTaskProgress.html 2023-01-23 22:36:03.185297062 +0000
@@ -81,7 +81,7 @@
</td>
</tr>
<tr>
- <td width="40%"><code>@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/Object.html">Object</a></code></td>
+ <td width="40%"><code>@<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/LoadBundleTaskProgress.TaskState.html">LoadBundleTaskProgress.TaskState</a></code></td>
<td>
<div><code><a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/LoadBundleTaskProgress.html#getTaskState()">getTaskState</a>()</code></div>
<p>Returns the current state of the <code><a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/LoadBundleTask.html">LoadBundleTask</a></code>.</p>
@@ -137,7 +137,7 @@
</div>
<div><a name="getTaskState--"></a><a name="gettaskstate"></a>
<h3 class="api-name" id="getTaskState()">getTaskState</h3>
- <pre class="api-signature no-pretty-print">public @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/kotlin/java/lang/Object.html">Object</a> <a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/LoadBundleTaskProgress.html#getTaskState()">getTaskState</a>()</pre>
+ <pre class="api-signature no-pretty-print">public @<a href="https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html">NonNull</a> <a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/LoadBundleTaskProgress.TaskState.html">LoadBundleTaskProgress.TaskState</a> <a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/LoadBundleTaskProgress.html#getTaskState()">getTaskState</a>()</pre>
<p>Returns the current state of the <code><a href="/https/github.com/docs/reference/android/com/google/firebase/firestore/LoadBundleTask.html">LoadBundleTask</a></code>.</p>
</div>
<div><a name="getTotalBytes--"></a><a name="gettotalbytes"></a> --- /home/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/firestore/AggregateQuery.html 2023-01-23 22:36:44.849135220 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/firestore/AggregateQuery.html 2023-01-23 22:36:03.201297000 +0000
@@ -47,7 +47,7 @@
<tr>
<td width="40%"><code><a href="https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html">Task</a><<a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateQuerySnapshot.html">AggregateQuerySnapshot</a>!></code></td>
<td>
- <div><code><a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateQuery.html#get(com.google.firebase.firestore.AggregateSource)">get</a>(source: <a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateSource.html">AggregateSource</a>)</code></div>
+ <div><code><a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateQuery.html#get(com.google.firebase.firestore.AggregateSource)">get</a>(source: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>)</code></div>
<p>Executes this query.</p>
</td>
</tr>
@@ -122,7 +122,7 @@
</div>
<div><a name="get-com.google.firebase.firestore.AggregateSource-"></a><a name="get"></a>
<h3 class="api-name" id="get(com.google.firebase.firestore.AggregateSource)">get</h3>
- <pre class="api-signature no-pretty-print">fun <a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateQuery.html#get(com.google.firebase.firestore.AggregateSource)">get</a>(source: <a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateSource.html">AggregateSource</a>): <a href="https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html">Task</a><<a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateQuerySnapshot.html">AggregateQuerySnapshot</a>!></pre>
+ <pre class="api-signature no-pretty-print">fun <a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateQuery.html#get(com.google.firebase.firestore.AggregateSource)">get</a>(source: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a>): <a href="https://developers.google.com/android/reference/com/google/android/gms/tasks/Task.html">Task</a><<a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateQuerySnapshot.html">AggregateQuerySnapshot</a>!></pre>
<p>Executes this query.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
@@ -133,7 +133,7 @@
</thead>
<tbody class="list">
<tr>
- <td width="40%"><code>source: <a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/AggregateSource.html">AggregateSource</a></code></td>
+ <td width="40%"><code>source: <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a></code></td>
<td>
<p>The source from which to acquire the aggregate results.</p>
</td> --- /home/runner/diff/original/firebase-kotlindoc/kotlin/com/google/firebase/firestore/LoadBundleTaskProgress.html 2023-01-23 22:36:44.845135236 +0000
+++ /home/runner/diff/modified/firebase-kotlindoc/kotlin/com/google/firebase/firestore/LoadBundleTaskProgress.html 2023-01-23 22:36:03.201297000 +0000
@@ -81,7 +81,7 @@
</td>
</tr>
<tr>
- <td width="40%"><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a></code></td>
+ <td width="40%"><code><a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/LoadBundleTaskProgress.TaskState.html">LoadBundleTaskProgress.TaskState</a></code></td>
<td>
<div><code><a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/LoadBundleTaskProgress.html#getTaskState()">getTaskState</a>()</code></div>
<p>Returns the current state of the <code><a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/LoadBundleTask.html">LoadBundleTask</a></code>.</p>
@@ -137,7 +137,7 @@
</div>
<div><a name="getTaskState--"></a><a name="gettaskstate"></a>
<h3 class="api-name" id="getTaskState()">getTaskState</h3>
- <pre class="api-signature no-pretty-print">fun <a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/LoadBundleTaskProgress.html#getTaskState()">getTaskState</a>(): <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html">Any</a></pre>
+ <pre class="api-signature no-pretty-print">fun <a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/LoadBundleTaskProgress.html#getTaskState()">getTaskState</a>(): <a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/LoadBundleTaskProgress.TaskState.html">LoadBundleTaskProgress.TaskState</a></pre>
<p>Returns the current state of the <code><a href="/https/github.com/docs/reference/kotlin/com/google/firebase/firestore/LoadBundleTask.html">LoadBundleTask</a></code>.</p>
</div>
<div><a name="getTotalBytes--"></a><a name="gettotalbytes"></a> |
Generated by 🚫 Danger |
Coverage Report 1Affected Products
Test Logs |
Size Report 1Affected Products
Test Logs |
Startup Time Report 1Note: Layout is sometimes suboptimal due to limited formatting support on GitHub. Please check this report on GCS. Startup time comparison between the CI merge commit (a955a53) and the base commit (82280ca) are not available. No macrobenchmark data found for the base commit (82280ca). Analysis for the CI merge commit (a955a53) can be found at: |
firebase-firestore/src/main/java/com/google/firebase/firestore/local/TargetData.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/local/TargetData.java
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/local/TargetData.java
Outdated
Show resolved
Hide resolved
firebase-firestore/src/main/java/com/google/firebase/firestore/local/TargetData.java
Outdated
Show resolved
Hide resolved
@@ -499,6 +499,10 @@ public Target encodeTarget(TargetData targetData) { | |||
builder.setResumeToken(targetData.getResumeToken()); | |||
} | |||
|
|||
if (targetData.getExpectedCount() != null) { | |||
builder.setExpectedCount(Int32Value.newBuilder().setValue(targetData.getExpectedCount())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code block is inconsistent with the web sdk. In the web sdk, it only sets expectedCount if a resume token or snapshot version is specified. Here, it is setting expectedCount regardless of whether or not a resume token or snapshot version is specified.
We generally aim to keep the sdks in sync as much as possible because it's confusing when things are done differently in one sdk compared to another.
Please make the two SDKs do the same thing in this scenario.
I think the way that the web sdk does it is best because it makes it very clear that expectedCount is only meaningful if a resume token or snapshot version is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this is the part that I am a bit hesitated. In web the if statments is like:
if (targetData.resumeToken.approximateByteSize() > 0) {
} else if (targetData.snapshotVersion.compareTo(SnapshotVersion.min()) > 0) {
while in Android it is
if (targetData.getResumeToken().isEmpty()
&& targetData.getSnapshotVersion().compareTo(SnapshotVersion.NONE) > 0) {
} else{
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the if statement to indicate resume token or snapshotVersion is required to add expectedCount:
if (targetData.getExpectedCount() != null
&& (!targetData.getResumeToken().isEmpty()
|| targetData.getSnapshotVersion().compareTo(SnapshotVersion.NONE) > 0)) {
builder.setExpectedCount(Int32Value.newBuilder().setValue(targetData.getExpectedCount()));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though the "if" statement has the extra check for targetData.getResumeToken().isEmpty()
, we should still mirror the structure from the web sdk. We only want to set expected count if either the "if" or the "else" branch above is entered, so we may as well put the logic into those branches.
firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteStore.java
Outdated
Show resolved
Hide resolved
@@ -99,6 +99,7 @@ | |||
"watchEntity": { | |||
"docs": [ | |||
{ | |||
"createTime": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is annoying, but can you remove all of the createTime
lines from this file, since they are not part of the bloom filter tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what happened, but there are still a bunch of "createTime": 0
lines in this file. Could you remove them too?
firebase-firestore/src/test/java/com/google/firebase/firestore/spec/SpecTestCase.java
Show resolved
Hide resolved
@@ -499,6 +499,10 @@ public Target encodeTarget(TargetData targetData) { | |||
builder.setResumeToken(targetData.getResumeToken()); | |||
} | |||
|
|||
if (targetData.getExpectedCount() != null) { | |||
builder.setExpectedCount(Int32Value.newBuilder().setValue(targetData.getExpectedCount())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though the "if" statement has the extra check for targetData.getResumeToken().isEmpty()
, we should still mirror the structure from the web sdk. We only want to set expected count if either the "if" or the "else" branch above is entered, so we may as well put the logic into those branches.
@@ -99,6 +99,7 @@ | |||
"watchEntity": { | |||
"docs": [ | |||
{ | |||
"createTime": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what happened, but there are still a bunch of "createTime": 0
lines in this file. Could you remove them too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Ported from firebase/firebase-js-sdk#6854