Github user sunjincheng121 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3993#discussion_r118806216
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/utils/UserDefinedFunctionUtils.scala
 ---
    @@ -329,6 +330,21 @@ object UserDefinedFunctionUtils {
       }
     
       /**
    +    * Returns the value (boolean) of AggregateFunction#requiresOver() that 
indicates if this
    +    * AggregateFunction can only be used for over window aggregate. If 
method requiresOver is not
    +    * provided, return false as default value.
    +    */
    +  def getRequiresOverConfig(aggregateFunction: AggregateFunction[_, _]): 
Boolean = {
    +    try {
    +      val method: Method = 
aggregateFunction.getClass.getMethod("requiresOver")
    --- End diff --
    
    I think the method supported to check the `modifiers` as well. Just like 
`checkAndExtractMethods`'s method logic. So I suggest using 
`checkAndExtractMethods` directly.  Changes as follows:
    1. Add boolean param for `checkAndExtractMethods`
    2. Change this method looks like : 
    ```
    val methods = checkAndExtractMethods(aggregateFunction, "requiresOver2", 
true)
         if (methods.isEmpty || methods.length > 1)  {
          return false
        } else {
          methods(0).invoke(aggregateFunction).asInstanceOf[Boolean]
        }
    ```
    In addition, If you want to strictly check, you can check the input 
parameters and return type. What do you think?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to