korlov42 commented on code in PR #817:
URL: https://github.com/apache/ignite-3/pull/817#discussion_r882494102


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/api/AsyncResultSetImpl.java:
##########
@@ -0,0 +1,424 @@
+/*
+ * 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.sql.api;
+
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.util.BitSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionStage;
+import org.apache.ignite.binary.BinaryObject;
+import org.apache.ignite.internal.sql.engine.AsyncCursor.BatchedResult;
+import org.apache.ignite.internal.sql.engine.AsyncSqlCursor;
+import org.apache.ignite.internal.sql.engine.SqlQueryType;
+import org.apache.ignite.sql.NoRowSetExpectedException;
+import org.apache.ignite.sql.ResultSetMetadata;
+import org.apache.ignite.sql.SqlRow;
+import org.apache.ignite.sql.async.AsyncResultSet;
+import org.apache.ignite.table.Tuple;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Asynchronous result set implementation.
+ */
+public class AsyncResultSetImpl implements AsyncResultSet {
+    private static final CompletableFuture<? extends AsyncResultSet> 
HAS_NO_MORE_PAGE_FUTURE =
+            CompletableFuture.failedFuture(new IgniteSqlException("There are 
no more pages."));
+
+    private final AsyncSqlCursor<List<Object>> cur;
+
+    private final BatchedResult<List<Object>> batchPage;
+
+    private final Page page;
+
+    private final int pageSize;
+
+    private final Runnable closeRun;
+
+    private final Object mux = new Object();
+
+    private volatile CompletionStage<? extends AsyncResultSet> next;
+
+    /**
+     * Constructor.
+     *
+     * @param cur Asynchronous query cursor.
+     */
+    public AsyncResultSetImpl(AsyncSqlCursor<List<Object>> cur, 
BatchedResult<List<Object>> page, int pageSize, Runnable closeRun) {
+        this.cur = cur;
+        this.batchPage = page;
+        this.pageSize = pageSize;
+        this.closeRun = closeRun;
+        this.page = new Page();
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public @Nullable ResultSetMetadata metadata() {
+        throw new UnsupportedOperationException("Not implemented yet.");
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public boolean hasRowSet() {
+        return cur.queryType() == SqlQueryType.QUERY || cur.queryType() == 
SqlQueryType.EXPLAIN;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public long affectedRows() {
+        if (hasRowSet() || cur.queryType() == SqlQueryType.DDL) {

Review Comment:
   I don't think so. An affectedRows should return amount of rows which were 
actually affected by the query, but explain returns a plan only without actual 
execution of this plan



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