AMashenkov commented on code in PR #2199:
URL: https://github.com/apache/ignite-3/pull/2199#discussion_r1236786310


##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/framework/NoOpTransaction.java:
##########
@@ -43,14 +43,32 @@ public final class NoOpTransaction implements 
InternalTransaction {
 
     private final TablePartitionId groupId = new TablePartitionId(1, 0);
 
+    private final boolean readOnly;
+
     /**
-     * Constructs the object.
+     * Constructs a read only transaction.
      *
      * @param name Name of the node.
      */
     public NoOpTransaction(String name) {
+        this(name, true);
+    }
+
+    /**
+     * Constructs a transaction.
+     *
+     * @param name Name of the node.
+     * @param readOnly Read-only or not.
+     */
+    public NoOpTransaction(String name, boolean readOnly) {

Review Comment:
   ```suggestion
       public static NoOpTransation readOnly(String name) {
               return new NoOpTransation(name, true);
       }
       
      /**
      * Constructs a read-write transaction.
      *
      * @param name Name of the node.
      */
      public static NoOpTransation readWrite(String name) {
               return new NoOpTransation(name, false);
       }
       
       private NoOpTransaction(String name, boolean readOnly) {
   ```



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutableTableCallback.java:
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.engine.exec;
+
+import org.apache.ignite.internal.sql.engine.schema.TableDescriptor;
+
+/**
+ * Callback that is called when {@link ExecutableTable} is loaded.
+ */
+@FunctionalInterface
+public interface ExecutableTableCallback {

Review Comment:
   I didn't find this callback is ever used in production code. 
   The callback looks like a test stuff, let's drop it.
   The single place in tests, where it used, can be rewritten with Mockito.spy.



##########
modules/table/src/main/java/org/apache/ignite/internal/utils/PrimaryReplica.java:
##########
@@ -57,4 +59,26 @@ public ClusterNode node() {
     public long term() {
         return term;
     }
+
+    @Override

Review Comment:
   ```suggestion
       /** {@inheritDocs} */
       @Override
   ```



##########
modules/table/src/main/java/org/apache/ignite/internal/utils/PrimaryReplica.java:
##########
@@ -57,4 +59,26 @@ public ClusterNode node() {
     public long term() {
         return term;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        PrimaryReplica that = (PrimaryReplica) o;
+        return term == that.term && Objects.equals(node, that.node);
+    }
+
+    @Override

Review Comment:
   ```suggestion
       /** {@inheritDocs} */
       @Override
   ```



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java:
##########
@@ -293,6 +297,10 @@ public synchronized void start() {
         services.forEach(LifecycleAware::start);
     }
 
+    public ExecutionDependencyResolver dependencyResolver() {

Review Comment:
   ```suggestion
       @TestOnly
       public ExecutionDependencyResolver dependencyResolver() {
   ```



##########
modules/sql-engine/src/test/java/org/apache/ignite/internal/sql/engine/exec/ExecutableTableRegistrySelfTest.java:
##########
@@ -79,9 +88,10 @@ public void testGetTable() {
         CompletableFuture<ExecutableTable> f = tester.getTable(tableId);
         ExecutableTable executableTable = f.join();
 
-        assertNotNull(executableTable.scanableTable());
+        assertNotNull(executableTable.scannableTable());
         assertNotNull(executableTable.updatableTable());
-        assertNotNull(executableTable.rowConverter());
+
+        verify(callback).onTableLoaded(eq(executableTable), eq(TABLE_NAME), 
eq(descriptor));

Review Comment:
   You can use Mockito.spy on `registry` object instead of `callback`.



##########
modules/table/src/main/java/org/apache/ignite/internal/utils/PrimaryReplica.java:
##########
@@ -57,4 +59,26 @@ public ClusterNode node() {
     public long term() {
         return term;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        PrimaryReplica that = (PrimaryReplica) o;
+        return term == that.term && Objects.equals(node, that.node);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(node, term);
+    }
+
+    @Override

Review Comment:
   ```suggestion
       /** {@inheritDocs} */
       @Override
   ```



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to