Created
May 12, 2011 05:14
-
-
Save tebeka/967968 to your computer and use it in GitHub Desktop.
Counting records in Avro file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <avro.h> | |
#include <stdlib.h> | |
int | |
main(int argc, char *argv[]) { | |
if (argc != 2) { | |
fprintf(stderr, "usage: reader FILENAME\n"); | |
exit(1); | |
} | |
avro_file_reader_t reader; | |
avro_datum_t datum; | |
if (avro_file_reader(argv[1], &reader) != 0) { | |
fprintf(stderr, "error: can't open"); | |
exit(1); | |
} | |
int count = 0; | |
for (; avro_file_reader_read(reader, NULL, &datum) == 0; count++) { | |
} | |
avro_file_reader_close(reader); | |
printf("%d\n", count); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment