You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ygerzhedovich (via GitHub)" <gi...@apache.org> on 2025/03/18 15:07:15 UTC

[PR] IGNITE-24795 Sql. Add PROJECT_CORRELATE rule to HEP push down list [ignite-3]

ygerzhedovich opened a new pull request, #5437:
URL: https://github.com/apache/ignite-3/pull/5437

   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24795 Sql. Add PROJECT_CORRELATE rule to HEP push down list [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #5437:
URL: https://github.com/apache/ignite-3/pull/5437#discussion_r2010249244


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/CorrelatedSubqueryPlannerTest.java:
##########
@@ -68,7 +68,7 @@ public void test() throws Exception {
                 + "    OR c>d\n"
                 + " ORDER BY 1;";
 
-        IgniteRel rel = physicalPlan(sql, schema, "FilterTableScanMergeRule");
+        IgniteRel rel = physicalPlan(sql, schema, "FilterTableScanMergeRule", "IgniteProjectCorrelateTransposeRule");

Review Comment:
   This requires some reworking of the test, but I don't see the need for it.



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24795 Sql. Add PROJECT_CORRELATE rule to HEP push down list [ignite-3]

Posted by "zstan (via GitHub)" <gi...@apache.org>.
zstan commented on code in PR #5437:
URL: https://github.com/apache/ignite-3/pull/5437#discussion_r2013585567


##########
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:
   i replace it with common CoreRules.PROJECT_CORRELATE_TRANSPOSE, and all tests are passed, what did i miss ?



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24795 Sql. Add PROJECT_CORRELATE rule to HEP push down list [ignite-3]

Posted by "korlov42 (via GitHub)" <gi...@apache.org>.
korlov42 commented on code in PR #5437:
URL: https://github.com/apache/ignite-3/pull/5437#discussion_r2010167150


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/CorrelatedSubqueryPlannerTest.java:
##########
@@ -68,7 +68,7 @@ public void test() throws Exception {
                 + "    OR c>d\n"
                 + " ORDER BY 1;";
 
-        IgniteRel rel = physicalPlan(sql, schema, "FilterTableScanMergeRule");
+        IgniteRel rel = physicalPlan(sql, schema, "FilterTableScanMergeRule", "IgniteProjectCorrelateTransposeRule");

Review Comment:
   why did you disable new rule in this test?



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24795 Sql. Add PROJECT_CORRELATE rule to HEP push down list [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24795 Sql. Add PROJECT_CORRELATE rule to HEP push down list [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich commented on code in PR #5437:
URL: https://github.com/apache/ignite-3/pull/5437#discussion_r2010520889


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/planner/CorrelatedSubqueryPlannerTest.java:
##########
@@ -68,7 +68,7 @@ public void test() throws Exception {
                 + "    OR c>d\n"
                 + " ORDER BY 1;";
 
-        IgniteRel rel = physicalPlan(sql, schema, "FilterTableScanMergeRule");
+        IgniteRel rel = physicalPlan(sql, schema, "FilterTableScanMergeRule", "IgniteProjectCorrelateTransposeRule");

Review Comment:
   test has been reworked



-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-24795 Sql. Add PROJECT_CORRELATE rule to HEP push down list [ignite-3]

Posted by "ygerzhedovich (via GitHub)" <gi...@apache.org>.
ygerzhedovich merged PR #5437:
URL: https://github.com/apache/ignite-3/pull/5437


-- 
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-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org