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

FederatedQueryPlanner.getSubQueryDateRanges can return an illegal range and is skipping some time periods #2680

Open
wants to merge 2 commits into
base: integration
Choose a base branch
from

Conversation

billoley
Copy link
Collaborator

@billoley billoley commented Jan 6, 2025

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

// If the start of the first hole occurs after the configured start date, add a range spanning from the start date to one day before the start
// of the first hole.
// If the start of the first index hole occurs after the configured start date, add a range spanning from
// the beginDate to one day before the start of the first index hole.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "one ms before the start of the first index hole" ?

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.

FederatedQueryPlanner.getSubQueryDateRanges can return an illegal range and is skipping some time periods
3 participants