crunch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Roling (JIRA)" <>
Subject [jira] [Created] (CRUNCH-204) MemPipeline.write() is inconsistent with
Date Wed, 08 May 2013 20:31:16 GMT
Ben Roling created CRUNCH-204:

             Summary: MemPipeline.write() is inconsistent with
                 Key: CRUNCH-204
             Project: Crunch
          Issue Type: Bug
    Affects Versions: 0.5.0
            Reporter: Ben Roling of a file written with MemPipeline.write(collection, AvroFileTarget)
fails with Not a data file.

I seems the way the file is written is inconsistent with the way it is read.  The appears
to not actually be written out in Avro format.  It seems MemPipeline.write() simply does a
toString() on each of the elements in the collection and spits that out to the target's path
with each element separated by a newline.

Here is a simple test that demonstrates the issue:
final Pipeline memPipeline = MemPipeline.getInstance();
        final String path = "persons";
        final PCollection<Person> persons = MemPipeline.collectionOf(Collections.singleton(new
Person("John Doe")));
        memPipeline.write(persons, new AvroFileTarget(path));
        // throws IOException! AvroFileSource<Person>(new Path(path), Avros.records(Person.class)));

The Person class in the example is is based on this simple Avro schema:
protocol PersonProtocol {
  record Person {
    string name;

This is pretty confusing behavior.  I ran into it trying to do some simple testing and it
took me longer than I'd like to admit to figure out what was going on.  I imagine others will
run into it and be similarly confused.

I've left the priority as the default of Major although I suppose that point could be argued.
 Reset it as you like.

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:

View raw message