Review Board 1.7.22


PIG-3322 Fix the issue where NPE is thrown when reading a union which has nulls and add a testcase

Review Request #11333 - Created May 22, 2013 and updated

Viraj Bhat
Reviewers
pig
rohini
pig
Null pointer exception when loading union with null in it's schema. Test case was also updated with a sample test case.
Yes all tests pass in the piggybank
http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/AvroStorage.java
Revision 1485358 New Change
[20] 531 lines
[+20] [+] protected void init(Map<String, Object> inputs) throws IOException {
532
                /* use schema in the specified path as output schema */
532
                /* use schema in the specified path as output schema */
533
                Path path = new Path( ((String) value).trim());
533
                Path path = new Path( ((String) value).trim());
534
                AvroStorageLog.details("data path=" + path.toUri().toString());
534
                AvroStorageLog.details("data path=" + path.toUri().toString());
535
                FileSystem fs = FileSystem.get(path.toUri(), new Configuration());
535
                FileSystem fs = FileSystem.get(path.toUri(), new Configuration());
536
                outputAvroSchema = getAvroSchema(path, fs);
536
                outputAvroSchema = getAvroSchema(path, fs);
537
                userSpecifiedAvroSchema = outputAvroSchema;

   
538
            } else if (name.equalsIgnoreCase("nullable")) {
537
            } else if (name.equalsIgnoreCase("nullable")) {
539
                nullable = (Boolean) value;
538
                nullable = (Boolean) value;
540
            } else if (name.equalsIgnoreCase("schema")) {
539
            } else if (name.equalsIgnoreCase("schema")) {
541
                outputAvroSchema = Schema.parse((String) value);
540
                outputAvroSchema = Schema.parse((String) value);
542
                userSpecifiedAvroSchema = outputAvroSchema;
541
                userSpecifiedAvroSchema = outputAvroSchema;
[+20] [20] 191 lines
http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/PigAvroRecordReader.java
Revision 1485358 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/storage/avro/TestAvroStorage.java
Revision 1485358 New Change
 
  1. http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/AvroStorage.java: Loading...
  2. http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/PigAvroRecordReader.java: Loading...
  3. http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/storage/avro/TestAvroStorage.java: Loading...