You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by am...@apache.org on 2021/11/22 15:38:24 UTC

[ignite-3] 01/01: WIP. Minor after review.

This is an automated email from the ASF dual-hosted git repository.

amashenkov pushed a commit to branch ignite-15212
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit 7e52858f159de37f1ba4d0c7e532ad65cb2143a8
Author: Andrew Mashenkov <an...@gmail.com>
AuthorDate: Mon Nov 22 18:24:57 2021 +0300

    WIP. Minor after review.
---
 .../java/org/apache/ignite/sql/MultiResultSet.java | 27 ---------------------
 .../main/java/org/apache/ignite/sql/Session.java   |  3 +--
 modules/sql/src/test/java/IgniteSqlTest.java       | 28 ++--------------------
 3 files changed, 3 insertions(+), 55 deletions(-)

diff --git a/modules/api/src/main/java/org/apache/ignite/sql/MultiResultSet.java b/modules/api/src/main/java/org/apache/ignite/sql/MultiResultSet.java
deleted file mode 100644
index 6656f9b..0000000
--- a/modules/api/src/main/java/org/apache/ignite/sql/MultiResultSet.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.sql;
-
-/**
- * Result set for multi-statement query.
- */
-public interface MultiResultSet extends Iterable<ResultSet>, AutoCloseable {
-    /** {@inheritDoc} */
-    @Override
-    void close();
-}
diff --git a/modules/api/src/main/java/org/apache/ignite/sql/Session.java b/modules/api/src/main/java/org/apache/ignite/sql/Session.java
index 76549af..5f5decf 100644
--- a/modules/api/src/main/java/org/apache/ignite/sql/Session.java
+++ b/modules/api/src/main/java/org/apache/ignite/sql/Session.java
@@ -83,10 +83,9 @@ public interface Session extends AsyncSession, ReactiveSession {
      *
      * @param query     SQL query template.
      * @param arguments Arguments for the template (optional).
-     * @return SQL query results set.
      * @throws SqlException If failed.
      */
-    MultiResultSet executeScript(@NotNull String query, Object... arguments);
+    void executeScript(@NotNull String query, Object... arguments);
 
     /**
      * Sets session property.
diff --git a/modules/sql/src/test/java/IgniteSqlTest.java b/modules/sql/src/test/java/IgniteSqlTest.java
index 1646b93..fe87d4a 100644
--- a/modules/sql/src/test/java/IgniteSqlTest.java
+++ b/modules/sql/src/test/java/IgniteSqlTest.java
@@ -35,7 +35,6 @@ import org.apache.ignite.internal.schema.SchemaRegistry;
 import org.apache.ignite.internal.util.Constants;
 import org.apache.ignite.schema.definition.ColumnType;
 import org.apache.ignite.sql.IgniteSql;
-import org.apache.ignite.sql.MultiResultSet;
 import org.apache.ignite.sql.ResultSet;
 import org.apache.ignite.sql.ResultSetMetadata;
 import org.apache.ignite.sql.Session;
@@ -130,18 +129,11 @@ public class IgniteSqlTest {
     public void testSyncMultiStatementSql() {
         Session sess = queryMgr.newSession();
 
-        MultiResultSet multiRs = sess.executeScript(
+        sess.executeScript(
                 "CREATE TABLE tbl(id INTEGER PRIMARY KEY, val VARCHAR);"
                         + "INSERT INTO tbl VALUES (1, 2);"
-                        + "SELECT id, val FROM tbl WHERE id == {};"
+                        + "INSERT INTO tbl2 (SELECT id, val FROM tbl WHERE id == {});"
                         + "DROP TABLE tbl", 10);
-
-        Iterator<ResultSet> iterator = multiRs.iterator();
-        //TODO: Closable iterator.
-
-        ResultSet rs = iterator.next();
-
-        String str = rs.iterator().next().stringValue("val");
     }
 
     @Disabled
@@ -323,21 +315,6 @@ public class IgniteSqlTest {
                     return CompletableFuture.completedFuture(page1);
                 });
 
-        Mockito.when(session.executeScript(Mockito.any(), Mockito.any()))
-                .thenAnswer(
-                        ans0 -> Mockito.when(Mockito.mock(MultiResultSet.class).iterator())
-                                .thenAnswer(
-                                        ans1 -> Mockito.when(Mockito.mock(Iterator.class).next())
-                                                .thenAnswer(
-                                                        ans2 -> Mockito
-                                                                .when(Mockito.mock(ResultSet.class)
-                                                                        .iterator())
-                                                                .thenReturn(query1Resuls.iterator())
-                                                                .getMock()
-                                                ).getMock()
-                                ).getMock()
-                );
-
         Mockito.when(session.executeReactive(
                 Mockito.startsWith("SELECT id, val FROM tbl WHERE id < {} AND val LIKE {};"),
                 Mockito.nullable(Transaction.class), Mockito.any(), Mockito.any()))
@@ -371,7 +348,6 @@ public class IgniteSqlTest {
     }
 
 
-
     static class SqlRowSubscriber extends CompletableFuture<Void> implements
             Flow.Subscriber<SqlRow> {
         private Consumer<SqlRow> rowConsumer;