Review Board 1.7.22


PIG-3318 Patch to address default values when schemas are merged in AvroStorage. It does this for Records containing primitive values

Review Request #11135 - Created May 14, 2013 and updated

Viraj Bhat
trunk
PIG-3318
Reviewers
pig
rohini
pig
Default values are not honoured when merging default schema
Yes
http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/AvroStorage.java
Revision 1484564 New Change
[20] 316 lines
[+20] [+] protected Schema getSchemaFromFile(Path path, FileSystem fs) throws IOException {
317
    @Override
317
    @Override
318
    public InputFormat getInputFormat() throws IOException {
318
    public InputFormat getInputFormat() throws IOException {
319
        AvroStorageLog.funcCall("getInputFormat");
319
        AvroStorageLog.funcCall("getInputFormat");
320
        InputFormat result = null;
320
        InputFormat result = null;
321
        if(inputAvroSchema != null) {
321
        if(inputAvroSchema != null) {
322
            if (useMultipleSchemas) {

   
323
                // When merging multiple avro schemas, we use embedded schemas

   
324
                // to load input files. So no input avro schema is passed.

   
325
                result = new PigAvroInputFormat(
322
            result = new PigAvroInputFormat(
326
                        null, ignoreBadFiles, schemaToMergedSchemaMap);
323
            inputAvroSchema, ignoreBadFiles, schemaToMergedSchemaMap, useMultipleSchemas);
327
            } else {

   
328
                result = new PigAvroInputFormat(

   
329
                        inputAvroSchema, ignoreBadFiles, schemaToMergedSchemaMap);

   
330
            }

   
331
        } else {
324
        } else {
332
            result = new TextInputFormat();
325
            result = new TextInputFormat();
333
        }
326
        }
334
        return result;
327
        return result;
335
    }
328
    }
[+20] [20] 398 lines
http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/AvroStorageUtils.java
Revision 1484564 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/PigAvroInputFormat.java
Revision 1484564 New Change
 
http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/PigAvroRecordReader.java
Revision 1484564 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 1484564 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/AvroStorageUtils.java: Loading...
  3. http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/PigAvroInputFormat.java: Loading...
  4. http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/storage/avro/PigAvroRecordReader.java: Loading...
  5. http://svn.apache.org/repos/asf/pig/trunk/contrib/piggybank/java/src/test/java/org/apache/pig/piggybank/test/storage/avro/TestAvroStorage.java: Loading...