rpuch commented on code in PR #2680:
URL: https://github.com/apache/ignite-3/pull/2680#discussion_r1356575246
##########
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:
If the whole `CatalogUtils` is about validation stage, the class itself can
be renamed. Or these methods might be extracted to a class that's about
validation stage logic.
--
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]