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

Union comparison key for union merge can contain duplicates after #2557 #2563

Open
alecgrieser opened this issue Mar 7, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@alecgrieser
Copy link
Contributor

It looks like after #2557, there's now a possibility that we get problems with the plan ordering key for an in-union plan containing FanOut key expressions. This can happen in a scenario like:

RecordQuery.newBuilder()
     .setRecordType(type)
     .where(Query.or(
         Query.field("repeated").oneOfThem().matches(Query.field("foo").equalsParameter(p1)),
         Query.field("repeated").oneOfThem().matches(Query.field("foo").equalsParameter(p2))
      ))
     .build()

If there's an index on field("repeated", FanType.FanOut).nest("foo"), then this index can be selected, with two legs being unioned together. We previously were rejecting that plan because of an "unordered distinct" meaning that we wouldn't have enough information to select the ordering key, but with #2557, we started selecting this index with a plan ordering key that still contained the repeated field (though perhaps it doesn't need to). This results in a runtime exception with the message "Should evaluate to single key only" coming from a call to evaulateSingleton in the union execution logic.

@alecgrieser alecgrieser added the bug Something isn't working label Mar 7, 2024
@alecgrieser alecgrieser self-assigned this Mar 7, 2024
alecgrieser added a commit to alecgrieser/fdb-record-layer that referenced this issue Mar 7, 2024
alecgrieser added a commit to alecgrieser/fdb-record-layer that referenced this issue Mar 7, 2024
MMcM pushed a commit that referenced this issue Mar 7, 2024
* Revert "Resolves #2556: FailedInJoinAsUnion support for unordered distinct (#2557)"

This reverts commit e411e1f.

* Revert #2557: FailedInJoinAsUnion support for unordered distinct

This reverts #2557 because of the issue alluded to in #2563.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant