ygerzhedovich commented on code in PR #7399:
URL: https://github.com/apache/ignite-3/pull/7399#discussion_r2687106907


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/PlannerHelper.java:
##########
@@ -231,6 +242,34 @@ public static IgniteRel optimize(SqlNode sqlNode, 
IgnitePlanner planner) {
         }
     }
 
+    private static RelNode tryDecorrelate(IgnitePlanner planner, RelNode rel) {
+        try {
+            // Currently, RelDecorrelator emits incorrect plan if the same 
correlation id is used
+            // in several relations.
+            rel.accept(new CorrelationUsedOnlyInSingleRelValidator());
+        } catch (FoundOne ignored) {
+            return rel;
+        }
+
+        RelBuilder relBuilder = 
Commons.FRAMEWORK_CONFIG.getSqlToRelConverterConfig()
+                .getRelBuilderFactory()
+                .create(planner.cluster(), null);
+
+        RelNode result = RelDecorrelator.decorrelateQuery(rel, relBuilder);
+        result = planner.transform(
+                PlannerPhase.HEP_PROJECT_TO_WINDOW, rel.getTraitSet(), result
+        );
+
+        try {
+            // Decorrelation may produce Window node which is currently not 
supported.

Review Comment:
   Seems having an additional ticket for that will be good



-- 
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]

Reply via email to