dianfu commented on a change in pull request #9858: [FLINK-14208][python]
Optimize Python UDFs with parameters of constant values
URL: https://github.com/apache/flink/pull/9858#discussion_r332890181
##########
File path: flink-python/pyflink/fn_execution/operations.py
##########
@@ -79,6 +82,34 @@ def get(self, value):
return self.scalar_function_invoker.invoke_eval(value)
+serializer = PickleSerializer()
+
+
+class ConstantInputGetter(InputGetter):
+ """
+ InputGetter for the input argument which is the constant value.
+
+ :param constant_value: the constant value of the column in the input row
+ """
+
+ def __init__(self, constant_value):
+ j_type = constant_value.value[0]
+ pickled_data = serializer.loads(constant_value.value[1:])
+ if j_type == '\x00':
+ self._constant_value = pickled_data
Review comment:
add some comments for each case?
----------------------------------------------------------------
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