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:
[email protected]


With regards,
Apache Git Services

Reply via email to