tkalkirill commented on code in PR #2243:
URL: https://github.com/apache/ignite-3/pull/2243#discussion_r1239686536


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogServiceImpl.java:
##########
@@ -863,4 +654,197 @@ private Catalog applyUpdateFinal(Catalog catalog, 
VersionedUpdate update) {
                 catalog.schemas()
         );
     }
+
+    private static CatalogSchemaDescriptor getSchema(Catalog catalog, 
@Nullable String schemaName) {
+        schemaName = Objects.requireNonNullElse(schemaName, 
DEFAULT_SCHEMA_NAME);
+
+        return Objects.requireNonNull(catalog.schema(schemaName), "No schema 
found: " + schemaName);
+    }
+
+    private static CatalogTableDescriptor getTable(CatalogSchemaDescriptor 
schema, @Nullable String tableName) {
+        CatalogTableDescriptor table = schema.table(tableName);
+
+        if (table == null) {
+            throw new TableNotFoundException(schema.name(), tableName);
+        }
+
+        return table;
+    }
+
+    private static CatalogZoneDescriptor getZone(Catalog catalog, String 
zoneName) {
+        zoneName = Objects.requireNonNull(zoneName, "zoneName");
+
+        CatalogZoneDescriptor zone = catalog.zone(zoneName);
+
+        if (zone == null) {
+            throw new DistributionZoneNotFoundException(zoneName);
+        }
+
+        return zone;
+    }
+
+    private static CatalogTableColumnDescriptor 
findTableColumn(CatalogTableDescriptor table, String columnName) {
+        return table.columns().stream()
+                .filter(desc -> desc.name().equals(columnName))
+                .findFirst()
+                .orElseThrow(() -> new ColumnNotFoundException(columnName));
+    }
+
+    private static CatalogTableColumnDescriptor 
createNewTableColumn(AlterColumnParams params, CatalogTableColumnDescriptor 
origin) {
+        return new CatalogTableColumnDescriptor(
+                origin.name(),
+                Objects.requireNonNullElse(params.type(), origin.type()),
+                !Objects.requireNonNullElse(params.notNull(), 
!origin.nullable()),
+                Objects.requireNonNullElse(params.precision(), 
origin.precision()),
+                Objects.requireNonNullElse(params.scale(), origin.scale()),
+                Objects.requireNonNullElse(params.length(), origin.length()),
+                Objects.requireNonNullElse(params.defaultValue(origin.type()), 
origin.defaultValue())
+        );
+    }
+
+    private static void validateParams(CreateTableParams params) {

Review Comment:
   fix it



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