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


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogUtils.java:
##########
@@ -461,6 +453,29 @@ public static CatalogSchemaDescriptor 
schemaOrThrow(Catalog catalog, int schemaI
         return schema;
     }
 
+    /**
+     * Returns schema with given name, or throws {@link 
CatalogValidationException} if schema with given name not exists.
+     *
+     * @param catalog Catalog to look up schema in.
+     * @param name Name of the schema of interest.
+     * @param shouldThrowIfNotExists Flag indicated should be thrown the 
{@code CatalogValidationException} for absent schema or just
+     *         return {@code null}.
+     * @return Schema with given name. Never null.
+     * @throws CatalogValidationException If schema with given name is not 
exists and flag shouldThrowIfNotExists set to {@code true}.
+     */
+    public static CatalogSchemaDescriptor schema(Catalog catalog, String name, 
boolean shouldThrowIfNotExists)

Review Comment:
   ```suggestion
       public static @Nullable CatalogSchemaDescriptor schema(Catalog catalog, 
String name, boolean shouldThrowIfNotExists)
   ```
   
   also let's fix javadoc



##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogUtils.java:
##########
@@ -433,23 +433,15 @@ public static int defaultLength(ColumnType columnType, 
int precision) {
      * @throws CatalogValidationException If schema with given name is not 
exists.
      */
     public static CatalogSchemaDescriptor schemaOrThrow(Catalog catalog, 
String name) throws CatalogValidationException {
-        name = Objects.requireNonNull(name, "schemaName");
-
-        CatalogSchemaDescriptor schema = catalog.schema(name);
-
-        if (schema == null) {
-            throw new CatalogValidationException("Schema with name '{}' not 
found.", name);
-        }
-
-        return schema;
+        return schema(catalog, name, true);

Review Comment:
   after adding `@Nullable` to base method, it would be nice to do something 
with warning



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to