mchades commented on code in PR #9737:
URL: https://github.com/apache/gravitino/pull/9737#discussion_r2703122841
##########
core/src/main/java/org/apache/gravitino/catalog/ManagedFunctionOperations.java:
##########
@@ -313,4 +430,168 @@ private boolean hasDefaultValue(FunctionParam param) {
Expression defaultValue = param.defaultValue();
return defaultValue != null && defaultValue !=
Column.DEFAULT_VALUE_NOT_SET;
}
+
+ /**
+ * Validates that a definition can be removed.
+ *
+ * @param definitions The current definitions.
+ * @param paramsToRemove The parameters identifying the definition to remove.
+ * @throws IllegalArgumentException If the definition doesn't exist or is
the only one.
+ */
+ private void validateRemoveDefinition(
+ List<FunctionDefinition> definitions, FunctionParam[] paramsToRemove) {
+ boolean found = false;
+ for (FunctionDefinition def : definitions) {
+ if (parametersMatch(def.parameters(), paramsToRemove)) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ throw new IllegalArgumentException(
+ "Cannot remove definition: no definition found with the specified
parameters");
+ }
+
+ if (definitions.size() == 1) {
Review Comment:
fixed
--
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]