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


##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogUtils.java:
##########
@@ -363,4 +365,22 @@ static CatalogZoneDescriptor zoneOrThrow(Catalog catalog, 
String name) throws Ca
     public static String pkIndexName(String tableName) {
         return tableName + "_PK";
     }
+
+    /**
+     * Returns index with given name.
+     *
+     * @param schema Schema to look up index in.
+     * @param name Name of the index of interest.
+     * @return Table with given name.
+     * @throws IndexNotFoundValidationException If index with given name is 
not exists.
+     */
+    static CatalogIndexDescriptor indexOrThrow(CatalogSchemaDescriptor schema, 
String name) throws IndexNotFoundValidationException {
+        CatalogIndexDescriptor index = schema.index(name);
+
+        if (index == null) {
+            throw new IndexNotFoundValidationException(format("Index with name 
'{}.{}' not found", schema.name(), name));

Review Comment:
   In this class there were methods `schemaOrThrow` and `tableOrThrow`, I don’t 
think that at the moment there is a need to spoil the consistency in the 
naming, plus the semantics and documentation of the method indicate that it 
will be a validation exception that will be thrown.



##########
modules/catalog/src/main/java/org/apache/ignite/internal/catalog/commands/CatalogUtils.java:
##########
@@ -363,4 +365,22 @@ static CatalogZoneDescriptor zoneOrThrow(Catalog catalog, 
String name) throws Ca
     public static String pkIndexName(String tableName) {
         return tableName + "_PK";
     }
+
+    /**
+     * Returns index with given name.
+     *
+     * @param schema Schema to look up index in.
+     * @param name Name of the index of interest.
+     * @return Table with given name.
+     * @throws IndexNotFoundValidationException If index with given name is 
not exists.
+     */
+    static CatalogIndexDescriptor indexOrThrow(CatalogSchemaDescriptor schema, 
String name) throws IndexNotFoundValidationException {
+        CatalogIndexDescriptor index = schema.index(name);
+
+        if (index == null) {
+            throw new IndexNotFoundValidationException(format("Index with name 
'{}.{}' not found", schema.name(), name));

Review Comment:
   In this class there were methods `schemaOrThrow` and `tableOrThrow`, I don’t 
think that at the moment there is a need to spoil the consistency in the 
naming, plus the semantics and documentation of the method indicate that it 
will be a validation exception that will be thrown.



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