From 754a25f2b4354db0e31928ef55f293920bfad038 Mon Sep 17 00:00:00 2001 From: tvalentyn Date: Wed, 23 Dec 2020 17:02:11 -0800 Subject: [PATCH 1/2] Revert "Optimizes extract_output for 1 element accumulator case. (#13220)" This reverts commit 34e27ba1dd6ec8886d0df7e5fcd3600fd64db914. --- sdks/python/apache_beam/transforms/core.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sdks/python/apache_beam/transforms/core.py b/sdks/python/apache_beam/transforms/core.py index ba29b7d3fbac..1f48c5fc3b1a 100644 --- a/sdks/python/apache_beam/transforms/core.py +++ b/sdks/python/apache_beam/transforms/core.py @@ -1075,10 +1075,7 @@ def compact(self, accumulator, *args, **kwargs): return [self._fn(accumulator, *args, **kwargs)] def extract_output(self, accumulator, *args, **kwargs): - if len(accumulator) == 1: - return accumulator[0] - else: - return self._fn(accumulator, *args, **kwargs) + return self._fn(accumulator, *args, **kwargs) def default_type_hints(self): fn_hints = get_type_hints(self._fn) @@ -1155,10 +1152,7 @@ def compact(self, accumulator): return [self._fn(accumulator)] def extract_output(self, accumulator): - if len(accumulator) == 1: - return accumulator[0] - else: - return self._fn(accumulator) + return self._fn(accumulator) class PartitionFn(WithTypeHints): From 24ccdc7643950ff23d2bd8d07e781dd2fef2500f Mon Sep 17 00:00:00 2001 From: Valentyn Tymofieiev Date: Wed, 23 Dec 2020 17:19:47 -0800 Subject: [PATCH 2/2] Add a note on known issue. --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 108903df5d68..99b397111862 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -133,6 +133,10 @@ * BigQuery's DATETIME type now maps to Beam logical type org.apache.beam.sdk.schemas.logicaltypes.SqlTypes.DATETIME * Pandas 1.x is now required for dataframe operations. +## Known Issues + +* Non-idempotent combiners built via `CombineFn.from_callable()` or `CombineFn.maybe_from_callable()` can lead to incorrect behavior. ([BEAM-11522](https://issues.apache.org/jira/browse/BEAM-11522)). + # [2.25.0] - 2020-10-23