rohangarg commented on PR #13310:
URL: https://github.com/apache/druid/pull/13310#issuecomment-1303178331

   Regarding the suggested query improvement, I think `BETWEEN` is an inclusive 
operator on both sides so it might also bring the same results as the current 
query. Also, the performance in worst case might be slower.
   Incase we want to eventually do a `Interval#overlaps` over the queried 
interval with the intervals in the pending segments table rows, we could follow 
the logic in that method and push it down in the metadata store query. The 
`Interval#overlaps` function is as follows : 
   ```
   public boolean overlaps(ReadableInterval interval) {
           long thisStart = getStartMillis();
           long thisEnd = getEndMillis();
           if (interval == null) {
               long now = DateTimeUtils.currentTimeMillis();
               return (thisStart < now && now < thisEnd);
           }  else {
               long otherStart = interval.getStartMillis();
               long otherEnd = interval.getEndMillis();
               return (thisStart < otherEnd && otherStart < thisEnd);
           }
   }
   ```


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

Reply via email to