title: Convert text file to avro using Pig script
body: <p>I am working on Text file to Avro conversion using pig script</p>
  
  <p>`I have a text file in pipe delimited format located at /user/hduser/pig_input/abc.dat</p>
  
  <p><code>1|8|123|985|659856|10000000002546
  1|8|123|985|659856|10000000002546
  1|8|123|985|659856|10000000002546
  1|8|123|985|659856|10000000002546
  1|8|123|985|659856|10000000002546</code></p>
  
  <p>The Schema file is located at hdfs /user/hduser/pig_schema_files/abc.avsc</p>
  
  <pre><code>{
    "type" : "record",
    "name" : "import_dummy",
    "doc" : "import_123dummy",
    "fields" : [ {
    "name" : "ID",
    "type" : [ "string", "null" ],
    "columnName" : "ID",
    "sqlType" : "3"
    }, {
    "name" : "TRANS_O",
    "type" : [ "string", "null" ],
    "columnName" : "TRANS_O",
    "sqlType" : "3"
   }, {
   "name" : "CARD_O",
   "type" : [ "string", "null" ],
   "columnName" : "CARD_O",
   "sqlType" : "3"
   }, {
   "name" : "SEQ_O",
   "type" : [ "string", "null" ],
   "columnName" : "SEQ_O",
   "sqlType" : "1"
   }, {
   "name" : "DATE_O",
   "type" : [ "string", "null" ],
   "columnName" : "DATE_O",
   "sqlType" : "3"
   }],"tableName" : "123dummy"}
  </code></pre>
  
  <p>Following is the script that I wrote</p>
  
  <pre><code>REGISTER /app/cloudera/parcels/CDH/lib/pig/piggybank.jar
  REGISTER /app/cloudera/parcels/CDH/lib/pig/lib/avro-1.3.7.jar
  REGISTER /app/cloudera/parcels/CDH/lib/pig/lib/jackson-core-asl.jar
  REGISTER /app/cloudera/parcels/CDH/lib/pig/lib/jackson-mapper-asl.jar
  REGISTER /app/cloudera/parcels/CDH/lib/pig/lib/json-simple.jar
  REGISTER /app/cloudera/parcels/CDH/lib/pig/lib/snappy-java.jar
  
  textfile = load 'user/hduser/pig_input/abc.dat' using pigStorage('|');
  STORE textfile INTO '/user/hduser/pig_output/' 
      USING org.apache.pig.piggybank.storage.avro.AvroStorage('schema_file','/user/hduser/pig_schema_files/abc.avsc');
  </code></pre>
  
  <p>I am getting the following Error after running the script:</p>
  
  <pre><code>2015-02-03 09:46:56,369 [main] ERROR org.apache.pig.tools.grunt.Grunt  -                                         ERROR 6000:&lt;file script.pig, line 9, column 0&gt; 
      Output Location Validation Failed for: '/user/hduser/pig_output/
      More info to follow:
      Output schema is null!
  </code></pre>