Have you looked into the code for the toText Java?
We construct the Schema.Parser().parse method as follows
if (!fileReader.getSchema().equals(new
Schema.Parser().parse(TEXT_FILE_SCHEMA))) {
TEXT_FILE_SCHEMA has a static value of
private static final String TEXT_FILE_SCHEMA =
"\"bytes\"";
We can therefore conclude that your Avro data has a Schema which does not
match this... therefore benehviour is correct.
Are you able to try doing fileReader.getSchema() to see what thre Schema is
like?
hth
Lewis
On Mon, Jul 14, 2014 at 1:22 AM, julianpeeters <[email protected]>
wrote:
> Hi,
>
> I'm exploring the human-readable avro options in the avro-tools jar, namely
> `tojson` and `totext`.
>
> `tojson` works fine, but I try `totext` with:
>
> `$ java -jar avro-tools-1.7.6.jar totext twitter.avro twitter.txt`,
>
> then twitter.txt is empty and I get this error:
>
> Jul 13, 2014 8:41:19 PM org.apache.hadoop.util.NativeCodeLoader
> <clinit>
> WARNING: Unable to load native-hadoop library for your platform...
> using
> builtin-java classes where applicable
> Avro file is not generic text schema
>
>
> What am I doing wrong?
>
> Thanks for looking,
> -Julian
>
> PS (Looking into the source, it looks like this error is thrown when the
> schema in the datafile is not equal to the string "\"bytes"\", but I have a
> hard time understanding why the datafile's schema would ever be that.)
>
>
>
>
>
> --
> View this message in context:
> http://apache-avro.679487.n3.nabble.com/Error-when-trying-to-convert-a-local-datafile-to-plain-text-with-Avro-Tools-tp4030458.html
> Sent from the Avro - Users mailing list archive at Nabble.com.
>
--
*Lewis*