capistrant commented on code in PR #18939: URL: https://github.com/apache/druid/pull/18939#discussion_r2813933173
########## indexing-service/src/main/java/org/apache/druid/indexing/compact/ReindexingDeletionRuleOptimizer.java: ########## @@ -0,0 +1,190 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.indexing.compact; + +import org.apache.druid.java.util.common.logger.Logger; +import org.apache.druid.query.filter.DimFilter; +import org.apache.druid.query.filter.NotDimFilter; +import org.apache.druid.query.filter.OrDimFilter; +import org.apache.druid.segment.VirtualColumn; +import org.apache.druid.segment.VirtualColumns; +import org.apache.druid.segment.metadata.IndexingStateFingerprintMapper; +import org.apache.druid.server.compaction.CompactionCandidate; +import org.apache.druid.server.compaction.ReindexingDeletionRule; +import org.apache.druid.timeline.CompactionState; +import org.apache.druid.timeline.DataSegment; + +import javax.annotation.Nullable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * Optimization utilities for applying {@link ReindexingDeletionRule}s during reindexing + * <p> + * When reindexing with {@link ReindexingDeletionRule}s, it is possible that candidate + * segments have already applied some or all of the deletion rules in previous reindexing runs. Reapplying such rules would + * be wasteful and redundant. This class provides funcionality to optimize the set of rules to be applied by + * any given reindexing task. + */ +public class ReindexingDeletionRuleOptimizer Review Comment: fair point. This was the child of me wanting to make CascadingReindexingTemplate less dense and I didn't scrutinize my approach very well. My thinking here is to actually make this all an implementation of what is previously called `ReindexingConfigFinalizer` The CascadingReindexingTemplate creates one of these Optimizers and passes it to the underlying job template to call optimize on. In the future if the cascading template had more optimizations, you could like add different optimizer implementations and chain them? -- 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]
