ygerzhedovich commented on code in PR #1469:
URL: https://github.com/apache/ignite-3/pull/1469#discussion_r1058473333


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlAsynchronousApiTest.java:
##########
@@ -343,37 +346,59 @@ public void checkTransactionsWithDml() throws Exception {
         assertEquals(txManagerInternal.finished(), states.size());
     }
 
-    /** Check correctness of rw and ro transactions. */
+    /** Check correctness of rw and ro transactions for index scan. */
     @Test
-    public void checkMixedTransactions() throws Exception {
+    public void checkMixedTransactionsForIndex() throws Exception {
+        sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
+
+        Matcher<String> planMatcher = containsTableScan("PUBLIC", "TEST");
+
+        checkMixedTransactions(planMatcher);
+    }
+
+
+    /** Check correctness of rw and ro transactions for table scan. */
+    @Test
+    public void checkMixedTransactionsForTable() throws Exception {
+        sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
+        sql("CREATE INDEX TEST_IDX ON TEST(VAL0)");
+
+        Matcher<String> planMatcher = containsIndexScan("PUBLIC", "TEST", 
"TEST_IDX");
+
+        checkMixedTransactions(planMatcher);
+    }
+
+    private void checkMixedTransactions(Matcher<String> planMatcher) throws 
Exception {
         IgniteSql sql = igniteSql();
 
         if (sql instanceof ClientSql) {
             return;
         }
 
-        sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
-
         Session ses = sql.createSession();
 
         for (int i = 0; i < ROW_COUNT; ++i) {
             sql("INSERT INTO TEST VALUES (?, ?)", i, i);
         }
 
-        checkTx(ses, true, false, true);
-        checkTx(ses, true, false, false);
-        checkTx(ses, true, true, true);
-        checkTx(ses, true, true, false);
-        checkTx(ses, false, true, true);
-        checkTx(ses, false, true, false);
-        checkTx(ses, false, false, true);
-        checkTx(ses, false, false, false);
+        checkTx(ses, true, false, true, planMatcher);
+        checkTx(ses, true, false, false, planMatcher);
+        checkTx(ses, true, true, true, planMatcher);
+        checkTx(ses, true, true, false, planMatcher);
+        checkTx(ses, false, true, true, planMatcher);
+        checkTx(ses, false, true, false, planMatcher);
+        checkTx(ses, false, false, true, planMatcher);
+        checkTx(ses, false, false, false, planMatcher);
     }
 
-    private void checkTx(Session ses, boolean readOnly, boolean commit, 
boolean explicit) throws Exception {
+    private void checkTx(Session ses, boolean readOnly, boolean commit, 
boolean explicit, Matcher<String> planMatcher) throws Exception {
         Transaction outerTx = explicit ? (readOnly ? 
igniteTx().readOnly().begin() : igniteTx().begin()) : null;
 
-        AsyncResultSet rs = ses.executeAsync(outerTx, "SELECT VAL0 FROM TEST 
ORDER BY VAL0").get();
+        String query = "SELECT VAL0 FROM TEST ORDER BY VAL0";
+
+        assertQuery(query).matches(planMatcher).check();

Review Comment:
   good catch



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