You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@avro.apache.org by Tatsuya Mori <mo...@gmail.com> on 2011/01/22 16:55:28 UTC

a question on C API

Hi,

I have a trouble in using Avro C API for processing a large data set.
I started by testing the example code below using Avro 1.4.1 (release).
http://avro.apache.org/docs/1.4.1/api/c/index.html#_examples

The code compiles and runs without any problems. After changing the
data appending part (please see the snippet below), I found the data
reading function is terminated with an error, which is associated with
the avro_file_reader_read(). The function returns byte sequence error
(EILSEQ). This error may indicate that the size of sync is wrongly
recorded in the avro file reader. But, I have not been able to
understand how this could happen. Is there any way to fix this? Or am
I misusing the API? I would appreciate your comments. Thanks!

Tatsuya

[changed part]
        /* Add people to the database for 6000 times */
        int j;
        for (j=1; j<=1000; j++) {
        	add_person(db, "Dante", "Hicks", "(555) 123-4567", j);
        	add_person(db, "Randal", "Graves", "(555) 123-5678", j);
        	add_person(db, "Veronica", "Loughran", "(555) 123-0987", j);
        	add_person(db, "Caitlin", "Bree", "(555) 123-2323", j);
        	add_person(db, "Bob", "Silent", "(555) 123-6422", j);
        	add_person(db, "Jay", "???", "(555) 123-9182", j);
        }

[part of output]
Successfully added Hicks, Dante id=1
Successfully added Graves, Randal id=2
Successfully added Loughran, Veronica id=3
Successfully added Bree, Caitlin id=4
...
Successfully added Bree, Caitlin id=5998
Successfully added Silent, Bob id=5999
Successfully added ???, Jay id=6000

Now let's read all the records back out
1 |           Dante |           Hicks |  (555) 123-4567 | 1
2 |          Randal |          Graves |  (555) 123-5678 | 1
3 |        Veronica |        Loughran |  (555) 123-0987 | 1
4 |         Caitlin |            Bree |  (555) 123-2323 | 1
...
527 |             Bob |          Silent |  (555) 123-6422 | 88
528 |             Jay |             ??? |  (555) 123-9182 | 88
529 |           Dante |           Hicks |  (555) 123-4567 | 89
530 |          Randal |          Graves |  (555) 123-5678 | 89
Error printing person