@PublicEvolving public class JsonRowDeserializationSchema extends Object implements org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.types.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(org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> typeInfo)
Creates a JSON deserialization schema for the given type information.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.flink.types.Row |
deserialize(byte[] message) |
org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> |
getProducedType() |
boolean |
isEndOfStream(org.apache.flink.types.Row nextElement) |
void |
setFailOnMissingField(boolean failOnMissingField)
Configures the failure behaviour if a JSON field is missing.
|
public JsonRowDeserializationSchema(org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.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 org.apache.flink.types.Row deserialize(byte[] message)
throws IOException
deserialize in interface org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.types.Row>IOExceptionpublic boolean isEndOfStream(org.apache.flink.types.Row nextElement)
isEndOfStream in interface org.apache.flink.api.common.serialization.DeserializationSchema<org.apache.flink.types.Row>public org.apache.flink.api.common.typeinfo.TypeInformation<org.apache.flink.types.Row> getProducedType()
getProducedType in interface org.apache.flink.api.java.typeutils.ResultTypeQueryable<org.apache.flink.types.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–2018 The Apache Software Foundation. All rights reserved.