Skip to content
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

Sorting and comparing nested fields get confused #1907

Closed
MMcM opened this issue Nov 9, 2022 · 2 comments
Closed

Sorting and comparing nested fields get confused #1907

MMcM opened this issue Nov 9, 2022 · 2 comments
Labels
planner Related to the query planner

Comments

@MMcM
Copy link
Contributor

MMcM commented Nov 9, 2022

RecordQueryPlanner.AndWithThenPlanner.planNestedFieldOrComponentChild does advanceCurrentSort unconditionally in the inequality case. But that then defeats the currentSortMatches on the enclosing expression that's actually being requested. It then stops matching and fails to find more index fields that can match later sort keys.

@MMcM MMcM added the planner Related to the query planner label Nov 9, 2022
@MMcM
Copy link
Contributor Author

MMcM commented Nov 10, 2022

There are some similar cases outlined in #1064.

@MMcM
Copy link
Contributor Author

MMcM commented Nov 10, 2022

Perhaps as a result of some refactoring, it appears that there is zero test coverage of either of the advanceCurrentSort calls in planNestedFieldOrComponentChild. I would have expected that they help some queries and hurt other ones like those described here. But we don't actually have examples of that.

MMcM added a commit to MMcM/fdb-record-layer that referenced this issue Nov 17, 2022
* Equality comparisons take care of the corresponding key no matter where it occurs.
* Some unconditional sort advances got out-of-sync.
Fixes FoundationDB#1907: Sorting and comparing nested fields get confused
MMcM added a commit to MMcM/fdb-record-layer that referenced this issue Nov 17, 2022
* Equality comparisons take care of the corresponding key no matter where it occurs.
* Some unconditional sort advances got out-of-sync.
Fixes FoundationDB#1907: Sorting and comparing nested fields get confused
@MMcM MMcM closed this as completed in 78c2837 Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
planner Related to the query planner
Projects
None yet
Development

No branches or pull requests

1 participant