tkalkirill commented on code in PR #13563:
URL: https://github.com/apache/ignite/pull/13563#discussion_r3967202747
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/RecursiveCteState.java:
##########
@@ -19,18 +19,31 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import
org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
+import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler;
+import
org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.GroupKey;
import
org.apache.ignite.internal.processors.query.calcite.exec.tracker.RowTracker;
import org.apache.ignite.internal.util.GridUnsafe;
/** Query-local current and next deltas of a recursive CTE. */
public class RecursiveCteState<Row> {
+ /** Rows seen across all iterations, or null for UNION ALL. */
+ private final Set<GroupKey<Row>> seen;
Review Comment:
Please add `@Nullable`.
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/RecursiveCteState.java:
##########
@@ -19,18 +19,31 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import
org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
+import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler;
+import
org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.GroupKey;
import
org.apache.ignite.internal.processors.query.calcite.exec.tracker.RowTracker;
import org.apache.ignite.internal.util.GridUnsafe;
/** Query-local current and next deltas of a recursive CTE. */
public class RecursiveCteState<Row> {
+ /** Rows seen across all iterations, or null for UNION ALL. */
+ private final Set<GroupKey<Row>> seen;
+
+ /** Row handler used for SQL grouping keys. */
+ private final RowHandler<Row> hnd;
+
+ /** Memory tracker for keys and their rows retained for duplicate
elimination. */
+ private final RowTracker<GroupKey<Row>> seenMemoryTracker;
Review Comment:
Is it needed without DISTINCT?
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/RepeatUnionNode.java:
##########
@@ -187,14 +185,13 @@ private void bindRecursiveScans(Node<Row> node) {
}
}
- /** Starts collecting and requests rows from the active input. */
+ /** Requests the remaining downstream demand from the active input. */
private void requestSource() throws Exception {
- if (!writing) {
- state.beginWrite();
- writing = true;
- }
+ checkState();
+
+ assert pending == 0;
Review Comment:
Please add error message with pending value.
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/RepeatUnionNode.java:
##########
@@ -87,53 +88,50 @@ public RepeatUnionNode(
/** {@inheritDoc} */
@Override public void push(Row row) throws Exception {
assert downstream() != null;
- assert waiting > 0;
- assert writing;
+ assert waiting > 0 && pending > 0;
Review Comment:
Please add error message with waiting and pending values.
--
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]