This is an automated email from the ASF dual-hosted git repository. hxb pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit 25e1345ea72a9c27a97a6c7bf6e3c548dfd0d5d7 Author: huangxingbo <[email protected]> AuthorDate: Tue Jul 27 15:52:22 2021 +0800 [hotfix][python] Fix the input value is None in IterableCoderImpl This closes #16611. --- flink-python/pyflink/fn_execution/coder_impl_fast.pyx | 7 ++++--- flink-python/pyflink/fn_execution/coder_impl_slow.py | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/flink-python/pyflink/fn_execution/coder_impl_fast.pyx b/flink-python/pyflink/fn_execution/coder_impl_fast.pyx index ee04693..719756f 100644 --- a/flink-python/pyflink/fn_execution/coder_impl_fast.pyx +++ b/flink-python/pyflink/fn_execution/coder_impl_fast.pyx @@ -262,9 +262,10 @@ cdef class IterableCoderImpl(LengthPrefixBaseCoderImpl): self._separated_with_end_message = separated_with_end_message cpdef encode_to_stream(self, value, LengthPrefixOutputStream output_stream): - for item in value: - self._field_coder.encode_to_stream(item, self._data_out_stream) - self._write_data_to_output_stream(output_stream) + if value: + for item in value: + self._field_coder.encode_to_stream(item, self._data_out_stream) + self._write_data_to_output_stream(output_stream) # write end message if self._separated_with_end_message: diff --git a/flink-python/pyflink/fn_execution/coder_impl_slow.py b/flink-python/pyflink/fn_execution/coder_impl_slow.py index 0ea9c23..22bb995 100644 --- a/flink-python/pyflink/fn_execution/coder_impl_slow.py +++ b/flink-python/pyflink/fn_execution/coder_impl_slow.py @@ -92,9 +92,10 @@ class IterableCoderImpl(LengthPrefixBaseCoderImpl): self._separated_with_end_message = separated_with_end_message def encode_to_stream(self, value: List, out_stream: OutputStream): - for item in value: - self._field_coder.encode_to_stream(item, self._data_out_stream) - self._write_data_to_output_stream(out_stream) + if value: + for item in value: + self._field_coder.encode_to_stream(item, self._data_out_stream) + self._write_data_to_output_stream(out_stream) # write end message if self._separated_with_end_message:
