-
Notifications
You must be signed in to change notification settings - Fork 945
Port TargetIndexMatcher #5975
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
Port TargetIndexMatcher #5975
Conversation
|
Size Report 1Affected Products
Test Logs |
Size Analysis Report 1This report is too large (445,136 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 |
Changeset File Check ✅
|
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.
Looks good. Just a few nits
/** | ||
* A light query planner for Firestore. | ||
* | ||
* This class matches a `FieldIndex`z against a Firestore Query `Target`. It |
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.
remove typo (z
)
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.
Done
private readonly collectionId: string; | ||
// The single inequality filter of the target (if it exists). | ||
private readonly inequalityFilter?: FieldFilter; | ||
// The list of equality filter of the target. |
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.
s/filter/filters
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.
Done
|
||
// Process all equalities first. Equalities can appear out of order. | ||
for (; segmentIndex < segments.length; ++segmentIndex) { | ||
// We attempt to greedily match all segments to equality filters. If a a |
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.
s/If a a/If a
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.
Fun :)
// Process all equalities first. Equalities can appear out of order. | ||
for (; segmentIndex < segments.length; ++segmentIndex) { | ||
// We attempt to greedily match all segments to equality filters. If a a | ||
// filter matches an index segments, we can mark the segment as 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.
s/an index segments/an index segment
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.
...
for (; segmentIndex < segments.length; ++segmentIndex) { | ||
// We attempt to greedily match all segments to equality filters. If a a | ||
// filter matches an index segments, we can mark the segment as used. | ||
// Since it is not possible to use the same filed path in both an equality |
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.
s/filed/field
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.
...
++segmentIndex; | ||
} | ||
|
||
// All remaining segment need to represent the prefix of the target's |
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.
s/segment/segments
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.
Done
} | ||
}); | ||
|
||
it('inequalitiesWithDefaultOrder', () => { |
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.
inequalities with default order ?
Same for the next two 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.
Fixed
queryToTarget(query('collId')) | ||
); | ||
const index = fieldIndex('collId'); | ||
expect(() => targetIndexMatcher.servedByIndex(index)).to.not.throw; |
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 don't see any throw
statements in target_index_matcher.ts. Similarly, I don't see any throw statements in TargetIndexMatcher.java.
does .to.throw
and .to.not.throw
apply to assertions (e.g. the debugAssert
in the code)? The other examples of .to.throw
that I found in other test files corresponded to a throw
statement in the source.
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.
Yes it applies to the assert.
} | ||
}); | ||
|
||
it('array-contains is idempotent', () => { |
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.
ts:idempotent
java:independent
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.
independent it is
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.
Wheee... so many typos. Thanks for catching.
private readonly collectionId: string; | ||
// The single inequality filter of the target (if it exists). | ||
private readonly inequalityFilter?: FieldFilter; | ||
// The list of equality filter of the target. |
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.
Done
|
||
// Process all equalities first. Equalities can appear out of order. | ||
for (; segmentIndex < segments.length; ++segmentIndex) { | ||
// We attempt to greedily match all segments to equality filters. If a a |
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.
Fun :)
// Process all equalities first. Equalities can appear out of order. | ||
for (; segmentIndex < segments.length; ++segmentIndex) { | ||
// We attempt to greedily match all segments to equality filters. If a a | ||
// filter matches an index segments, we can mark the segment as 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.
...
for (; segmentIndex < segments.length; ++segmentIndex) { | ||
// We attempt to greedily match all segments to equality filters. If a a | ||
// filter matches an index segments, we can mark the segment as used. | ||
// Since it is not possible to use the same filed path in both an equality |
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.
...
// We attempt to greedily match all segments to equality filters. If a a | ||
// filter matches an index segments, we can mark the segment as used. | ||
// Since it is not possible to use the same filed path in both an equality | ||
// and inequality/oderBy cause, we do not have to consider the possibility |
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.
... sorry :/
++segmentIndex; | ||
} | ||
|
||
// All remaining segment need to represent the prefix of the target's |
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.
Done
} | ||
|
||
// All remaining segment need to represent the prefix of the target's | ||
// orderBy |
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.
Done
} | ||
}); | ||
|
||
it('inequalitiesWithDefaultOrder', () => { |
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.
Fixed
queryToTarget(query('collId')) | ||
); | ||
const index = fieldIndex('collId'); | ||
expect(() => targetIndexMatcher.servedByIndex(index)).to.not.throw; |
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.
Yes it applies to the assert.
} | ||
}); | ||
|
||
it('array-contains is idempotent', () => { |
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.
independent it is
forgot to push your commit? |
…rebase-js-sdk into mrschmidt/targetindexmatcher
@ehsannas Yup, had to pull and then push! |
This is a straightforward port from Android.