You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ke...@apache.org on 2017/06/12 16:55:25 UTC
[10/50] [abbrv] beam git commit: Make BytesCoder to be a known type
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/gearpump-runner
Commit: d94ac58ea2d12f55743e8ad27a02bdb83c194da7
Parents: 66460cb
Author: Vikas Kedigehalli <vi...@google.com>
Authored: Wed Jun 7 16:26:21 2017 -0700
Committer: Luke Cwik <lc...@google.com>
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.