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

    https://github.com/apache/flink/pull/4105#discussion_r122447580
  
    --- 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 --
    
    The correct extraction of TypeInformation for Scala classes only works in 
the Scala TableEnvironments but not for Java environments. Hence, UDAGGs that 
use Scala classes should not be used in Java queries because they will fall 
back to GenericTypes there.
    
    The safe and portable way is to use Java classes for accumulators.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to