[ 
https://issues.apache.org/jira/browse/BEAM-8355?focusedWorklogId=324844&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-324844
 ]

ASF GitHub Bot logged work on BEAM-8355:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Oct/19 04:00
            Start Date: 08/Oct/19 04:00
    Worklog Time Spent: 10m 
      Work Description: chadrik commented on pull request #9735: [BEAM-8355] 
Add a standard boolean coder
URL: https://github.com/apache/beam/pull/9735#discussion_r332327756
 
 

 ##########
 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:
   Take a look at my latest changes, and see if that's what you have in mind.  
I went with option 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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 324844)
    Time Spent: 2h  (was: 1h 50m)

> 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: 2h
>  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)

Reply via email to