Repository: beam Updated Branches: refs/heads/master 66460cb2d -> 0a0a1bc74
Make BytesCoder to be a known type Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/d94ac58e Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/d94ac58e Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/d94ac58e Branch: refs/heads/master Commit: d94ac58ea2d12f55743e8ad27a02bdb83c194da7 Parents: 66460cb Author: Vikas Kedigehalli <[email protected]> Authored: Wed Jun 7 16:26:21 2017 -0700 Committer: Luke Cwik <[email protected]> Committed: Wed Jun 7 20:05:40 2017 -0700 ---------------------------------------------------------------------- sdks/python/apache_beam/coders/coders.py | 5 +++++ sdks/python/apache_beam/runners/worker/operation_specs.py | 4 ++++ 2 files changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/d94ac58e/sdks/python/apache_beam/coders/coders.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/coders/coders.py b/sdks/python/apache_beam/coders/coders.py index f40045d..f3e0b43 100644 --- a/sdks/python/apache_beam/coders/coders.py +++ b/sdks/python/apache_beam/coders/coders.py @@ -286,6 +286,11 @@ class BytesCoder(FastCoder): def is_deterministic(self): return True + def as_cloud_object(self): + return { + '@type': 'kind:bytes', + } + def __eq__(self, other): return type(self) == type(other) http://git-wip-us.apache.org/repos/asf/beam/blob/d94ac58e/sdks/python/apache_beam/runners/worker/operation_specs.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/runners/worker/operation_specs.py b/sdks/python/apache_beam/runners/worker/operation_specs.py index db5eb76..b8d19a1 100644 --- a/sdks/python/apache_beam/runners/worker/operation_specs.py +++ b/sdks/python/apache_beam/runners/worker/operation_specs.py @@ -339,6 +339,10 @@ def get_coder_from_spec(coder_spec): assert len(coder_spec['component_encodings']) == 1 return coders.coders.LengthPrefixCoder( get_coder_from_spec(coder_spec['component_encodings'][0])) + elif coder_spec['@type'] == 'kind:bytes': + assert ('component_encodings' not in coder_spec + or len(coder_spec['component_encodings'] == 0)) + return coders.BytesCoder() # We pass coders in the form "<coder_name>$<pickled_data>" to make the job # description JSON more readable.
