1
votes

I am trying to load an Avro data file into pig using the provided "AvroStorage" load function. The data is generated from a python script that uses python's avro library to convert text data into avro format. Even when I simply try running

out = LOAD "path/to/file.avro" using AvroStorage();

I get the error

java.lang.ClassCastException: org.apache.avro.util.Utf8 cannot be cast to java.lang.String

I am using avro version 1.7.7 to create the data.

I don't know how to tell what version of avro the pig function is using, but the pig versions is 0.12.

Does anybody know why I'm getting this error?

1

1 Answers

0
votes

You can register a jar within pig with

REGISTER <local path>/avro-1.7.7.jar;
out = LOAD "path/to/file.avro" using AvroStorage();

About the error there is a bug reported in pig version 0.12 and it is fixed https://issues.apache.org/jira/browse/PIG-3297