clintropolis opened a new pull request #10968:
URL: https://github.com/apache/druid/pull/10968


   ### Description
   This PR fixes an issue where Calcite optimizes the time filter to false or 
some combination of all false filters in an "and" or "or" filter, resulting in 
the filtration for the query in the planner making a `GroupByQuery` with an 
empty interval, but this explodes in the constructor because 
`computeUniversalTimestamp` doesn't handle this case and expects there to be a 
start timestamp. This results in an unfriendly 
   
   ```
   java.lang.IndexOutOfBoundsException: index (0) must be less than size (0)
   
        at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:313)
        at 
com.google.common.base.Preconditions.checkElementIndex(Preconditions.java:295)
        at 
com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:65)
        at java.util.Collections$UnmodifiableList.get(Collections.java:1311)
        at 
org.apache.druid.query.groupby.GroupByQuery.computeUniversalTimestamp(GroupByQuery.java:723)
        at 
org.apache.druid.query.groupby.GroupByQuery.<init>(GroupByQuery.java:221)
        at 
org.apache.druid.query.groupby.GroupByQuery.<init>(GroupByQuery.java:89)
        at 
org.apache.druid.query.groupby.GroupByQuery$Builder.build(GroupByQuery.java:1180)
   ...
   ```
   instead of returning empty results. 
   
   I also added some additional short circuits for always false conditions in 
`CombineAndSimplifyBounds` based on observations in debugger while testing this 
issue.
   
   <hr>
   
   
   This PR has:
   - [x] been self-reviewed.
   - [x] added unit tests or modified existing tests to cover new code paths, 
ensuring the threshold for [code 
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
 is met.
   - [x] been tested in a test Druid cluster.
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to