@PublicEvolving public class JsonRowDeserializationSchema extends Object implements DeserializationSchema<Row>
Deserializes a byte[]
message as a JSON object and reads
the specified fields.
Failure during deserialization are forwarded as wrapped IOExceptions.
Constructor and Description |
---|
JsonRowDeserializationSchema(String jsonSchema)
Creates a JSON deserialization schema for the given JSON schema.
|
JsonRowDeserializationSchema(TypeInformation<Row> typeInfo)
Creates a JSON deserialization schema for the given type information.
|
Modifier and Type | Method and Description |
---|---|
Row |
deserialize(byte[] message)
Deserializes the byte message.
|
boolean |
equals(Object o) |
TypeInformation<Row> |
getProducedType()
Gets the data type (as a
TypeInformation ) produced by this function or input format. |
int |
hashCode() |
boolean |
isEndOfStream(Row nextElement)
Method to decide whether the element signals the end of the stream.
|
void |
setFailOnMissingField(boolean failOnMissingField)
Configures the failure behaviour if a JSON field is missing.
|
public JsonRowDeserializationSchema(TypeInformation<Row> typeInfo)
typeInfo
- Type information describing the result type. The field names of Row
are used to parse the JSON properties.public JsonRowDeserializationSchema(String jsonSchema)
jsonSchema
- JSON schema describing the result typepublic Row deserialize(byte[] message) throws IOException
DeserializationSchema
deserialize
in interface DeserializationSchema<Row>
message
- The message, as a byte array.IOException
public boolean isEndOfStream(Row nextElement)
DeserializationSchema
isEndOfStream
in interface DeserializationSchema<Row>
nextElement
- The element to test for the end-of-stream signal.public TypeInformation<Row> getProducedType()
ResultTypeQueryable
TypeInformation
) produced by this function or input format.getProducedType
in interface ResultTypeQueryable<Row>
public void setFailOnMissingField(boolean failOnMissingField)
By default, a missing field is ignored and the field is set to null.
failOnMissingField
- Flag indicating whether to fail or not on a missing field.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.