korlov42 commented on code in PR #2231:
URL: https://github.com/apache/ignite-3/pull/2231#discussion_r1238025041


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/CatalogServiceImpl.java:
##########
@@ -277,29 +254,18 @@ private Catalog catalogAt(long timestamp) {
         return entry.getValue();
     }
 
-    /** {@inheritDoc} */
     @Override
     public CompletableFuture<Void> createTable(CreateTableParams params) {
         return saveUpdate(catalog -> {
-            String schemaName = 
Objects.requireNonNullElse(params.schemaName(), CatalogService.PUBLIC);
-
-            CatalogSchemaDescriptor schema = 
Objects.requireNonNull(catalog.schema(schemaName), "No schema found: " + 
schemaName);
+            CatalogSchemaDescriptor schema = getSchema(catalog, 
params.schemaName());
 
             if (schema.table(params.tableName()) != null) {
-                throw new TableAlreadyExistsException(schemaName, 
params.tableName());
+                throw new TableAlreadyExistsException(schema.name(), 
params.tableName());
             }
 
-            
params.columns().stream().map(ColumnParams::name).filter(Predicate.not(new 
HashSet<>()::add))
-                    .findAny().ifPresent(columnName -> {
-                        throw new IgniteInternalException(
-                                
ErrorGroups.Index.INVALID_INDEX_DEFINITION_ERR, "Can't create table with 
duplicate columns: "
-                                + 
params.columns().stream().map(ColumnParams::name).collect(Collectors.joining(", 
"))
-                        );
-                    });
+            validateParams(params);
 
-            String zoneName = Objects.requireNonNullElse(params.zone(), 
CatalogService.DEFAULT_ZONE_NAME);
-
-            CatalogZoneDescriptor zone = 
Objects.requireNonNull(catalog.zone(zoneName), "No zone found: " + zoneName);
+            CatalogZoneDescriptor zone = getZone(catalog, 
Objects.requireNonNullElse(params.zone(), DEFAULT_ZONE_NAME));

Review Comment:
   All this refactoring has nothing to do with problem to be solved within the 
ticket (IGNITE-19641). So, please, move it to another patch



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