You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/04/07 08:59:59 UTC

[GitHub] [flink] slinkydeveloper commented on a diff in pull request #19190: [FLINK-13785][table] Port time functions to new type inference

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: issues-unsubscribe@flink.apache.org

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