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


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDmlTest.java:
##########
@@ -86,6 +88,56 @@ public void mergeOpChangePrimaryKey() {
                 .check();
     }
 
+    @Test
+    public void batchWithConflictShouldBeRejectedEntirely() {
+        sql("CREATE TABLE test (id int primary key, val int)");
+
+        sql("INSERT INTO test values (1, 1)");
+
+        assertQuery("SELECT count(*) FROM test")
+                .returns(1L)
+                .check();
+
+        assertThrows(
+                IgniteException.class,
+                () -> sql("INSERT INTO test VALUES (0, 0), (1, 1), (2, 2)")
+        );
+
+        assertQuery("SELECT count(*) FROM test")
+                .returns(1L)
+                .check();
+    }
+
+    /**
+     * Test ensures that big insert although being split to several chunks 
will share the same implicit transaction.
+     */
+    @Test
+    public void bigBatchSpanTheSameTransaction() {
+        List<Integer> values = new ArrayList<>(AbstractNode.MODIFY_BATCH_SIZE 
* 2);
+
+        // need to generate batch big enough to be split on several chunks
+        for (int i = 0; i < AbstractNode.MODIFY_BATCH_SIZE * 1.5; i++) {
+            values.add(i);
+        }
+
+        values.add(values.get(0)); // add conflict entry from the first chunk
+
+        sql("CREATE TABLE test (id int primary key, val int default 1)");
+
+        String insertStatement = "INSERT INTO test (id) VALUES " + 
values.stream()
+                .map(Object::toString)
+                .collect(Collectors.joining("), (", "(", ")"));
+
+        assertThrows(

Review Comment:
   the same about SqlException and checking code



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