vldpyatkov commented on code in PR #13479:
URL: https://github.com/apache/ignite/pull/13479#discussion_r3854171017


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/RepeatUnionNode.java:
##########
@@ -0,0 +1,163 @@
+/*
+ * 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.processors.query.calcite.exec.rel;
+
+import org.apache.calcite.rel.type.RelDataType;
+import 
org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
+import org.apache.ignite.internal.util.typedef.F;
+
+/** Coordinator-side executor for recursive UNION ALL. */
+public class RepeatUnionNode<Row> extends AbstractNode<Row> implements 
Downstream<Row> {
+    /** Index of the seed input. */
+    private static final int SEED_SOURCE = 0;
+
+    /** Index of the recursive-term input. */
+    private static final int RECURSIVE_SOURCE = 1;
+
+    /** Query-local recursive state. */
+    private final RecursiveCteState<Row> state;
+
+    /** Maximum number of recursive iterations, or a negative value for no 
limit. */
+    private final int iterationLimit;

Review Comment:
   I understand the intention to protect the query from infinite recursion. 
However, I would prefer not to hard-code an arbitrary positive limit, such as 
100, because the SQL standard does not define such a limit and valid queries 
may require more iterations. Moreover, we always can create an explicit 
recursive parameter (like LEVEL in Oracle) to limit recursion depth through the 
query.
   Calcite represents (RepeatUnion#iterationLimit) the iteration limit 
explicitly and defines the following semantics: -1 means unlimited recursion, 0 
returns only the seed, and N allows no more than N recursive iterations. We 
currently preserve this value throughout the execution path:
   LogicalRepeatUnion → RecursiveCteConverterRule → IgniteRepeatUnion → 
RepeatUnionNode.
   If we want a safety limit, I think it should be configurable rather than 
hard-coded. We can create a separate ticket to expose it through a query-level 
hint, for example MAX_RECURSION(100). Do you think we should create such a 
ticket?



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