From 92a57ce09848ff7753c55d93d31be2a95fcd0b58 Mon Sep 17 00:00:00 2001 From: Brian Hulette Date: Wed, 22 Jun 2022 15:13:22 -0700 Subject: [PATCH] Fix flatmap bug --- sdks/python/apache_beam/runners/common.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdks/python/apache_beam/runners/common.py b/sdks/python/apache_beam/runners/common.py index 9d47c2ce6a219..66a7bfc38d058 100644 --- a/sdks/python/apache_beam/runners/common.py +++ b/sdks/python/apache_beam/runners/common.py @@ -1561,7 +1561,8 @@ def handle_process_outputs( A value wrapped in a TaggedOutput object will be unwrapped and then dispatched to the appropriate indexed output. """ - results = results or [] + if results is None: + results = [] # TODO(https://github.com/apache/beam/issues/20404): Verify that the # results object is a valid iterable type if @@ -1614,7 +1615,9 @@ def handle_process_batch_outputs( A value wrapped in a TaggedOutput object will be unwrapped and then dispatched to the appropriate indexed output. """ - results = results or [] + if results is None: + results = [] + output_element_count = 0 for result in results: tag, result = self._handle_tagged_output(result)