Repository navigation
Conversation
CursorComparisonExpr omits columns that the query already pins to a single value. When a ReadRelationships filter fixes all six relationship fields, that left no columns, so it returned no predicate and the resumed query returned the cursor's own row on every page, never an empty one. When every column is static, compare all of them instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
authzedbot
added a commit
to authzed/cla
that referenced
this pull request
Nov 2, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #3449. A ReadRelationships filter that fixes all six relationship fields, resumed with a cursor, returned the cursor's own relationship on every page instead of an empty page.
CursorComparisonExprleaves out columns the query already pins to one value. When all six are pinned, it returned nil andAfteradded no predicate. Now, when every column is static, it compares all of them, which is the literal "sorts after the cursor" condition. Comparing all of them is still correct if the cursor's values differ from the filter's. It only applies when the filter matches at most one row, so the performance reason for omitting static columns doesn't apply. Partially pinned filters generate exactly the same SQL as before.The CockroachDB cursored-delete path is the other caller. Its resumed batch now carries the full-key comparison rather than no predicate. That still matches nothing once the row is deleted. This mirrors the fallback
cursorOrderColumnsalready uses for itsORDER BY.BeforeOrEqualhas a similar guard, which I left alone. With every column pinned it emits no predicate, so it returns the single matching row. That is correct when the cursor's values equal the filter's, which is the same assumption the existing static-column elision already makes. It can be wrong for a cursor taken from a different query. Its only caller, partitioned export, passes an empty filter, so it can't reach that case today. The same fallback would close it if you'd prefer the symmetry.Changes
CursorComparisonExprfalls back to comparing every cursor column when all of them are static, and no longer returns nil.Afterand the CockroachDB cursored delete drop their nil checks. ThecursorOrderColumnscomment and the fully pinned delete test now describe and assert the full-key predicate.TestFullyFilteredCursor: for one relationship with an ellipsis subject relation and one without, sorted both ways, it pages with limit 1 until it gets an empty page and expects exactly one relationship.TestSchemaQueryFilterercase for a fully pinned filter in both comparison forms. The existing all-staticCursorComparisonExprunit test now asserts the full comparison instead of nil.Testing
TestFullyFilteredCursoron main without the fix fails in every case against Postgres 18, CockroachDB v26.2.5, MySQL 8.4 and the Spanner emulator, returning the relationship on all 5 pages. With the fix it passes on all four and on memdb. The newTestSchemaQueryFilterercase and the updatedCursorComparisonExprtest also fail without the fix and pass with it.With the fix, the full datastore suites pass on Postgres, MySQL and Spanner. On CockroachDB, the full suite passes, including the cursored-delete tests with and without integrity, apart from
TestRetries, which also fails intermittently on main without this change. The unit tests ininternal/datastore/commonandinternal/services/v1pass.🤖 Generated with Claude Code