fsk119 commented on code in PR #26630: URL: https://github.com/apache/flink/pull/26630#discussion_r2128003112
########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/stream/StreamExecMLPredictTableFunction.java: ########## @@ -0,0 +1,340 @@ +/* + * 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.planner.plan.nodes.exec.stream; + +import org.apache.flink.FlinkVersion; +import org.apache.flink.api.common.functions.FlatMapFunction; +import org.apache.flink.api.dag.Transformation; +import org.apache.flink.configuration.Configuration; +import org.apache.flink.configuration.ReadableConfig; +import org.apache.flink.runtime.state.KeyGroupRangeAssignment; +import org.apache.flink.streaming.api.datastream.AsyncDataStream; +import org.apache.flink.streaming.api.functions.async.AsyncFunction; +import org.apache.flink.streaming.api.operators.ProcessOperator; +import org.apache.flink.streaming.api.operators.SimpleOperatorFactory; +import org.apache.flink.streaming.api.operators.async.AsyncWaitOperatorFactory; +import org.apache.flink.streaming.api.transformations.OneInputTransformation; +import org.apache.flink.streaming.api.transformations.PartitionTransformation; +import org.apache.flink.streaming.runtime.partitioner.KeyGroupStreamPartitioner; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.catalog.DataTypeFactory; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.conversion.DataStructureConverter; +import org.apache.flink.table.data.conversion.DataStructureConverters; +import org.apache.flink.table.functions.AsyncPredictFunction; +import org.apache.flink.table.functions.PredictFunction; +import org.apache.flink.table.functions.UserDefinedFunction; +import org.apache.flink.table.ml.AsyncPredictRuntimeProvider; +import org.apache.flink.table.ml.ModelProvider; +import org.apache.flink.table.ml.PredictRuntimeProvider; +import org.apache.flink.table.planner.calcite.FlinkContext; +import org.apache.flink.table.planner.codegen.CodeGeneratorContext; +import org.apache.flink.table.planner.codegen.FilterCodeGenerator; +import org.apache.flink.table.planner.codegen.LookupJoinCodeGenerator; +import org.apache.flink.table.planner.delegation.PlannerBase; +import org.apache.flink.table.planner.plan.nodes.exec.ExecNode; +import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeBase; +import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeConfig; +import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeContext; +import org.apache.flink.table.planner.plan.nodes.exec.ExecNodeMetadata; +import org.apache.flink.table.planner.plan.nodes.exec.InputProperty; +import org.apache.flink.table.planner.plan.nodes.exec.MultipleTransformationTranslator; +import org.apache.flink.table.planner.plan.nodes.exec.spec.MLPredictSpec; +import org.apache.flink.table.planner.plan.nodes.exec.spec.ModelSpec; +import org.apache.flink.table.planner.plan.nodes.exec.utils.ExecNodeUtil; +import org.apache.flink.table.planner.plan.utils.KeySelectorUtil; +import org.apache.flink.table.planner.plan.utils.LookupJoinUtil; +import org.apache.flink.table.planner.utils.JavaScalaConversionUtil; +import org.apache.flink.table.runtime.collector.ListenableCollector; +import org.apache.flink.table.runtime.collector.TableFunctionResultFuture; +import org.apache.flink.table.runtime.functions.ModelPredictRuntimeProviderContext; +import org.apache.flink.table.runtime.generated.GeneratedCollector; +import org.apache.flink.table.runtime.generated.GeneratedFunction; +import org.apache.flink.table.runtime.generated.GeneratedResultFuture; +import org.apache.flink.table.runtime.keyselector.RowDataKeySelector; +import org.apache.flink.table.runtime.operators.join.lookup.AsyncLookupJoinRunner; +import org.apache.flink.table.runtime.operators.join.lookup.LookupJoinRunner; +import org.apache.flink.table.runtime.typeutils.InternalSerializers; +import org.apache.flink.table.runtime.typeutils.InternalTypeInfo; +import org.apache.flink.table.types.logical.RowType; + +import javax.annotation.Nullable; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Optional; +import java.util.stream.IntStream; + +/** Stream {@link ExecNode} for {@code ML_PREDICT}. */ +@ExecNodeMetadata( + name = "stream-exec-ml-predict-table-function", + version = 1, + producedTransformations = StreamExecMLPredictTableFunction.ML_PREDICT_TRANSFORMATION, + minPlanVersion = FlinkVersion.V2_1, + minStateVersion = FlinkVersion.V2_1) +public class StreamExecMLPredictTableFunction extends ExecNodeBase<RowData> + implements MultipleTransformationTranslator<RowData>, StreamExecNode<RowData> { + + public static final String PARTITIONER_TRANSFORMATION = "partitioner"; + + public static final String ML_PREDICT_TRANSFORMATION = "ml-predict-table-function"; + + private final MLPredictSpec mlPredictSpec; + private final ModelSpec modelSpec; + private final @Nullable LookupJoinUtil.AsyncLookupOptions asyncLookupOptions; + private final @Nullable int[] inputUpsertKeys; Review Comment: I move this work into another ticket. CC https://issues.apache.org/jira/browse/FLINK-37901 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org