tledkov-gridgain commented on a change in pull request #295: URL: https://github.com/apache/ignite-3/pull/295#discussion_r719453499
########## File path: modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableScanNode.java ########## @@ -0,0 +1,266 @@ +/* + * 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.List; +import java.util.Queue; +import java.util.concurrent.Flow; +import java.util.concurrent.Flow.Subscription; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.function.Function; +import java.util.function.Predicate; + +import org.apache.calcite.rel.type.RelDataType; +import org.apache.calcite.util.ImmutableBitSet; +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.schema.TableDescriptor; +import org.apache.ignite.internal.schema.BinaryRow; +import org.apache.ignite.internal.table.TableImpl; +import org.apache.ignite.internal.table.TableRow; +import org.jetbrains.annotations.Nullable; + +/** + * Scan node. + */ +public class TableScanNode<Row> extends AbstractNode<Row> { + /** Special value to highlights that all row were received and we are not waiting any more. */ + private static final int NOT_WAITING = -1; + + /** */ + private final TableImpl table; + + /** */ + private final TableDescriptor desc; + + /** */ + private final RowHandler.RowFactory<Row> factory; + + /** */ + private final int[] parts; + + /** */ + private final Queue<Row> inBuff = new LinkedBlockingQueue<>(inBufSize); + + /** */ + private final @Nullable Predicate<Row> filters; + + /** */ + private final @Nullable Function<Row, Row> rowTransformer; + + /** Participating columns. */ + private final @Nullable ImmutableBitSet requiredColumns; + + /** */ + private int requested; + + /** */ + private int waiting; + + /** */ + private boolean inLoop; + + /** */ + private Subscription activeSubscription; + + /** */ + private int curPartIdx; + + /** + * @param ctx Execution context. + * @param rowType Output type of the current node. + * @param desc Table descriptor this node should scan. + * @param parts Partition numbers to scan. + * @param filters Optional filter to filter out rows. + * @param rowTransformer Optional projection function. + * @param requiredColumns Optional set of column of interest. + */ + public TableScanNode( Review comment: Please add assertion check for the parts -- 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]
