[ 
https://issues.apache.org/jira/browse/FLINK-7062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653380#comment-16653380
 ] 

ASF GitHub Bot commented on FLINK-7062:
---------------------------------------

twalthr commented on a change in pull request #6815:  [FLINK-7062][cep][table] 
Added basic support for MATCH_RECOGNIZE
URL: https://github.com/apache/flink/pull/6815#discussion_r225600574
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/MatchCodeGenerator.scala
 ##########
 @@ -245,41 +318,58 @@ class MatchCodeGenerator(
         ""
       }
 
-      val code = s"""
-         |$listTypeTerm $listName = new java.util.ArrayList();
-         |for ($eventTypeTerm $eventNameTerm : 
$contextTerm.getEventsForPattern("$patternName")) {
-         |  $listName.add($eventNameTerm);
+      val escapedPatternName = 
StringEscapeUtils.ESCAPE_JAVA.translate(patternName)
+      reusablePerRecordStatements.add(s"""
+         |this.$listName = new java.util.ArrayList();
+         |for ($eventTypeTerm $eventNameTerm :
+         |  $contextTerm.getEventsForPattern("$escapedPatternName")) {
+         |    $listName.add($eventNameTerm);
          |}
          |$addCurrent
-         |""".stripMargin
+         |""".stripMargin)
 
-      GeneratedExpression(listName, "false", code, new ListTypeInfo(input))
+      GeneratedCode(s"this.$listName", NO_CODE)
     }
 
-    private def generateMeasurePatternVariableExp(patternName: String): 
GeneratedExpression = {
+    private def generateMeasurePatternVariableExp(patternName: String): 
GeneratedCode = {
       val listTypeTerm = classOf[java.util.List[_]].getCanonicalName
 
 Review comment:
   For consistency we can also inline this, because for `Collections` or 
`ArrayList` we also do that.

----------------------------------------------------------------
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 the basic functionality of MATCH_RECOGNIZE
> --------------------------------------------------
>
>                 Key: FLINK-7062
>                 URL: https://issues.apache.org/jira/browse/FLINK-7062
>             Project: Flink
>          Issue Type: Sub-task
>          Components: CEP, Table API & SQL
>            Reporter: Dian Fu
>            Assignee: Dian Fu
>            Priority: Major
>              Labels: pull-request-available
>
> In this JIRA, we will support the basic functionality of {{MATCH_RECOGNIZE}} 
> in Flink SQL API which includes the support of syntax {{MEASURES}}, 
> {{PATTERN}} and {{DEFINE}}. This would allow users write basic cep use cases 
> with SQL like the following example:
> {code}
> SELECT T.aid, T.bid, T.cid
> FROM MyTable
> MATCH_RECOGNIZE (
>   MEASURES
>     A.id AS aid,
>     B.id AS bid,
>     C.id AS cid
>   PATTERN (A B C)
>   DEFINE
>     A AS A.name = 'a',
>     B AS B.name = 'b',
>     C AS C.name = 'c'
> ) AS T
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to