-
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
Enhance RequireTimeCondition to handle complex joins #17408
base: master
Are you sure you want to change the base?
Conversation
if (plannerContext.getPlannerConfig().isRequireTimeCondition() | ||
&& !(druidQuery.getDataSource() instanceof InlineDataSource)) { | ||
if (Intervals.ONLY_ETERNITY.equals(findBaseDataSourceIntervals(query))) { | ||
if (!queryHasTimeFilter(query)) { |
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.
can you move this over to DataSourceAnalysis
?
I feel that this would fit better there.
you could use druidQuery.getDataSource().getAnalysis()
to access it here.
I think that should also handle the druidQuery.getDataSource() instanceof InlineDataSource
correctly; and shouldn't be checked at this point.
if (dataSource instanceof InlineDataSource) { | ||
return true; | ||
} | ||
if (dataSource instanceof QueryDataSource) { | ||
return queryHasTimeFilter(((QueryDataSource) dataSource).getQuery()); | ||
} | ||
if (dataSource instanceof JoinDataSource) { | ||
return joinDataSourceHasTimeFilter((JoinDataSource) dataSource); | ||
} | ||
if (dataSource.getAnalysis().getBaseQuerySegmentSpec().isPresent()) { | ||
return isIntervalNonEternity(dataSource.getAnalysis() | ||
.getBaseQuerySegmentSpec() | ||
.map(QuerySegmentSpec::getIntervals) | ||
.get()); | ||
} | ||
return false; |
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.
the pattern of this method makes me wonder if it would be better to have a method on DataSource
instead (with a default
implementation to return false) so that every relevant subclass could implement it correctly?
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.
Thanks for takin a look @kgyrtkirk . Makes sense to have this at the DataSource level. Made the necessary changes.
Fixes #17407 .
Description
Additions to NativeQueryMaker to handle JoinQueries.
Checks for a valid timefilter on the top level query if the left join data source is a TableDataSource. Makes sure both left and right datasources have valid timefilters and traverses nested join data sources recursively to check for valid time filter. We still ignore InlineDataSource if they're part of the JoinDataSource (existing behavior)
Fixed the bug ...
Renamed the class ...
Added a forbidden-apis entry ...
Release note
Key changed/added classes in this PR
NativeQueryMaker
This PR has: