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

    https://github.com/apache/flink/pull/4105#discussion_r122614563
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/java/BatchTableEnvironment.scala
 ---
    @@ -192,10 +193,14 @@ class BatchTableEnvironment(
           name: String,
           f: AggregateFunction[T, ACC])
       : Unit = {
    -    implicit val typeInfo: TypeInformation[T] = TypeExtractor
    -      .createTypeInfo(f, classOf[AggregateFunction[T, ACC]], f.getClass, 0)
    +    implicit val typeInfo: TypeInformation[T] = UserDefinedFunctionUtils
    +      .getResultTypeOfAggregateFunction(f)
           .asInstanceOf[TypeInformation[T]]
     
    +    implicit val accTypeInfo: TypeInformation[ACC] = 
UserDefinedFunctionUtils
    --- End diff --
    
    I agree with you. But this PR is only to fix Scala classes can't work in 
the Scala TableEnvironments. In general, users create Scala classes and 
naturally will use it in Scala TableEnvironments. Registering a Scala class 
into Java TableEnvironments is not recommended (should forbidden). This is the 
same with that Scala `T` classes of `Aggregate[T, _] and TableFunction[T]` 
works in Scala TableEnvironments.


---
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.
---

Reply via email to