You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@crunch.apache.org by "Josh Wills (JIRA)" <ji...@apache.org> on 2013/04/09 17:14:16 UTC

[jira] [Commented] (CRUNCH-195) NullPointerException when writing PTables created by PTables.asPTable as Avro

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

Josh Wills commented on CRUNCH-195:
-----------------------------------

I'm not sure this is a bug, although I understand why you want it to work the way that you do. Right now, we don't have a concept of a union type outside of the optional null values that are allowed in Tuple objects.
                
> NullPointerException when writing PTables created by PTables.asPTable as Avro
> -----------------------------------------------------------------------------
>
>                 Key: CRUNCH-195
>                 URL: https://issues.apache.org/jira/browse/CRUNCH-195
>             Project: Crunch
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 0.5.0
>            Reporter: Dave Beech
>            Assignee: Josh Wills
>
> See code fragment below. This is a left join where not all keys match, so some values on the right-hand side of the Pairs are null.
> ---
> PTable<String,String> a = ...
> PTable<String,String> b = ...
> PTable<String,Pair<String,String>> joined = Join.leftJoin(a, b);
> PCollection<Pair<String, String>> joinedValuesCollection = joined.values();
> joinedValuesCollection.write(To.avroFile("joined-pcol"));
> PTable<String,String> joinedValuesTable = PTables.asPTable(joinedValuesCollection);
> joinedValuesTable.write(To.avroFile("joined-ptable"));
> ---
> The first write to "joined-pcol" works, and the resulting Avro schema is a Pair of type union ['string','null']. 
> The second write to "joined-ptable" fails with NPE - it appears the String types are no longer unioned with null and the values are being rejected by the output format. 
> I think this is a bug. The output schema of the PTable should be the same as it was before it was converted from PCollection<Pair<...>>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira