ccaominh commented on a change in pull request #9274: Refactoring some codes
around ingestion
URL: https://github.com/apache/druid/pull/9274#discussion_r373795008
##########
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);
+ }
+
+ @Override
+ public Set<Interval> getAllIntervalsToIndex()
+ {
+ return Collections.unmodifiableSet(intervalToPartitionBoundaries.keySet());
+ }
+
+ public void forEach(BiConsumer<Interval, PartitionBoundaries> consumer)
Review comment:
Can this be private?
----------------------------------------------------------------
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]