public class JsonStructuredRecordDatumReader extends StructuredRecordDatumReader
StructuredRecordDatumReader that decodes from Json.| Constructor and Description |
|---|
JsonStructuredRecordDatumReader()
Constructor that treats field names case sensitive.
|
JsonStructuredRecordDatumReader(boolean fieldNameIgnoreCase)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected Collection<?> |
decodeArray(Decoder decoder,
co.cask.cdap.api.data.schema.Schema elementSchema)
Decodes an array with array element of a given
Schema. |
protected String |
decodeEnum(Decoder decoder,
co.cask.cdap.api.data.schema.Schema schema)
Decodes a enum value based on the given
Schema. |
protected Map<?,?> |
decodeMap(Decoder decoder,
co.cask.cdap.api.data.schema.Schema keySchema,
co.cask.cdap.api.data.schema.Schema valueSchema)
Decodes a map.
|
protected co.cask.cdap.api.data.format.StructuredRecord |
decodeRecord(Decoder decoder,
co.cask.cdap.api.data.schema.Schema schema)
Decodes a record.
|
protected Object |
decodeUnion(Decoder decoder,
co.cask.cdap.api.data.schema.Schema unionSchema)
Decodes a value from a union.
|
co.cask.cdap.api.data.format.StructuredRecord |
read(Decoder decoder,
co.cask.cdap.api.data.schema.Schema sourceSchema) |
decodepublic JsonStructuredRecordDatumReader()
public JsonStructuredRecordDatumReader(boolean fieldNameIgnoreCase)
fieldNameIgnoreCase - true to have case sensitive field names.public co.cask.cdap.api.data.format.StructuredRecord read(Decoder decoder, co.cask.cdap.api.data.schema.Schema sourceSchema) throws IOException
read in interface DatumReader<co.cask.cdap.api.data.format.StructuredRecord>read in class StructuredRecordDatumReaderIOExceptionprotected String decodeEnum(Decoder decoder, co.cask.cdap.api.data.schema.Schema schema) throws IOException
StructuredRecordDatumReaderSchema. This method reads an integer as the index in the
enum schema.
Sub-class can override this to have different behavior.decodeEnum in class StructuredRecordDatumReaderdecoder - The decode to decode value fromschema - The Schema of the enumString representation of the enum valueIOException - If failed to decodeprotected Collection<?> decodeArray(Decoder decoder, co.cask.cdap.api.data.schema.Schema elementSchema) throws IOException
StructuredRecordDatumReaderSchema. This method reads an integer as the size of
a chunk, followed by reading that many array element using the element schema, following by reading the size
of the next chunk, until it reads 0.
Sub-class can override this to have different behavior.decodeArray in class StructuredRecordDatumReaderdecoder - The decode to decode value fromelementSchema - The Schema of the array elementsCollection containing all array elementsIOException - If failed to decodeprotected Map<?,?> decodeMap(Decoder decoder, co.cask.cdap.api.data.schema.Schema keySchema, co.cask.cdap.api.data.schema.Schema valueSchema) throws IOException
StructuredRecordDatumReader0.
Sub-class can override this to have different behavior.decodeMap in class StructuredRecordDatumReaderdecoder - The decode to decode value fromkeySchema - The Schema of the map keyvalueSchema - The Schema of the map valueMap containing all map entriesIOException - If failed to decodeprotected co.cask.cdap.api.data.format.StructuredRecord decodeRecord(Decoder decoder, co.cask.cdap.api.data.schema.Schema schema) throws IOException
StructuredRecordDatumReaderdecodeRecord in class StructuredRecordDatumReaderdecoder - The decode to decode value fromschema - The Schema of the recordStructuredRecord representing the record decodedIOException - If failed to decodeprotected Object decodeUnion(Decoder decoder, co.cask.cdap.api.data.schema.Schema unionSchema) throws IOException
StructuredRecordDatumReaderdecodeUnion in class StructuredRecordDatumReaderdecoder - The decode to decode value fromunionSchema - The Schema of the unionIOException - If failed to decodeCopyright © 2018 Cask Data, Inc. Licensed under the Apache License, Version 2.0.