[ https://issues.apache.org/jira/browse/FLINK-7599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16707001#comment-16707001 ]
ASF GitHub Bot commented on FLINK-7599: --------------------------------------- dawidwys commented on a change in pull request #7177: [FLINK-7599] [table] Support for aggregates in MATCH_RECOGNIZE URL: https://github.com/apache/flink/pull/7177#discussion_r238226741 ########## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/MatchCodeGenerator.scala ########## @@ -442,4 +498,223 @@ class MatchCodeGenerator( generateFieldAccess(patternVariableRef.copy(code = NO_CODE), fieldRef.getIndex) } + + class AggBuilder(variable: String) { + + private val aggregates = new mutable.ListBuffer[RexCall]() + + private val variableUID = newName("variable") + + private val resultRowTerm = newName(s"aggRow_$variableUID") + + private val rowTypeTerm = "org.apache.flink.types.Row" + + def getOrAddAggregation(call: RexCall): GeneratedExpression = { + reusableInputUnboxingExprs.get((call.toString, 0)) match { + case Some(expr) => + expr + + case None => + val exp: GeneratedExpression = generateAggAccess(call) + aggregates += call + reusableInputUnboxingExprs((call.toString, 0)) = exp + exp.copy(code = NO_CODE) + } + } + + private def generateAggAccess(call: RexCall) = { Review comment: It actually generates only the access. It does not generate computing the aggregate. That name might not be perfect, but actually I would like to differentiate it somehow. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Support aggregation functions in the define and measures clause of > MatchRecognize > --------------------------------------------------------------------------------- > > Key: FLINK-7599 > URL: https://issues.apache.org/jira/browse/FLINK-7599 > Project: Flink > Issue Type: Sub-task > Components: CEP, Table API & SQL > Reporter: Dian Fu > Assignee: Dawid Wysakowicz > Priority: Major > Labels: pull-request-available > Fix For: 1.8.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)