Github user shaoxuan-wang commented on a diff in the pull request:
https://github.com/apache/flink/pull/3809#discussion_r114576600
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/java/BatchTableEnvironment.scala
---
@@ -178,4 +178,24 @@ class BatchTableEnvironment(
registerTableFunctionInternal[T](name, tf)
}
+
+ /**
+ * Registers an [[AggregateFunction]] under a unique name in the
TableEnvironment's catalog.
+ * Registered functions can be referenced in Table API and SQL queries.
+ *
+ * @param name The name under which the function is registered.
+ * @param f The AggregateFunction to register.
+ * @tparam T The type of the output value.
+ * @tparam ACC The type of aggregate accumulator.
+ */
+ def registerFunction[T, ACC](
+ name: String,
+ f: AggregateFunction[T, ACC])
+ : Unit = {
+ implicit val typeInfo: TypeInformation[T] = TypeExtractor
--- End diff --
Thanks @twalthr . If I understand you correctly, you suggest to create a
contract method `getResultType` for UDAGG, such that user can provide the
result type in case the type extraction fails. Sounds good to me?
Can you give some examples that when the type extraction will fail (for
instance a Row type?) and why it may fail, such that I can add some test cases.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---