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

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

Dave Beech created CRUNCH-195:
---------------------------------

             Summary: 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