You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "deb ashish (JIRA)" <ji...@apache.org> on 2012/09/13 11:27:08 UTC

[jira] [Commented] (PIG-1748) Add load/store function AvroStorage for avro data

    [ https://issues.apache.org/jira/browse/PIG-1748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13454762#comment-13454762 ] 

deb ashish commented on PIG-1748:
---------------------------------

REGISTER /path/avro-1.4.1.jar
REGISTER /path/json-simple-1.1.jar
REGISTER /path/piggybank.jar
REGISTER /path/jackson-core-asl-1.5.5.jar
REGISTER /path/jackson-mapper-asl-1.5.5.jar
avro = LOAD '/hdfs path/part-r-00000.avro' USING org.apache.pig.piggybank.storage.avro.AvroStorage();

Im trying this code but it's unable to read the avro file,showing  the following exception


Pig Stack Trace
---------------
ERROR 2997: Unable to recreate exception from backed error: Error: Found class org.apache.hadoop.mapreduce.TaskAttemptContext, but interface was expected

org.apache.pig.impl.logicalLayer.FrontendException: ERROR 1066: Unable to open iterator for alias sc. Backend error : Unable to recreate exception from backed error: Error: Found class org.apache.hadoop.mapreduce.TaskAttemptContext, but interface was expected
	at org.apache.pig.PigServer.openIterator(PigServer.java:742)
	at org.apache.pig.tools.grunt.GruntParser.processDump(GruntParser.java:612)
	at org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:303)
	at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:165)
	at org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:141)
	at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:90)
	at org.apache.pig.Main.run(Main.java:406)
	at org.apache.pig.Main.main(Main.java:107)
Caused by: org.apache.pig.backend.executionengine.ExecException: ERROR 2997: Unable to recreate exception from backed error: Error: Found class org.apache.hadoop.mapreduce.TaskAttemptContext, but interface was expected
	at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.Launcher.getErrorMessages(Launcher.java:221)
	at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.Launcher.getStats(Launcher.java:151)
	at org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher.launchPig(MapReduceLauncher.java:337)
	at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.execute(HExecutionEngine.java:378)
	at org.apache.pig.PigServer.executeCompiledLogicalPlan(PigServer.java:1198)
	at org.apache.pig.PigServer.storeEx(PigServer.java:874)
	at org.apache.pig.PigServer.store(PigServer.java:816)
	at org.apache.pig.PigServer.openIterator(PigServer.java:728)
	... 7 more

please help me asap


                
> Add load/store function AvroStorage for avro data
> -------------------------------------------------
>
>                 Key: PIG-1748
>                 URL: https://issues.apache.org/jira/browse/PIG-1748
>             Project: Pig
>          Issue Type: Improvement
>          Components: impl
>            Reporter: lin guo
>            Assignee: lin guo
>             Fix For: 0.9.0
>
>         Attachments: avro_storage.patch, AvroStorageUtils-bagfix.patch, avro_test_files.tar.gz, PIG-1748-2.patch, PIG-1748-3.patch
>
>
> We want to use Pig to process arbitrary Avro data and store results as Avro files. AvroStorage() extends two PigFuncs: LoadFunc and StoreFunc. 
> Due to discrepancies of Avro and Pig data models, AvroStorage has:
> 1. Limited support for "record": we do not support recursively defined record because the number of fields in such records is data dependent.
> 2. Limited support for "union": we only accept nullable union like ["null", "some-type"].
> For simplicity, we also make the following assumptions:
> If the input directory is a leaf directory, then we assume Avro data files in it have the same schema;
> If the input directory contains sub-directories, then we assume Avro data files in all sub-directories have the same schema.
> AvroStorage takes no input parameters when used as a LoadFunc (except for "debug [debug-level]"). 
> Users can provide parameters to AvroStorage when used as a StoreFunc. If they don't, Avro schema of output data is derived from its 
> Pig schema.
> Detailed documentation can be found in http://linkedin.jira.com/wiki/display/HTOOLS/AvroStorage+-+Pig+support+for+Avro+data

--
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: http://www.atlassian.com/software/jira