Add paging deduplication when cropping. - #5458
Merged
Merged
Conversation
Contributor
Author
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5458 +/- ##
=============================================
+ Coverage 66.85% 66.90% +0.05%
- Complexity 15655 15734 +79
=============================================
Files 1817 1823 +6
Lines 70160 70366 +206
Branches 7383 7403 +20
=============================================
+ Hits 46904 47081 +177
- Misses 20798 20820 +22
- Partials 2458 2465 +7 ☔ View full report in Codecov by Sentry. |
Member
|
Can you merge dev2.x to get rid of the flaky test? |
Bartosz-Kruba
previously approved these changes
Nov 13, 2023
eibakke
marked this pull request as draft
November 13, 2023 12:48
eibakke
force-pushed
the
dedupe_filter
branch
from
November 13, 2023 13:52
acf0417 to
8a4068c
Compare
eibakke
marked this pull request as ready for review
November 13, 2023 14:04
Contributor
Author
|
Finally successfully merged in dev2.x - messed up a lot on the way, but back in a good state now. |
Bartosz-Kruba
previously approved these changes
Nov 16, 2023
t2gran
requested changes
Nov 16, 2023
t2gran
requested changes
Nov 16, 2023
t2gran
force-pushed
the
dedupe_filter
branch
from
November 20, 2023 10:09
61d6c23 to
3afb997
Compare
leonardehrenfried
approved these changes
Nov 20, 2023
t2gran
approved these changes
Nov 20, 2023
t2gran
left a comment
Member
There was a problem hiding this comment.
There is a few small refactorings that should be done here, but I will do those in another PR.
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.
Summary
Creates deduplication filter and adds deduplication information into the page cursor.
The paging deduplication compares an ItinerarySortKey from the page cursor to the set of itineraries to be returned. It then removes itineraries that sort on the "inside" of the ItinerarySortKey - ie. before the ItinerarySortKey when the tail is cropped and after the ItinerarySortKey when the head is cropped.
Issue
#5040
This PR solves the issue of duplicate itineraries described in the page cursor doc: https://github.com/opentripplanner/OpenTripPlanner/tree/dev-2.x/src/main/java/org/opentripplanner/model/plan/pagecursor#sort-by-arrival--crop-search-window
During implementation I discovered that duplicates can appear when paging in all four directions (forward and backward for arrive by and depart after searches). This change fixes the issue in all of them with a general solution.
Unit tests
I've added new unit tests and modified existing ones as needed. I've also tested extensively locally with conditions that uncovered duplicate issues in all directions.
Documentation
I've added documentation as JavaDoc. I will update the page cursor readme in a follow up change.