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


##########
modules/catalog/src/test/java/org/apache/ignite/internal/catalog/CatalogSchemaTest.java:
##########
@@ -170,6 +176,138 @@ public void testDropNonEmpty() {
         }
     }
 
+    @Test
+    public void testSameTableNameInDifferentSchemas() {
+        // Create table1 in schema1
+        {
+            CatalogCommand newSchemaCmd = 
CreateSchemaCommand.builder().name("S1").build();
+            CatalogCommand newTableCmd = newTableCommand("S1", "T1");
+
+            tryApplyAndCheckExpect(List.of(newSchemaCmd, newTableCmd), true, 
true);
+        }
+
+        // Create table1 in schema2
+        {
+            CatalogCommand newSchemaCmd = 
CreateSchemaCommand.builder().name("S2").build();
+            CatalogCommand newTableCmd = newTableCommand("S2", "T1");
+
+            tryApplyAndCheckExpect(List.of(newSchemaCmd, newTableCmd), true, 
true);
+        }
+
+        {
+            CatalogSchemaDescriptor schema1 = latestCatalog().schema("S1");
+            assertNotNull(schema1);
+
+            CatalogSchemaDescriptor schema2 = latestCatalog().schema("S2");
+            assertNotNull(schema2);
+
+            CatalogTableDescriptor schema1table1 = schema1.table("T1");
+            assertNotNull(schema1table1);
+
+            CatalogTableDescriptor schema2table1 = schema2.table("T1");
+            assertNotNull(schema2table1);
+            assertNotEquals(schema1table1.id(), schema2table1.id(), "Table ids 
should differ");
+        }
+    }
+
+    @Test
+    public void testSameIndexNameInDifferentSchemas() {
+        // Create table1 in schema1
+        {
+            CatalogCommand newSchemaCmd = 
CreateSchemaCommand.builder().name("S1").build();
+            CatalogCommand newTableCmd = newTableCommand("S1", "T1");
+            CatalogCommand newIndexCmd = CreateHashIndexCommand.builder()
+                    .schemaName("S1")
+                    .tableName("T1")
+                    .indexName("MY_INDEX")
+                    .columns(List.of("key2"))
+                    .build();
+
+            tryApplyAndCheckExpect(List.of(newSchemaCmd, newTableCmd, 
newIndexCmd), true, true, true);
+        }
+
+        // Create table1 in schema2
+        {
+            CatalogCommand newSchemaCmd = 
CreateSchemaCommand.builder().name("S2").build();
+            CatalogCommand newTableCmd = newTableCommand("S2", "T2");
+            CatalogCommand newIndexCmd = CreateHashIndexCommand.builder()
+                    .schemaName("S2")
+                    .tableName("T2")
+                    .indexName("MY_INDEX")
+                    .columns(List.of("key2"))
+                    .build();
+
+            tryApplyAndCheckExpect(List.of(newSchemaCmd, newTableCmd, 
newIndexCmd), true, true, true);
+        }
+
+        {
+            CatalogSchemaDescriptor schema1 = latestCatalog().schema("S1");
+            assertNotNull(schema1);
+
+            CatalogSchemaDescriptor schema2 = latestCatalog().schema("S2");
+            assertNotNull(schema2);
+
+            CatalogIndexDescriptor schema1index = 
Arrays.stream(schema1.indexes())
+                    .filter(i -> "MY_INDEX".equals(i.name()))
+                    .findAny()
+                    .orElseThrow();
+
+            CatalogIndexDescriptor schema2index = 
Arrays.stream(schema2.indexes())
+                    .filter(i -> "MY_INDEX".equals(i.name()))
+                    .findAny()
+                    .orElseThrow();
+
+            assertNotEquals(schema1index.id(), schema2index.id(), "Index ids 
should differ");
+        }
+    }
+
+    @Test
+    public void testEmptyPublicSchema() {

Review Comment:
   Removed this test case.



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