Java Code Examples for org.apache.avro.io.Decoder#readIndex()

The following examples show how to use org.apache.avro.io.Decoder#readIndex() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Map_of_UNION_GenericDeserializer_2087096002965517991_2087096002965517991.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == mapValueOptionSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(mapValueOptionSchema0);
    }
    int unionIndex1 = (decoder.readIndex());
    if (unionIndex1 == 0) {
        decoder.readNull();
    }
    if (unionIndex1 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 2
Source File: recordName_GenericDeserializer_6897301803194779359_6897301803194779359.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecordName0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord recordName;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == readerSchema)) {
        recordName = ((IndexedRecord)(reuse));
    } else {
        recordName = new org.apache.avro.generic.GenericData.Record(readerSchema);
    }
    if (recordName.get(0) instanceof Utf8) {
        recordName.put(0, (decoder).readString(((Utf8) recordName.get(0))));
    } else {
        recordName.put(0, (decoder).readString(null));
    }
    int unionIndex0 = (decoder.readIndex());
    if (unionIndex0 == 0) {
        decoder.readNull();
    }
    if (unionIndex0 == 1) {
        recordName.put(1, deserializerecordName0(recordName.get(1), (decoder)));
    }
    return recordName;
}
 
Example 3
Source File: Map_of_record_GenericDeserializer_2141121767969292399_2141121767969292399.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == mapMapValueSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(mapMapValueSchema0);
    }
    int unionIndex0 = (decoder.readIndex());
    if (unionIndex0 == 0) {
        decoder.readNull();
    }
    if (unionIndex0 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 4
Source File: Map_of_UNION_GenericDeserializer_2087096002965517991_2087096002965517991.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == mapValueOptionSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(mapValueOptionSchema0);
    }
    int unionIndex1 = (decoder.readIndex());
    if (unionIndex1 == 0) {
        decoder.readNull();
    }
    if (unionIndex1 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 5
Source File: Array_of_record_GenericDeserializer_1629046702287533603_1629046702287533603.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == arrayArrayElemSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(arrayArrayElemSchema0);
    }
    int unionIndex0 = (decoder.readIndex());
    if (unionIndex0 == 0) {
        decoder.readNull();
    }
    if (unionIndex0 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 6
Source File: Array_of_UNION_GenericDeserializer_585074122056792963_585074122056792963.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == arrayElemOptionSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(arrayElemOptionSchema0);
    }
    int unionIndex1 = (decoder.readIndex());
    if (unionIndex1 == 0) {
        decoder.readNull();
    }
    if (unionIndex1 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 7
Source File: recordName_GenericDeserializer_6897301803194779359_6897301803194779359.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecordName0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord recordName;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == readerSchema)) {
        recordName = ((IndexedRecord)(reuse));
    } else {
        recordName = new org.apache.avro.generic.GenericData.Record(readerSchema);
    }
    if (recordName.get(0) instanceof Utf8) {
        recordName.put(0, (decoder).readString(((Utf8) recordName.get(0))));
    } else {
        recordName.put(0, (decoder).readString(null));
    }
    int unionIndex0 = (decoder.readIndex());
    if (unionIndex0 == 0) {
        decoder.readNull();
    }
    if (unionIndex0 == 1) {
        recordName.put(1, deserializerecordName0(recordName.get(1), (decoder)));
    }
    return recordName;
}
 
Example 8
Source File: Map_of_record_GenericDeserializer_2141121767969292399_2141121767969292399.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == mapMapValueSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(mapMapValueSchema0);
    }
    int unionIndex0 = (decoder.readIndex());
    if (unionIndex0 == 0) {
        decoder.readNull();
    }
    if (unionIndex0 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 9
Source File: Array_of_record_GenericDeserializer_1629046702287533603_1629046702287533603.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == arrayArrayElemSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(arrayArrayElemSchema0);
    }
    int unionIndex0 = (decoder.readIndex());
    if (unionIndex0 == 0) {
        decoder.readNull();
    }
    if (unionIndex0 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 10
Source File: Array_of_UNION_GenericDeserializer_585074122056792963_585074122056792963.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == arrayElemOptionSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(arrayElemOptionSchema0);
    }
    int unionIndex1 = (decoder.readIndex());
    if (unionIndex1 == 0) {
        decoder.readNull();
    }
    if (unionIndex1 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 11
Source File: recordName_GenericDeserializer_6897301803194779359_6897301803194779359.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecordName0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord recordName;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == readerSchema)) {
        recordName = ((IndexedRecord)(reuse));
    } else {
        recordName = new org.apache.avro.generic.GenericData.Record(readerSchema);
    }
    if (recordName.get(0) instanceof Utf8) {
        recordName.put(0, (decoder).readString(((Utf8) recordName.get(0))));
    } else {
        recordName.put(0, (decoder).readString(null));
    }
    int unionIndex0 = (decoder.readIndex());
    if (unionIndex0 == 0) {
        decoder.readNull();
    }
    if (unionIndex0 == 1) {
        recordName.put(1, deserializerecordName0(recordName.get(1), (decoder)));
    }
    return recordName;
}
 
Example 12
Source File: Map_of_record_GenericDeserializer_2141121767969292399_2141121767969292399.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == mapMapValueSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(mapMapValueSchema0);
    }
    int unionIndex0 = (decoder.readIndex());
    if (unionIndex0 == 0) {
        decoder.readNull();
    }
    if (unionIndex0 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 13
Source File: Map_of_UNION_GenericDeserializer_2087096002965517991_2087096002965517991.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == mapValueOptionSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(mapValueOptionSchema0);
    }
    int unionIndex1 = (decoder.readIndex());
    if (unionIndex1 == 0) {
        decoder.readNull();
    }
    if (unionIndex1 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 14
Source File: Array_of_record_GenericDeserializer_1629046702287533603_1629046702287533603.java    From avro-util with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public IndexedRecord deserializerecord0(Object reuse, Decoder decoder)
    throws IOException
{
    IndexedRecord record;
    if ((((reuse)!= null)&&((reuse) instanceof IndexedRecord))&&(((IndexedRecord)(reuse)).getSchema() == arrayArrayElemSchema0)) {
        record = ((IndexedRecord)(reuse));
    } else {
        record = new org.apache.avro.generic.GenericData.Record(arrayArrayElemSchema0);
    }
    int unionIndex0 = (decoder.readIndex());
    if (unionIndex0 == 0) {
        decoder.readNull();
    }
    if (unionIndex0 == 1) {
        if (record.get(0) instanceof Utf8) {
            record.put(0, (decoder).readString(((Utf8) record.get(0))));
        } else {
            record.put(0, (decoder).readString(null));
        }
    }
    return record;
}
 
Example 15
Source File: Map_of_UNION_GenericDeserializer_2087096002965517991_2087096002965517991.java    From avro-util with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Map<Utf8, IndexedRecord> deserialize(Map<Utf8, IndexedRecord> reuse, Decoder decoder)
    throws IOException
{
    Map<Utf8, IndexedRecord> map0 = null;
    long chunkLen0 = (decoder.readMapStart());
    if (chunkLen0 > 0) {
        Map<Utf8, IndexedRecord> mapReuse0 = null;
        if ((reuse) instanceof Map) {
            mapReuse0 = ((Map)(reuse));
        }
        if (mapReuse0 != (null)) {
            mapReuse0 .clear();
            map0 = mapReuse0;
        } else {
            map0 = new HashMap<Utf8, IndexedRecord>();
        }
        do {
            for (int counter0 = 0; (counter0 <chunkLen0); counter0 ++) {
                Utf8 key0 = (decoder.readString(null));
                int unionIndex0 = (decoder.readIndex());
                if (unionIndex0 == 0) {
                    decoder.readNull();
                }
                if (unionIndex0 == 1) {
                    map0 .put(key0, deserializerecord0(null, (decoder)));
                }
            }
            chunkLen0 = (decoder.mapNext());
        } while (chunkLen0 > 0);
    } else {
        map0 = Collections.emptyMap();
    }
    return map0;
}
 
Example 16
Source File: Array_of_UNION_GenericDeserializer_585074122056792963_585074122056792963.java    From avro-util with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public List<IndexedRecord> deserialize(List<IndexedRecord> reuse, Decoder decoder)
    throws IOException
{
    List<IndexedRecord> array0 = null;
    long chunkLen0 = (decoder.readArrayStart());
    if (chunkLen0 > 0) {
        if ((reuse) instanceof List) {
            array0 = ((List)(reuse));
            array0 .clear();
        } else {
            array0 = new org.apache.avro.generic.GenericData.Array<IndexedRecord>(((int) chunkLen0), readerSchema);
        }
        do {
            for (int counter0 = 0; (counter0 <chunkLen0); counter0 ++) {
                Object arrayArrayElementReuseVar0 = null;
                if ((reuse) instanceof GenericArray) {
                    arrayArrayElementReuseVar0 = ((GenericArray)(reuse)).peek();
                }
                int unionIndex0 = (decoder.readIndex());
                if (unionIndex0 == 0) {
                    decoder.readNull();
                }
                if (unionIndex0 == 1) {
                    array0 .add(deserializerecord0(arrayArrayElementReuseVar0, (decoder)));
                }
            }
            chunkLen0 = (decoder.arrayNext());
        } while (chunkLen0 > 0);
    } else {
        array0 = new org.apache.avro.generic.GenericData.Array<IndexedRecord>(((int) chunkLen0), readerSchema);
    }
    return array0;
}
 
Example 17
Source File: Array_of_UNION_GenericDeserializer_585074122056792963_585074122056792963.java    From avro-util with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public List<IndexedRecord> deserialize(List<IndexedRecord> reuse, Decoder decoder)
    throws IOException
{
    List<IndexedRecord> array0 = null;
    long chunkLen0 = (decoder.readArrayStart());
    if (chunkLen0 > 0) {
        if ((reuse) instanceof List) {
            array0 = ((List)(reuse));
            array0 .clear();
        } else {
            array0 = new org.apache.avro.generic.GenericData.Array<IndexedRecord>(((int) chunkLen0), readerSchema);
        }
        do {
            for (int counter0 = 0; (counter0 <chunkLen0); counter0 ++) {
                Object arrayArrayElementReuseVar0 = null;
                if ((reuse) instanceof GenericArray) {
                    arrayArrayElementReuseVar0 = ((GenericArray)(reuse)).peek();
                }
                int unionIndex0 = (decoder.readIndex());
                if (unionIndex0 == 0) {
                    decoder.readNull();
                }
                if (unionIndex0 == 1) {
                    array0 .add(deserializerecord0(arrayArrayElementReuseVar0, (decoder)));
                }
            }
            chunkLen0 = (decoder.arrayNext());
        } while (chunkLen0 > 0);
    } else {
        array0 = new org.apache.avro.generic.GenericData.Array<IndexedRecord>(((int) chunkLen0), readerSchema);
    }
    return array0;
}
 
Example 18
Source File: Map_of_UNION_GenericDeserializer_2087096002965517991_2087096002965517991.java    From avro-util with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Map<Utf8, IndexedRecord> deserialize(Map<Utf8, IndexedRecord> reuse, Decoder decoder)
    throws IOException
{
    Map<Utf8, IndexedRecord> map0 = null;
    long chunkLen0 = (decoder.readMapStart());
    if (chunkLen0 > 0) {
        Map<Utf8, IndexedRecord> mapReuse0 = null;
        if ((reuse) instanceof Map) {
            mapReuse0 = ((Map)(reuse));
        }
        if (mapReuse0 != (null)) {
            mapReuse0 .clear();
            map0 = mapReuse0;
        } else {
            map0 = new HashMap<Utf8, IndexedRecord>();
        }
        do {
            for (int counter0 = 0; (counter0 <chunkLen0); counter0 ++) {
                Utf8 key0 = (decoder.readString(null));
                int unionIndex0 = (decoder.readIndex());
                if (unionIndex0 == 0) {
                    decoder.readNull();
                }
                if (unionIndex0 == 1) {
                    map0 .put(key0, deserializerecord0(null, (decoder)));
                }
            }
            chunkLen0 = (decoder.mapNext());
        } while (chunkLen0 > 0);
    } else {
        map0 = Collections.emptyMap();
    }
    return map0;
}
 
Example 19
Source File: Map_of_UNION_GenericDeserializer_2087096002965517991_2087096002965517991.java    From avro-util with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public Map<Utf8, IndexedRecord> deserialize(Map<Utf8, IndexedRecord> reuse, Decoder decoder)
    throws IOException
{
    Map<Utf8, IndexedRecord> map0 = null;
    long chunkLen0 = (decoder.readMapStart());
    if (chunkLen0 > 0) {
        Map<Utf8, IndexedRecord> mapReuse0 = null;
        if ((reuse) instanceof Map) {
            mapReuse0 = ((Map)(reuse));
        }
        if (mapReuse0 != (null)) {
            mapReuse0 .clear();
            map0 = mapReuse0;
        } else {
            map0 = new HashMap<Utf8, IndexedRecord>();
        }
        do {
            for (int counter0 = 0; (counter0 <chunkLen0); counter0 ++) {
                Utf8 key0 = (decoder.readString(null));
                int unionIndex0 = (decoder.readIndex());
                if (unionIndex0 == 0) {
                    decoder.readNull();
                }
                if (unionIndex0 == 1) {
                    map0 .put(key0, deserializerecord0(null, (decoder)));
                }
            }
            chunkLen0 = (decoder.mapNext());
        } while (chunkLen0 > 0);
    } else {
        map0 = Collections.emptyMap();
    }
    return map0;
}
 
Example 20
Source File: ValueReaders.java    From iceberg with Apache License 2.0 4 votes vote down vote up
@Override
public Object read(Decoder decoder, Object reuse) throws IOException {
  int index = decoder.readIndex();
  return readers[index].read(decoder, reuse);
}