adarshsanjeev commented on code in PR #17726:
URL: https://github.com/apache/druid/pull/17726#discussion_r1963181459
##########
processing/src/main/java/org/apache/druid/query/Queries.java:
##########
@@ -161,21 +161,18 @@ public static <T> Query<T> withSpecificSegments(final
Query<T> query, final List
retVal = query.withDataSource(new
QueryDataSource(withSpecificSegments(subQuery, descriptors)));
} else {
retVal = query.withQuerySegmentSpec(new
MultipleSpecificSegmentSpec(descriptors));
- }
- // Verify preconditions and invariants, just in case.
- final DataSource retDataSource = retVal.getDataSource();
- final DataSourceAnalysis analysis = retDataSource.getAnalysis();
+ // Verify preconditions and invariants, just in case.
+ final DataSourceAnalysis analysis = retVal.getDataSourceAnalysis();
- // Sanity check: query must be based on a single table.
- analysis.getBaseTableDataSource();
+ // Sanity check: query must be based on a single table.
+ analysis.getBaseTableDataSource();
- if (analysis.getBaseQuerySegmentSpec().isPresent()
- && !analysis.getBaseQuerySegmentSpec().get().equals(new
MultipleSpecificSegmentSpec(descriptors))) {
- // If you see the error message below, it's a bug in either this
function or in DataSourceAnalysis.
- throw new ISE("Unable to apply specific segments to query with
dataSource[%s]", query.getDataSource());
+ if (!analysis.getEffectiveQuerySegmentSpec().equals(new
MultipleSpecificSegmentSpec(descriptors))) {
+ // If you see the error message below, it's a bug in either this
function or in DataSourceAnalysis.
+ throw new ISE("Unable to apply specific segments to query with
dataSource[%s]", query.getDataSource());
Review Comment:
Could change this to a DruidException.defensive
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]