ankitsultana commented on code in PR #15743: URL: https://github.com/apache/pinot/pull/15743#discussion_r2085677019
########## pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/v2/opt/rules/LiteModeWorkerAssignmentRule.java: ########## @@ -0,0 +1,118 @@ +/** + * 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.pinot.query.planner.physical.v2.opt.rules; + +import com.google.common.annotations.VisibleForTesting; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.stream.Collectors; +import javax.annotation.Nullable; +import org.apache.calcite.rel.RelDistribution; +import org.apache.pinot.calcite.rel.traits.PinotExecStrategyTrait; +import org.apache.pinot.query.context.PhysicalPlannerContext; +import org.apache.pinot.query.planner.physical.v2.ExchangeStrategy; +import org.apache.pinot.query.planner.physical.v2.PRelNode; +import org.apache.pinot.query.planner.physical.v2.PinotDataDistribution; +import org.apache.pinot.query.planner.physical.v2.nodes.PhysicalExchange; +import org.apache.pinot.query.planner.physical.v2.opt.PRelNodeTransformer; + + +/** + * Lite mode uses a single worker for all stages except the leaf stage. Since leaf stage assignment is done before this + * rule is called, we simply need to sample a random worker from the leaf stage, and assign it to all the non-leaf + * plan nodes. + */ +public class LiteModeWorkerAssignmentRule implements PRelNodeTransformer { + private static final Random RANDOM = new Random(); Review Comment: Abstraction can definitely be considered as we evolve this. I think right now it's a bit too early. I am planning to add support for parallelism, server pruning, etc. soon so that will also increase the case handling of this Rule a bit. -- 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]
