Github user wuchong commented on a diff in the pull request:
https://github.com/apache/flink/pull/4105#discussion_r124704209
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/functions/utils/UserDefinedFunctionUtils.scala
---
@@ -320,12 +348,20 @@ object UserDefinedFunctionUtils {
} else if(extractedType != null) {
extractedType
} else {
- TypeExtractor
+ try {
+ TypeExtractor
--- End diff --
I think it is more safe than `TypeInformation.of(Any)`, because
`TypeInformation.of(Any)` can only works for non-generic types.
For example:
```
public class UDAF extends AggregateFunction[Tuple2<String, Long>, Long] {
public Long createAccumulator() {...}
public Tuple2<String, Long> getValue(Long acc) {...}
}
```
For the given UDAF, the return type is a generic type `Tuple2<String,
Long>`. We can't extract the return type from an instance of Tuple2, because
of Java type erasure. But we can extract it from the type hierarchy of UDAF
class.
Am I right, @twalthr ?
```
---
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.
---