You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by tv...@apache.org on 2022/04/28 10:31:32 UTC

[beam] branch master updated: [BEAM-14351] Inherit from Coder. (#17437)

This is an automated email from the ASF dual-hosted git repository.

tvalentyn 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 b0e6b561683 [BEAM-14351] Inherit from Coder. (#17437)
b0e6b561683 is described below

commit b0e6b561683425fe865720970ce60d45ecec11e4
Author: Robert Bradshaw <ro...@gmail.com>
AuthorDate: Thu Apr 28 03:31:20 2022 -0700

    [BEAM-14351] Inherit from Coder. (#17437)
---
 CHANGES.md                                          | 1 +
 sdks/python/apache_beam/examples/cookbook/coders.py | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGES.md b/CHANGES.md
index 9737f8a0b2f..02c672c5681 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -35,6 +35,7 @@
 
 ## Breaking Changes
 
+* Coders in Python are expected to inherit from Coder. ([BEAM-14351](https://issues.apache.org/jira/browse/BEAM-14351)).
 * X behavior was changed ([BEAM-X](https://issues.apache.org/jira/browse/BEAM-X)).
 
 ## Deprecations
diff --git a/sdks/python/apache_beam/examples/cookbook/coders.py b/sdks/python/apache_beam/examples/cookbook/coders.py
index cb8d4c29cda..33b63fd2954 100644
--- a/sdks/python/apache_beam/examples/cookbook/coders.py
+++ b/sdks/python/apache_beam/examples/cookbook/coders.py
@@ -35,13 +35,14 @@ import json
 import logging
 
 import apache_beam as beam
+from apache_beam.coders import Coder
 from apache_beam.io import ReadFromText
 from apache_beam.io import WriteToText
 from apache_beam.options.pipeline_options import PipelineOptions
 from apache_beam.options.pipeline_options import SetupOptions
 
 
-class JsonCoder(object):
+class JsonCoder(Coder):
   """A JSON coder interpreting each line as a JSON string."""
   def encode(self, x):
     return json.dumps(x).encode('utf-8')