public class StructuredRecordDatumWriter extends Object implements DatumWriter<co.cask.cdap.api.data.format.StructuredRecord>
| Constructor and Description |
|---|
StructuredRecordDatumWriter() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
encode(Encoder encoder,
co.cask.cdap.api.data.schema.Schema schema,
Object value)
Encodes a value based on a
Schema |
void |
encode(co.cask.cdap.api.data.format.StructuredRecord data,
Encoder encoder) |
protected void |
encodeArrayBegin(Encoder encoder,
co.cask.cdap.api.data.schema.Schema elementSchema,
int size)
Encodes the beginning of an array.
|
protected void |
encodeArrayElement(Encoder encoder,
co.cask.cdap.api.data.schema.Schema elementSchema,
Object element)
Encodes an element of an array.
|
protected void |
encodeArrayEnd(Encoder encoder,
co.cask.cdap.api.data.schema.Schema elementSchema,
int size)
Encodes the ending of an array.
|
protected void |
encodeEnum(Encoder encoder,
co.cask.cdap.api.data.schema.Schema enumSchema,
Object value)
Encodes a enum value.
|
protected void |
encodeMapBegin(Encoder encoder,
co.cask.cdap.api.data.schema.Schema keySchema,
co.cask.cdap.api.data.schema.Schema valueSchema,
int size)
Encodes the beginning of a
Map. |
protected void |
encodeMapEnd(Encoder encoder,
co.cask.cdap.api.data.schema.Schema keySchema,
co.cask.cdap.api.data.schema.Schema valueSchema,
int size)
Encodes the ending of a
Map. |
protected void |
encodeMapEntry(Encoder encoder,
co.cask.cdap.api.data.schema.Schema keySchema,
co.cask.cdap.api.data.schema.Schema valueSchema,
Map.Entry<?,?> entry)
Encodes a map entry.
|
protected void |
encodeRecordBegin(Encoder encoder,
co.cask.cdap.api.data.schema.Schema schema)
Encodes the beginning of record.
|
protected void |
encodeRecordEnd(Encoder encoder,
co.cask.cdap.api.data.schema.Schema schema)
Encodes the ending of record.
|
protected void |
encodeRecordField(Encoder encoder,
co.cask.cdap.api.data.schema.Schema.Field field,
Object value)
Encodes a record field.
|
protected void |
encodeUnion(Encoder encoder,
co.cask.cdap.api.data.schema.Schema schema,
int matchingIdx,
Object value)
Encodes a union value.
|
public void encode(co.cask.cdap.api.data.format.StructuredRecord data, Encoder encoder) throws IOException
encode in interface DatumWriter<co.cask.cdap.api.data.format.StructuredRecord>IOExceptionprotected final void encode(Encoder encoder, co.cask.cdap.api.data.schema.Schema schema, Object value) throws IOException
Schemaencoder - the encoder to useschema - the Schema of the valuevalue - the value to encodeIOException - If failed to encodeprotected void encodeEnum(Encoder encoder, co.cask.cdap.api.data.schema.Schema enumSchema, Object value) throws IOException
encoder - The encoder to useenumSchema - The Schema for the enum fieldvalue - The enum valueIOException - If failed to encodeprotected void encodeArrayBegin(Encoder encoder, co.cask.cdap.api.data.schema.Schema elementSchema, int size) throws IOException
encoder - The encoder to useelementSchema - The Schema of the array elementsize - Number of array elementsIOException - If failed to encodeprotected void encodeArrayElement(Encoder encoder, co.cask.cdap.api.data.schema.Schema elementSchema, Object element) throws IOException
encode(Encoder, Schema, Object) method with the element schema.encoder - The encoder to useelementSchema - The Schema of the array elementelement - the value to encodeIOException - If failed to encodeprotected void encodeArrayEnd(Encoder encoder, co.cask.cdap.api.data.schema.Schema elementSchema, int size) throws IOException
0 to signal the end of the array.
Sub-class can override this to have different behaviorencoder - The encoder to useelementSchema - The Schema of the array elementsize - Number of array elementsIOException - If failed to encodeprotected void encodeMapBegin(Encoder encoder, co.cask.cdap.api.data.schema.Schema keySchema, co.cask.cdap.api.data.schema.Schema valueSchema, int size) throws IOException
Map. This method will write out the size of the map.
Sub-class can override this to have different behavior.encoder - The encoder to usekeySchema - The Schema of the map keyvalueSchema - The Schema of the map valuesize - size of the mapIOException - If failed to encodeprotected void encodeMapEntry(Encoder encoder, co.cask.cdap.api.data.schema.Schema keySchema, co.cask.cdap.api.data.schema.Schema valueSchema, Map.Entry<?,?> entry) throws IOException
encode(Encoder, Schema, Object) method.
Sub-class can override this to have different behavior.encoder - The encoder to usekeySchema - The Schema of the map keyvalueSchema - The Schema of the map valueentry - the map entry to encodeIOException - If failed to encodeprotected void encodeMapEnd(Encoder encoder, co.cask.cdap.api.data.schema.Schema keySchema, co.cask.cdap.api.data.schema.Schema valueSchema, int size) throws IOException
Map. This method writes out 0 to signal the end of the map.
Sub-class can override this to have different behavior.encoder - The encoder to usekeySchema - The Schema of the map keyvalueSchema - The Schema of the map valuesize - size of the mapIOException - If failed to encodeprotected void encodeRecordBegin(Encoder encoder, co.cask.cdap.api.data.schema.Schema schema) throws IOException
encoder - The encoder to useschema - The Schema of the recordIOException - If failed to encodeprotected void encodeRecordField(Encoder encoder, co.cask.cdap.api.data.schema.Schema.Field field, Object value) throws IOException
encode(Encoder, Schema, Object) method.
Sub-class can override this to have different behavior.encoder - The encoder to usefield - The Schema.Field to encodevalue - the field value to encodeIOException - If failed to encodeprotected void encodeRecordEnd(Encoder encoder, co.cask.cdap.api.data.schema.Schema schema) throws IOException
encoder - The encoder to useschema - The Schema of the recordIOException - If failed to encodeprotected void encodeUnion(Encoder encoder, co.cask.cdap.api.data.schema.Schema schema, int matchingIdx, Object value) throws IOException
encoder - The encoder to useschema - The union schemamatchingIdx - The index in the union schema that matches the data typevalue - The value to encodeIOException - If failed to encodeCopyright © 2018 Cask Data, Inc. Licensed under the Apache License, Version 2.0.