jihoonson commented on a change in pull request #9274: Refactoring some codes 
around ingestion
URL: https://github.com/apache/druid/pull/9274#discussion_r374439523
 
 

 ##########
 File path: 
indexing-service/src/main/java/org/apache/druid/indexing/common/task/batch/partition/RangePartitionAnalysis.java
 ##########
 @@ -17,80 +17,109 @@
  * under the License.
  */
 
-package org.apache.druid.indexing.common.task;
+package org.apache.druid.indexing.common.task.batch.partition;
 
 import com.google.common.collect.Maps;
-import org.apache.druid.data.input.InputRow;
+import org.apache.druid.indexer.partitions.SingleDimensionPartitionsSpec;
 import org.apache.druid.indexing.common.TaskToolbox;
-import 
org.apache.druid.indexing.common.task.batch.parallel.distribution.PartitionBoundaries;
 import org.apache.druid.segment.realtime.appenderator.SegmentIdWithShardSpec;
+import org.apache.druid.timeline.partition.PartitionBoundaries;
 import org.apache.druid.timeline.partition.SingleDimensionShardSpec;
 import org.joda.time.Interval;
 
 import javax.annotation.Nullable;
-import java.io.IOException;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
+import java.util.function.BiConsumer;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
-/**
- * Allocates all necessary range-partitioned segments locally at the beginning 
and reuses them.
- *
- * @see CachingLocalSegmentAllocatorHelper
- */
-public class RangePartitionCachingLocalSegmentAllocator implements 
IndexTaskSegmentAllocator
+public class RangePartitionAnalysis
+    implements CompletePartitionAnalysis<PartitionBoundaries, 
SingleDimensionPartitionsSpec>
 {
-  private final String dataSource;
-  private final String partitionDimension;
-  private final Map<Interval, PartitionBoundaries> intervalsToPartitions;
-  private final IndexTaskSegmentAllocator delegate;
+  private final Map<Interval, PartitionBoundaries> 
intervalToPartitionBoundaries = new HashMap<>();
+  private final SingleDimensionPartitionsSpec partitionsSpec;
+
+  public RangePartitionAnalysis(SingleDimensionPartitionsSpec partitionsSpec)
+  {
+    this.partitionsSpec = partitionsSpec;
+  }
+
+  @Override
+  public SingleDimensionPartitionsSpec getPartitionsSpec()
+  {
+    return partitionsSpec;
+  }
+
+  @Override
+  public void updateBucket(Interval interval, PartitionBoundaries 
bucketAnalysis)
+  {
+    intervalToPartitionBoundaries.put(interval, bucketAnalysis);
+  }
+
+  @Override
+  public PartitionBoundaries getBucketAnalysis(Interval interval)
+  {
+    return intervalToPartitionBoundaries.get(interval);
 
 Review comment:
   Good catch! I fixed the code and updated the javadoc. I want to add unit 
tests for this but think it would be easier to do in the follow-up PR.

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


With regards,
Apache Git Services

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

Reply via email to