Github user fhueske commented on a diff in the pull request: https://github.com/apache/flink/pull/3783#discussion_r124029025 --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/CodeGenerator.scala --- @@ -296,6 +299,39 @@ class CodeGenerator( fields.mkString(", ") } + def genInitialize(): String = { + + val sig: String = + j""" + | public void initialize( + | org.apache.flink.api.common.functions.RuntimeContext ctx + | )""".stripMargin + + val initDist: String = if( distinctAggsFlags.isDefined ) { + val statePackage = "org.apache.flink.api.common.state" + val distAggsFlags = distinctAggsFlags.get + for(i <- distAggsFlags.indices) yield --- End diff -- It would be good to share distinct state across aggregations if they are on the same fields, i.e., make distinct state distinct ;-). I would do this in a preprocessing step in the `generateAggregations` method. It would also change the way how we access the state, because we may increment / decrement a key only once per record (call of `accumulate` if state is shared.
--- 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. ---