This is an automated email from the ASF dual-hosted git repository.
cvandermerwe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new dd0f41d3fe7 Fix _OrderedUnionCoder is_deterministic check. (#37550)
dd0f41d3fe7 is described below
commit dd0f41d3fe79bb3c9322e83871f2735b7d19114c
Author: claudevdm <[email protected]>
AuthorDate: Mon Feb 9 12:34:29 2026 -0500
Fix _OrderedUnionCoder is_deterministic check. (#37550)
---
sdks/python/apache_beam/coders/coders.py | 2 +-
sdks/python/apache_beam/coders/coders_test_common.py | 14 ++++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/sdks/python/apache_beam/coders/coders.py
b/sdks/python/apache_beam/coders/coders.py
index ddcb8063048..b1c607457f9 100644
--- a/sdks/python/apache_beam/coders/coders.py
+++ b/sdks/python/apache_beam/coders/coders.py
@@ -1512,7 +1512,7 @@ class _OrderedUnionCoder(FastCoder):
def is_deterministic(self) -> bool:
return (
- all(c.is_deterministic for _, c in self._coder_types) and (
+ all(c.is_deterministic() for _, c in self._coder_types) and (
self._fallback_coder is None or
self._fallback_coder.is_deterministic()))
diff --git a/sdks/python/apache_beam/coders/coders_test_common.py
b/sdks/python/apache_beam/coders/coders_test_common.py
index fcc5e6ac58b..ad742665fb8 100644
--- a/sdks/python/apache_beam/coders/coders_test_common.py
+++ b/sdks/python/apache_beam/coders/coders_test_common.py
@@ -1082,6 +1082,20 @@ class CodersTest(unittest.TestCase):
self.check_coder(test_coder, 123)
self.check_coder(test_coder, 1.5)
+ def test_OrderedUnionCoderDeterministic(self):
+ # CustomCoder is not deterministic therefore test_coder is not
+ # deterministic
+ test_coder = coders._OrderedUnionCoder((str, coders.StrUtf8Coder()),
+ (int, CustomCoder()),
+ fallback_coder=coders.FloatCoder())
+
+ self.assertFalse(test_coder.is_deterministic())
+
+ test_coder = coders._OrderedUnionCoder((str, coders.StrUtf8Coder()),
+ (int, coders.VarIntCoder()),
+ fallback_coder=coders.FloatCoder())
+ self.assertTrue(test_coder.is_deterministic())
+
if __name__ == '__main__':
logging.getLogger().setLevel(logging.INFO)