hequn8128 commented on a change in pull request #9653: [FLINK-14014][python] Introduce PythonScalarFunctionRunner to handle the communication with Python worker for Python ScalarFunction execution URL: https://github.com/apache/flink/pull/9653#discussion_r324588222
########## File path: flink-python/src/main/java/org/apache/flink/table/functions/python/AbstractPythonScalarFunctionRunner.java ########## @@ -0,0 +1,225 @@ +/* + * 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.functions.python; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.annotation.VisibleForTesting; +import org.apache.flink.fnexecution.v1.FlinkFnApi; +import org.apache.flink.python.AbstractPythonFunctionRunner; +import org.apache.flink.python.PythonFunctionRunner; +import org.apache.flink.table.functions.ScalarFunction; +import org.apache.flink.table.types.logical.RowType; +import org.apache.flink.util.Preconditions; + +import com.google.protobuf.ByteString; +import org.apache.beam.model.pipeline.v1.RunnerApi; +import org.apache.beam.runners.core.construction.ModelCoders; +import org.apache.beam.runners.core.construction.graph.ExecutableStage; +import org.apache.beam.runners.core.construction.graph.ImmutableExecutableStage; +import org.apache.beam.runners.core.construction.graph.PipelineNode; +import org.apache.beam.runners.core.construction.graph.SideInputReference; +import org.apache.beam.runners.core.construction.graph.TimerReference; +import org.apache.beam.runners.core.construction.graph.UserStateReference; +import org.apache.beam.sdk.fn.data.FnDataReceiver; + +import java.util.Collections; +import java.util.List; + +/** + * Abstract {@link PythonFunctionRunner} used to execute Python {@link ScalarFunction}s. + * + * @param <IN> Type of the input elements. + * @param <OUT> Type of the execution results. + */ +@Internal +public abstract class AbstractPythonScalarFunctionRunner<IN, OUT> extends AbstractPythonFunctionRunner<IN, OUT> { + + private static final String SCHEMA_CODER_URN = "flink:coder:schema:v1"; + private static final String SCALAR_FUNCTION_URN = "flink:transform:scalar_function:v1"; + + private static final String INPUT_ID = "input"; + private static final String OUTPUT_ID = "output"; + private static final String TRANSFORM_ID = "transform"; + + private static final String MAIN_INPUT_NAME = "input"; + private static final String MAIN_OUTPUT_NAME = "output"; + + private static final String INPUT_CODER_ID = "input_coder"; + private static final String OUTPUT_CODER_ID = "output_coder"; + private static final String WINDOW_CODER_ID = "window_coder"; + + private static final String WINDOW_STRATEGY = "windowing-strategy"; Review comment: change to `windowing_strategy`? Make it consistent with other names. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
