ankitsultana commented on code in PR #15439: URL: https://github.com/apache/pinot/pull/15439#discussion_r2029313208
########## pinot-query-planner/src/main/java/org/apache/pinot/calcite/rel/rules/PinotLogicalAggregateRule.java: ########## @@ -0,0 +1,198 @@ +/** + * 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.calcite.rel.rules; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import javax.annotation.Nullable; +import org.apache.calcite.plan.Context; +import org.apache.calcite.plan.RelOptRule; +import org.apache.calcite.plan.RelOptRuleCall; +import org.apache.calcite.rel.RelFieldCollation; +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.core.Aggregate; +import org.apache.calcite.rel.core.Project; +import org.apache.calcite.rel.core.Sort; +import org.apache.calcite.rel.logical.LogicalAggregate; +import org.apache.calcite.rex.RexInputRef; +import org.apache.calcite.rex.RexLiteral; +import org.apache.calcite.rex.RexNode; +import org.apache.calcite.tools.RelBuilderFactory; +import org.apache.pinot.calcite.rel.hint.PinotHintOptions; +import org.apache.pinot.calcite.rel.hint.PinotHintStrategyTable; +import org.apache.pinot.calcite.rel.logical.PinotLogicalAggregate; +import org.apache.pinot.query.QueryEnvironment; +import org.apache.pinot.query.planner.plannode.AggregateNode.AggType; +import org.apache.pinot.spi.utils.CommonConstants; + + +/** + * Same as {@link PinotAggregateExchangeNodeInsertRule}, with the following differences: + * <ol> + * <li>We don't generate project under the aggregate.</li> + * <li>We don't generate exchange and merely generate a PinotLogicalAggregate.</li> + * <li>We don't convert Agg Calls.</li> + * </ol> + * All of these will be done in the Physical Planning phase instead, since that is when we will know whether the + * aggregate has been split or not. (e.g. project under aggregate is required when you skip partial aggregate). + */ +public class PinotLogicalAggregateRule { Review Comment: Ah that's a very good point. I added a tracker for this here: https://github.com/apache/pinot/issues/15319?issue=apache%7Cpinot%7C15467 I think I'll then be able to do all the aggregate cleanup in a single rule which would be significantly more intuitive. -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org