LadyForest commented on code in PR #22904:
URL: https://github.com/apache/flink/pull/22904#discussion_r1262153293


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/extraction/FunctionTemplate.java:
##########
@@ -146,6 +171,15 @@ private static <T> T defaultAsNull(FunctionHint hint, 
Function<FunctionHint, T>
         return actualValue;
     }
 
+    private static <T> T defaultAsNull(ProcedureHint hint, 
Function<ProcedureHint, T> accessor) {
+        final T defaultValue = 
accessor.apply(getDefaultProcedureHintAnnotation());
+        final T actualValue = accessor.apply(hint);
+        if (Objects.deepEquals(defaultValue, actualValue)) {
+            return null;
+        }
+        return actualValue;
+    }
+

Review Comment:
   Nit: What about
   ```java
       private static <T> T defaultAsNull(FunctionHint hint, 
Function<FunctionHint, T> accessor) {
           return defaultAsNull(hint, DEFAULT_ANNOTATION, accessor);
       }
   
       private static <T> T defaultAsNull(ProcedureHint hint, 
Function<ProcedureHint, T> accessor) {
           return defaultAsNull(hint, getDefaultProcedureHintAnnotation(), 
accessor);
       }
   
       private static <T, H> T defaultAsNull(H hint, H defaultHint, Function<H, 
T> accessor) {
           final T defaultValue = accessor.apply(defaultHint);
           final T actualValue = accessor.apply(hint);
           if (Objects.deepEquals(defaultValue, actualValue)) {
               return null;
           }
           return actualValue;
       }
   ``



-- 
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-unsubscr...@flink.apache.org

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

Reply via email to