ygerzhedovich commented on code in PR #5437: URL: https://github.com/apache/ignite-3/pull/5437#discussion_r2013876772
########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/rule/logical/IgniteProjectCorrelateTransposeRule.java: ########## @@ -0,0 +1,259 @@ +/* + * 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.ignite.internal.sql.engine.rule.logical; + +import static java.util.Objects.requireNonNull; + +import java.util.BitSet; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.calcite.plan.RelOptRule; +import org.apache.calcite.plan.RelOptRuleCall; +import org.apache.calcite.plan.RelRule; +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.RelShuttleImpl; +import org.apache.calcite.rel.core.Correlate; +import org.apache.calcite.rel.core.CorrelationId; +import org.apache.calcite.rel.core.Project; +import org.apache.calcite.rel.logical.LogicalTableFunctionScan; +import org.apache.calcite.rel.rules.CoreRules; +import org.apache.calcite.rel.rules.ProjectCorrelateTransposeRule; +import org.apache.calcite.rel.rules.PushProjector; +import org.apache.calcite.rel.rules.TransformationRule; +import org.apache.calcite.rex.RexBuilder; +import org.apache.calcite.rex.RexCall; +import org.apache.calcite.rex.RexCorrelVariable; +import org.apache.calcite.rex.RexFieldAccess; +import org.apache.calcite.rex.RexNode; +import org.apache.calcite.rex.RexOver; +import org.apache.calcite.rex.RexShuttle; +import org.apache.calcite.util.BitSets; +import org.apache.calcite.util.ImmutableBitSet; +import org.apache.ignite.internal.sql.engine.rule.logical.IgniteProjectCorrelateTransposeRule.IgniteProjectCorrelateTransposeRuleConfig; +import org.immutables.value.Value; + +/** + * Planner rule that pushes a {@link Project} under {@link Correlate} to apply on Correlate's left and right inputs. + * + * <p>There are two differences between this rule and {@link ProjectCorrelateTransposeRule}: + * 1. Take into account RexCall parameters for functions in LogicalTableFunctionScan like a SYSTEM_RANGE. + * See RelNodesExprsHandler#visit(RelNode) + * 2. Fixed an issue for trying amend correlation for incorrect case. See RexFieldAccessReplacer#visitFieldAccess(RexFieldAccess) + * + * @see CoreRules#PROJECT_CORRELATE_TRANSPOSE + */ +@Value.Enclosing +public class IgniteProjectCorrelateTransposeRule Review Comment: It's not so true. You should see a few failed tests in SqlLogic. Just look for previous builds, e.g. https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8960805 But, I've rewritten one of the new test to show the problem -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org