loquisgon commented on a change in pull request #10742:
URL: https://github.com/apache/druid/pull/10742#discussion_r557783333



##########
File path: 
indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractBatchIndexTask.java
##########
@@ -398,22 +375,21 @@ private boolean 
tryLockWithDetermineResult(TaskActionClient client, LockGranular
 
   protected boolean tryTimeChunkLock(TaskActionClient client, List<Interval> 
intervals) throws IOException
   {
-    // The given intervals are first converted to align with segment 
granularity. This is because,
-    // when an overwriting task finds a version for a given input row, it 
expects the interval
-    // associated to each version to be equal or larger than the time bucket 
where the input row falls in.
-    // See ParallelIndexSupervisorTask.findVersion().
-    final Set<Interval> uniqueIntervals = new HashSet<>();
+
+    // In this case, the intervals to lock must be aligned with 
segmentGranularity if it's defined
+    final Iterator<Interval> intervalIterator;
     final Granularity segmentGranularity = getSegmentGranularity();
-    for (Interval interval : intervals) {
-      if (segmentGranularity == null) {
-        uniqueIntervals.add(interval);
-      } else {
-        Iterables.addAll(uniqueIntervals, 
segmentGranularity.getIterable(interval));
-      }
+    if (segmentGranularity == null) {
+      Set<Interval> uniqueIntervals = new HashSet<>(intervals);
+      ArrayList<Interval> condensedIntervals = JodaUtils.condenseIntervals(() 
-> uniqueIntervals.iterator());
+      intervalIterator = condensedIntervals.iterator();
+    } else {
+      IntervalsByGranularity intervalsByGranularity = new 
IntervalsByGranularity(intervals, segmentGranularity);

Review comment:
       I will fix this in the next commit




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to