slinkydeveloper commented on code in PR #19190:
URL: https://github.com/apache/flink/pull/19190#discussion_r844892612


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/CallContext.java:
##########
@@ -93,6 +93,17 @@ default ValidationException newValidationError(String 
message, Object... args) {
         return new ValidationException(String.format(message, args));
     }
 
+    /**
+     * Shorthand for {@code if (throwOnFailure) throw ValidationException(...) 
else return
+     * Optional.empty()}.
+     */
+    default <T> Optional<T> failInference(boolean throwOnFailure, String 
message, Object... args) {

Review Comment:
   TBH I think `fail` is generally more meaningful. `emptyOrError` gives me the 
idea that whether to return empty or error is a decision of the function, but 
it's not really the case since here is only `throwOnFailure` which decides 
whether or not to throw the exception. Also `failInference` reads nicer in the 
code. Maybe just `fail` could be ever better?



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