Vladsz83 commented on code in PR #12600:
URL: https://github.com/apache/ignite/pull/12600#discussion_r2706766897
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanNode.java:
##########
@@ -34,13 +34,13 @@ public class ScanNode<Row> extends AbstractNode<Row>
implements SingleNode<Row>
private final Iterable<Row> src;
/** */
- @Nullable private final Predicate<Row> filter;
+ @Nullable protected final Predicate<Row> filter;
/** */
- @Nullable private final Function<Row, Row> rowTransformer;
+ @Nullable protected final Function<Row, Row> rowTransformer;
/** */
- private Iterator<Row> it;
+ protected Iterator<?> it;
Review Comment:
It is a `src`'s iterator. Why not `Row`-typed?
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanNode.java:
##########
@@ -146,25 +146,43 @@ private void push() throws Exception {
}
}
+ /**
+ * @return Next row, or {@code null} if row was filtered out.
+ */
+ protected Row processNextRow() {
Review Comment:
Suggestion: if it is able to produce null, let's mark the method result
`@Nullable`
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanTableRowNode.java:
##########
@@ -0,0 +1,115 @@
+/*
+ * 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 java.util.Iterator;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import org.apache.calcite.rel.type.RelDataType;
+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.TableRowIterable;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Scan table rows node.
Review Comment:
Suggestion: I would emphasize how it differs from `ScanStorageNode`. Also,
it might be renamed to something like `ThinScanStorageNode` ot
`FilterOrientedScanStorageNode`. Do we need any extra execution or Unit test
for this node?
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanNode.java:
##########
@@ -146,25 +146,43 @@ private void push() throws Exception {
}
}
+ /**
+ * @return Next row, or {@code null} if row was filtered out.
Review Comment:
Minor doc. 'Next row, or' -> 'Next row or'
##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementor.java:
##########
@@ -942,4 +945,46 @@ private Node<Row> visit(RelNode rel) {
public <T extends Node<Row>> T go(IgniteRel rel) {
return (T)visit(rel);
}
+
+ /** */
+ private ScanStorageNode<Row> createStorageScan(
+ String storageName,
+ RelDataType outputRowType,
+ RelDataType inputRowType,
+ Iterable<Row> rowsIter,
+ @Nullable Predicate<Row> filter,
+ @Nullable Function<Row, Row> rowTransformer,
+ @Nullable ImmutableBitSet requiredColumns,
+ @Nullable ImmutableBitSet filterColumns
+ ) {
+ int fieldsCnt = outputRowType.getFieldCount();
+
+ if (filter == null || filterColumns == null ||
filterColumns.cardinality() == fieldsCnt
Review Comment:
What if I do something like "select i1 from t where i2=?" Can it happen?
`filterColumns.cardinality() == fieldsCnt` but output field and filter field
are different. Do we need at least any assert here?
--
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]