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


##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogServiceSelfTest.java:
##########
@@ -491,6 +504,319 @@ public void testAddDropMultipleColumns() {
         assertNotNull(schema.table(TABLE_NAME).column("VAL"));
     }
 
+    /**
+     * Checks for possible changes to the default value of a column descriptor.
+     *
+     * <p>Set/drop default value allowed for any column.
+     */
+    @Test
+    public void testAlterColumnDefault() {
+        assertThat(service.createTable(simpleTable(TABLE_NAME)), 
willBe((Object) null));
+
+        int schemaVer = 1;
+        assertNotNull(service.schema(schemaVer));
+        assertNull(service.schema(schemaVer + 1));
+
+        // NULL-> NULL : No-op.
+        assertThat(changeColumn(TABLE_NAME, "VAL", null, null, () -> 
DefaultValue.constant(null)),
+                willBe((Object) null));
+        assertNull(service.schema(schemaVer + 1));
+
+        // NULL -> 1 : Ok.
+        assertThat(changeColumn(TABLE_NAME, "VAL", null, null, () -> 
DefaultValue.constant(1)),
+                willBe((Object) null));
+        assertNotNull(service.schema(++schemaVer));
+
+        // 1 -> 1 : No-op.
+        assertThat(changeColumn(TABLE_NAME, "VAL", null, null, () -> 
DefaultValue.constant(1)),
+                willBe((Object) null));
+        assertNull(service.schema(schemaVer + 1));
+
+        // 1 -> 2 : Ok.
+        assertThat(changeColumn(TABLE_NAME, "VAL", null, null, () -> 
DefaultValue.constant(2)),
+                willBe((Object) null));
+        assertNotNull(service.schema(++schemaVer));
+
+        // 2 -> NULL : Ok (for nullable column).

Review Comment:
   ```suggestion
           // 2 -> NULL : Ok.
   ```
   I think changing column default to `null` is allowed for any columns.
   For non-nullable columns that means user must set value explicitly.



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