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_r226579086
########## File path: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/MatchCodeGenerator.scala ########## @@ -0,0 +1,383 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +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.{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} +import org.apache.flink.table.codegen.GeneratedExpression.NEVER_NULL +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 scala.collection.JavaConverters._ +import scala.collection.mutable + +/** + * A code generator for generating CEP related functions. + * + * @param config configuration that determines runtime behavior + * @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, + input: TypeInformation[_ <: Any], + currentPattern: Option[String] = None) + extends CodeGenerator(config, false, input){ + + private case class GeneratedPatternList(resultTerm: String, code: String) + + /** + * Used to assign unique names for list of events per pattern variable name Review comment: Mention somewhere that reusable input unboxing expressions depend on this pattern list. ---------------------------------------------------------------- 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
