dianfu commented on a change in pull request #11208: [FLINK-16271][python] 
Introduce ArrowPythonScalarFunctionOperator for vectorized Python UDF execution
URL: https://github.com/apache/flink/pull/11208#discussion_r385471716
 
 

 ##########
 File path: 
flink-python/src/main/java/org/apache/flink/table/runtime/operators/python/scalar/arrow/ArrowPythonScalarFunctionOperator.java
 ##########
 @@ -0,0 +1,126 @@
+/*
+ * 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.runtime.operators.python.scalar.arrow;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.python.PythonFunctionRunner;
+import org.apache.flink.python.env.PythonEnvironmentManager;
+import org.apache.flink.table.functions.ScalarFunction;
+import org.apache.flink.table.functions.python.PythonFunctionInfo;
+import org.apache.flink.table.runtime.arrow.ArrowReader;
+import org.apache.flink.table.runtime.arrow.ArrowUtils;
+import 
org.apache.flink.table.runtime.operators.python.scalar.AbstractRowPythonScalarFunctionOperator;
+import 
org.apache.flink.table.runtime.runners.python.scalar.arrow.ArrowPythonScalarFunctionRunner;
+import org.apache.flink.table.runtime.types.CRow;
+import org.apache.flink.table.types.logical.RowType;
+import org.apache.flink.types.Row;
+
+import org.apache.arrow.memory.BufferAllocator;
+import org.apache.arrow.vector.VectorSchemaRoot;
+import org.apache.arrow.vector.ipc.ArrowStreamReader;
+import org.apache.beam.sdk.fn.data.FnDataReceiver;
+
+import java.io.IOException;
+
+/**
+ * Arrow Python {@link ScalarFunction} operator for the old planner.
+ */
+@Internal
+public class ArrowPythonScalarFunctionOperator extends 
AbstractRowPythonScalarFunctionOperator {
 
 Review comment:
   I'm afraid that we cannot do that. Currently 
ArrowPythonScalarFunctionOperator and PythonScalarFunctionOperator extends the 
same abstract base class, while BaseRowArrowPythonScalarFunctionOperator and 
BaseRowPythonScalarFunctionOperator share the same abstract base class. This is 
a little different from the runner because the operators from the same planner 
could share more code. 
   Besides, it seems that there is no much code duplication between 
ArrowPythonScalarFunctionOperator and BaseRowArrowPythonScalarFunctionOperator 
and only open/close method could be reused between them(about 20 lines of 
code). Definitely agree with you that we should remove code duplication as much 
as possible. However, it's not easy to remove all the code duplication as we 
want to support two kinds of planners, two kinds of udfs. We can only make the 
code duplication as minimum as possible. What's your thought? 

----------------------------------------------------------------
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

Reply via email to