dianfu commented on a change in pull request #7209: [FLINK-10977][table] Add 
UnBounded FlatAggregate operator to streaming Table API
URL: https://github.com/apache/flink/pull/7209#discussion_r242019417
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/utils/UserDefinedFunctionUtils.scala
 ##########
 @@ -800,6 +925,60 @@ object UserDefinedFunctionUtils {
     functionCall
   }
 
+  /**
+    * Creates a [[TableAggFunctionCall]] by parsing a String expression.
+    *
+    * @param tableEnv The table environment to lookup the function.
+    * @param udtagg a String expression of a TableAggFunctionCall, such as 
"udtaggFunc(c)"
+    * @return A TableAggFunctionCall.
+    */
+  def createTableAggFunctionCall(
+      tableEnv: TableEnvironment,
+      udtagg: String): TableAggFunctionCall = {
+
+    var alias: Option[Seq[Expression]] = None
+    var isDistinct: Boolean = false
+
+    // unwrap an Expression until we get a TableAggFunctionCall
+    def unwrap(expr: Expression): TableAggFunctionCall = expr match {
+      case Alias(child, name, extraNames: Seq[String]) =>
+        alias = Some(Seq(new UnresolvedFieldReference(name)) ++
+          extraNames.map(new UnresolvedFieldReference(_)))
 
 Review comment:
   new is unnecessary

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to