You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/04/06 19:15:25 UTC

[jira] [Commented] (BEAM-44) Return the input coder in NullableCoder.of() if it is a NullableCoder

    [ https://issues.apache.org/jira/browse/BEAM-44?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15228675#comment-15228675 ] 

ASF GitHub Bot commented on BEAM-44:
------------------------------------

GitHub user tgroh opened a pull request:

    https://github.com/apache/incubator-beam/pull/136

    [BEAM-44] Stop nesting Nullable coders

    Be sure to do all of the following to help us incorporate your contribution
    quickly and easily:
    
     - [x] Make sure the PR title is formatted like:
       `[BEAM-<Jira issue #>] Description of pull request`
     - [x] Make sure tests pass via `mvn clean verify`. (Even better, enable
           Travis-CI on your fork and ensure the whole test matrix passes).
     - [ ] Replace "<Jira issue #>" in the title with the actual Jira issue
           number, if there is one.
     - [ ] If this contribution is large, please file an Apache
           [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.txt).
    
    ---
    
    A single layer of nullable coders is sufficient to safely encode
    possibly-null values. This allows use of NullableCoder#of to wrap any
    coder, without duplicating null-safety logic applied by NullableCoder.
    
    Fixes BEAM-44

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tgroh/incubator-beam nullable_coder

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-beam/pull/136.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #136
    
----
commit 6f9fef4624b12ddce94cdc819472eb3a724dda33
Author: Thomas Groh <tg...@google.com>
Date:   2016-04-06T17:07:29Z

    Stop nesting Nullable coders
    
    A single layer of nullable coders is sufficient to safely encode
    possibly-null values. This allows use of NullableCoder#of to wrap any
    coder, without duplicating null-safety logic applied by NullableCoder.
    
    Fixes BEAM-44

----


> Return the input coder in NullableCoder.of() if it is a NullableCoder
> ---------------------------------------------------------------------
>
>                 Key: BEAM-44
>                 URL: https://issues.apache.org/jira/browse/BEAM-44
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>            Reporter: Thomas Groh
>            Assignee: Thomas Groh
>            Priority: Trivial
>
> NullableCoder.of(NullableCoder.of(foo)) returns a nested Nullable Coder, which appends two "present" bytes before null values. The second coder is unnecessary, and does not need to be provided. Instead, in the factory method, return the input coder if it is a Nullable coder
> NullableCoder<T> of(Coder<T> coder) {
>   if (coder instanceof NullableCoder) return coder;
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)