FederatedQueryPlanner.getSubQueryDateRanges can return an illegal range and is skipping some time periods #2680
+230
−51
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.
FederatedQueryPlanner.getSubQueryDateRanges can return an illegal range and is skipping some time periods (#2679)
Because the index holes are all time midnight, when the final index hole is on the same day as the query endDate but the query endDate is not midnight, the FederatedQueryPlanner is returning a Pair<Date,Date> where the beginDate > endDate
The current logic is also uses oneDayBefore and oneDayAfter in places where oneMsBefore and oneMsAfter are required. This is causing whole days to be missed when generating subRanges to cover a query date range.
The oneDayBefore and oneDayAfter logic is also causing small periods on the edge of the subRanges to violate the purpose of the method -- that all sub ranges contain all dates with no index holes or all dates with index holes.
In FederatedQueryPlanner, usages of Calendar were moved to local variables rather than a class variable to avoid the possibility of thread un-safe access.
Added more robust testing to verify fixes and prevent regression