JingsongLi commented on a change in pull request #9322: [FLINK-13471][table] 
Add FlatAggregate support to stream Table API(blink planner)
URL: https://github.com/apache/flink/pull/9322#discussion_r310107028
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/codegen/agg/ImperativeAggCodeGen.scala
 ##########
 @@ -503,5 +505,22 @@ class ImperativeAggCodeGen(
               s"aggregate ${function.getClass.getCanonicalName}'.")
         )
     }
+
+    if (needEmitValue) {
+      val collectorDataType = 
ClassDataTypeConverter.fromClassToDataType(classOf[Collector[_]])
+      getUserDefinedMethod(function, "emitValue", Array(externalAccType, 
collectorDataType))
+        .getOrElse(
+          throw new CodeGenException(
+            s"No matching emitValue method found for " +
+              s"table aggregate ${function.getClass.getCanonicalName}'.")
+        )
+    }
+  }
+
+  def emitValue: String = {
+    val accTerm = if (isAccTypeInternal) accInternalTerm else accExternalTerm
+    s"""
+       |$functionTerm.emitValue($accTerm, $MEMBER_COLLECTOR_TERM);
 
 Review comment:
   Just `s""` is OK?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to