JAkutenshi commented on code in PR #6712:
URL: https://github.com/apache/ignite-3/pull/6712#discussion_r2517369299


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogUtils.java:
##########
@@ -531,6 +539,93 @@ public static CatalogTableDescriptor tableOrThrow(Catalog 
catalog, int tableId)
         return table;
     }
 
+    /**
+     * Returns a descriptor for given zone name or for a default zone from the 
given catalog.
+     *
+     * @param catalog Catalog to check zones' existence.
+     * @param zoneName Zone name to try to find catalog descriptor for. If 
{@code null} then will return default zone descriptor.
+     * @return Returns a descriptor for given zone name if it isn't {@code 
null} or for existed default zone otherwise.
+     * @throws CatalogValidationException In casse if given zone name isn't 
{@code null}, but the given catalog hasn't zone with such name.
+     * @implNote This method assumes, that {@link #shouldCreateNewDefaultZone} 
returns {@code false} with the same input.
+     */
+    public static CatalogZoneDescriptor zoneByNameOrDefaultOrThrow(
+            Catalog catalog,
+            @Nullable String zoneName
+    ) throws CatalogValidationException {
+        if (zoneName != null) {
+            return zoneOrThrow(catalog, zoneName);
+        }
+
+        CatalogZoneDescriptor defaultZone = catalog.defaultZone();
+
+        assert defaultZone != null;

Review Comment:
   Is it better to add TODO https://issues.apache.org/jira/browse/IGNITE-26798 
there then? I may throw too, with todo alongside



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