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

Use alternate any_multiple_needles detection #1835

Conversation

DavisVaughan
Copy link
Member

@DavisVaughan DavisVaughan commented Apr 26, 2023

Closes tidyverse/dplyr#6835

We can't use the simple loc < size_needles check to see if we are in the "extra" match section. When a filter is involved, that isn't enough because we could have filtered out a match that occurred before the extra matches, so the extra match could actually be the first one.

However, since we process the needles in sequential order (i.e. needles 1 containment group 1, needle 1 containment group 2, needle 2 containment group 1, etc) we can track the previous needles loc in loc_needles_previous as a more correct way to see if we've already seen 1 match for that particular needle.

We can't use the simple `loc < size_needles` check to see if we are in the "extra" match section. When a filter is involved, that isn't enough because we could have filtered out a match that occurred before the extra matches, so the extra match could actually be the first one.
@DavisVaughan DavisVaughan merged commit 8af4752 into r-lib:main Apr 27, 2023
@DavisVaughan DavisVaughan deleted the fix/multiple-needle-matches-with-containment branch April 27, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inner_join incorrectly throws error
1 participant