[
https://issues.apache.org/jira/browse/BEAM-8355?focusedWorklogId=324656&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-324656
]
ASF GitHub Bot logged work on BEAM-8355:
----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Oct/19 22:04
Start Date: 07/Oct/19 22:04
Worklog Time Spent: 10m
Work Description: robertwb commented on pull request #9735: [BEAM-8355]
Add a standard boolean coder
URL: https://github.com/apache/beam/pull/9735#discussion_r332258190
##########
File path: sdks/python/apache_beam/coders/coder_impl.py
##########
@@ -446,6 +446,28 @@ def decode(self, encoded):
return encoded
+class BooleanCoderImpl(CoderImpl):
+ """For internal use only; no backwards-compatibility guarantees.
+
+ A coder for bool objects."""
+
+ def encode_to_stream(self, value, out, nested):
+ out.write_byte(1 if value else 0)
+
+ def decode_from_stream(self, in_stream, nested):
+ return in_stream.read_byte() == 1
Review comment:
It'd be forward compatible to fix Java as nothing should be written with
these higher values. Let's either do that or reject anything outside of {0, 1}.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 324656)
Time Spent: 1h 50m (was: 1h 40m)
> Make BooleanCoder a standard coder
> ----------------------------------
>
> Key: BEAM-8355
> URL: https://issues.apache.org/jira/browse/BEAM-8355
> Project: Beam
> Issue Type: New Feature
> Components: beam-model, sdk-java-core, sdk-py-core
> Reporter: Chad Dombrova
> Assignee: Chad Dombrova
> Priority: Major
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
> This involves making the current java BooleanCoder a standard coder, and
> implementing an equivalent coder in python
--
This message was sent by Atlassian Jira
(v8.3.4#803005)