[ https://issues.apache.org/jira/browse/FLINK-7062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653374#comment-16653374 ]
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_r225590632 ########## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/MatchCodeGenerator.scala ########## @@ -18,49 +18,70 @@ package org.apache.flink.table.codegen +import java.lang.{Long => JLong} import java.util import org.apache.calcite.rex._ import org.apache.calcite.sql.fun.SqlStdOperatorTable._ +import org.apache.commons.lang3.StringEscapeUtils import org.apache.flink.api.common.functions._ -import org.apache.flink.api.common.typeinfo.TypeInformation -import org.apache.flink.api.java.typeutils.ListTypeInfo +import org.apache.flink.api.common.typeinfo.{SqlTimeTypeInfo, TypeInformation} import org.apache.flink.cep.pattern.conditions.IterativeCondition import org.apache.flink.cep.{PatternFlatSelectFunction, PatternSelectFunction} import org.apache.flink.table.api.{TableConfig, TableException} -import org.apache.flink.table.codegen.CodeGenUtils.{boxedTypeTermForTypeInfo, newName, primitiveDefaultValue} +import org.apache.flink.table.codegen.CodeGenUtils.{boxedTypeTermForTypeInfo, newName} +import org.apache.flink.table.codegen.GeneratedExpression.{NEVER_NULL, NO_CODE} import org.apache.flink.table.codegen.Indenter.toISC import org.apache.flink.table.plan.schema.RowSchema import org.apache.flink.util.Collector import org.apache.flink.util.MathUtils.checkedDownCast -import java.lang.{Long => JLong} import scala.collection.JavaConverters._ +import scala.collection.mutable /** * A code generator for generating CEP related functions. * * @param config configuration that determines runtime behavior - * @param nullableInput input(s) can be null. * @param input type information about the first input of the Function * @param currentPattern if generating condition the name of pattern, which the condition will * be applied to */ class MatchCodeGenerator( config: TableConfig, - nullableInput: Boolean, input: TypeInformation[_ <: Any], currentPattern: Option[String] = None) - extends CodeGenerator(config, nullableInput, input){ - + extends CodeGenerator(config, false, input){ + + /** + * Used to assign unique names for list of events per pattern variable name + */ + private val reusablePatternListNames: mutable.HashMap[String, String] = mutable + .HashMap[String, String]() + + /** + * Generates a [[org.apache.flink.api.common.functions.Function]] that can be passed to Java + * compiler. + * + * <p>This is a separate method from [[FunctionCodeGenerator.generateFunction()]] because as of Review comment: nit: `<p>` is not necessary in Scala ---------------------------------------------------------------- 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)