lowka commented on code in PR #2275:
URL: https://github.com/apache/ignite-3/pull/2275#discussion_r1251894868


##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItCreateTableDdlTest.java:
##########
@@ -122,6 +129,63 @@ public void implicitColocationColumns() {
         assertEquals("ID0", colocationColumns[1].name());
     }
 
+    /** Test correct mapping schema after alter columns. */
+    @Test
+    public void testDropAndAddColumns() {
+        sql("CREATE TABLE my (c1 INT PRIMARY KEY, c2 INT, c3 VARCHAR)");
+
+        sql("INSERT INTO my VALUES (1, 2, '3')");
+
+        List<List<Object>> res = sql("SELECT c1, c3 FROM my");
+
+        assertFalse(res.isEmpty());
+
+        sql("ALTER TABLE my DROP COLUMN c2");
+
+        res = sql("SELECT c1, c3 FROM my");
+
+        assertFalse(res.isEmpty());
+
+        sql("ALTER TABLE my ADD COLUMN (c2 INT, c4 VARCHAR)");
+
+        sql("INSERT INTO my VALUES (2, '2', 2, '3')");
+
+        res = sql("SELECT c2, c4 FROM my WHERE c1=2");
+
+        assertEquals(2, res.get(0).get(0));
+
+        sql("ALTER TABLE my DROP COLUMN c4");
+        sql("ALTER TABLE my ADD COLUMN (c4 INT)");
+        sql("INSERT INTO my VALUES (3, '2', 3, 3)");
+
+        res = sql("SELECT c4 FROM my WHERE c1=3");
+
+        assertEquals(3, res.get(0).get(0));
+    }
+
+    /**
+     * Checks that schema version is updated even if column names are 
intersected.
+     */
+    // Need to be removed after 
https://issues.apache.org/jira/browse/IGNITE-19082
+    @Test
+    public void checkSchemaUpdatedWithEqAlterColumn() {
+        sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT)");
+
+        Ignite node = CLUSTER_NODES.get(0);
+
+        ConfigurationManager cfgMgr = IgniteTestUtils.getFieldValue(node, 
"clusterCfgMgr");
+
+        TablesConfiguration tablesConfiguration = 
cfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY);
+
+        int schIdBefore = ((ExtendedTableView) 
tablesConfiguration.tables().get("TEST").value()).schemaId();
+
+        sql("ALTER TABLE TEST ADD COLUMN (VAL1 INT)");
+

Review Comment:
   Maybe I am missing something. But nonetheless what could possibly go wrong 
in this test case (VAL0` and `VAL1` are distinct names).
   Why this test case should be removed after some general issue related to 
catalog is resolved?
   Maybe the link is not correct 
(https://issues.apache.org/jira/browse/IGNITE-19082 it's general issue for 
catalog migration).



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