dianfu commented on a change in pull request #11374: [FLINK-16524][python]
Optimize the result of FlattenRowCoder and ArrowCoder to generator to eliminate
unnecessary function calls
URL: https://github.com/apache/flink/pull/11374#discussion_r391999149
##########
File path: flink-python/pyflink/fn_execution/coder_impl.py
##########
@@ -51,18 +55,27 @@ def generate_null_mask_search_table():
return tuple(null_mask)
- def encode_to_stream(self, value, out_stream, nested):
- self.write_null_mask(value, out_stream)
+ def encode_to_stream(self, iter_value, out_stream, nested):
field_coders = self._field_coders
- for i in range(self._filed_count):
- item = value[i]
- if item is not None:
- field_coders[i].encode_to_stream(item, out_stream, nested)
+ data_out_stream = self.data_out_stream
+ for value in iter_value:
+ self.write_null_mask(value, data_out_stream)
+ for i in range(self._filed_count):
Review comment:
Could you rename _filed_count to _field_count? It's not directly related to
this PR, however it would be great if we can correct the typo as it's used in
this PR.
----------------------------------------------------------------
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