-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Handle half-eternity intervals while fetching segments with created dates #15608
Handle half-eternity intervals while fetching segments with created dates #15608
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach makes sense but minor changes needed in the code.
break; | ||
} | ||
} | ||
final boolean compareAsString = intervals.stream().allMatch(Intervals::canCompareEndpointsAsStrings); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename to compareIntervalsAsString
or compareIntervalEndpointsAsString
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
r.getString("created_date") | ||
) | ||
) | ||
.list() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would prefer to build this list and then filter it later in a separate statement only if intervals
is non-empty and we couldn't compare as strings.
So something like:
List<Pair<>> list = query.map().list();
if (intervals.isEmpty() || compareAsString) {
return list;
} else {
return list.stream().filter().collect();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This PR aims to fix a bug in retrieveUsedSegmentsAndCreatedDates where segments would not be returned for input intervals that partially overlap with eternity.
When the year does not lie in [1000, 9999], we fetch segments without a condition on the interval, and filter the results later (Similar to the method in SqlSegmentsMetadataQuery to fetch only payloads for segments)
This PR has: