sashapolo commented on code in PR #3223:
URL: https://github.com/apache/ignite-3/pull/3223#discussion_r1496338296


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/AlterTableDropColumnCommand.java:
##########
@@ -98,24 +96,39 @@ public List<UpdateEntry> get(Catalog catalog) {
             }
 
             if (indexedColumns.contains(columnName)) {
-                List<String> indexesNames = Arrays.stream(schema.indexes())
-                        .filter(index -> index.tableId() == table.id())
-                        .filter(index -> index instanceof 
CatalogHashIndexDescriptor
-                                ? ((CatalogHashIndexDescriptor) 
index).columns().contains(columnName)
-                                : ((CatalogSortedIndexDescriptor) 
index).columns().stream().map(CatalogIndexColumnDescriptor::name)
-                                        .anyMatch(column -> 
column.equals(columnName))
-                
).map(CatalogIndexDescriptor::name).collect(Collectors.toList());
+                List<String> indexesNames = aliveIndexesForTable(schema, table)
+                        .filter(index -> 
indexColumnNames(index).anyMatch(columnName::equals))
+                        .map(CatalogIndexDescriptor::name)
+                        .collect(Collectors.toList());
 
                 throw new CatalogValidationException(format(
                         "Deleting column '{}' used by index(es) {}, it is not 
allowed", columnName, indexesNames));
             }
-        }
+        });
 
         return List.of(
                 new DropColumnsEntry(table.id(), columns, schemaName)
         );
     }
 
+    private static Stream<CatalogIndexDescriptor> 
aliveIndexesForTable(CatalogSchemaDescriptor schema, CatalogTableDescriptor 
table) {
+        return Arrays.stream(schema.indexes())

Review Comment:
   Fixed



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