public class Json extends FormatDescriptor
Constructor and Description |
---|
Json()
Format descriptor for JSON.
|
Modifier and Type | Method and Description |
---|---|
Json |
deriveSchema()
Deprecated.
Derivation format schema from table's schema is the default behavior now.
So there is no need to explicitly declare to derive schema.
|
Json |
failOnMissingField(boolean failOnMissingField)
Sets flag whether to fail if a field is missing or not.
|
Json |
jsonSchema(String jsonSchema)
Sets the JSON schema string with field names and the types according to the JSON schema
specification [[http://json-schema.org/specification.html]].
|
Json |
schema(TypeInformation<Row> schemaType)
Sets the schema using type information.
|
protected Map<String,String> |
toFormatProperties()
Converts this descriptor into a set of format properties.
|
toProperties
toString
public Json failOnMissingField(boolean failOnMissingField)
failOnMissingField
- If set to true, the operation fails if there is a missing field.
If set to false, a missing field is set to null.public Json jsonSchema(String jsonSchema)
The schema might be nested.
jsonSchema
- JSON schemapublic Json schema(TypeInformation<Row> schemaType)
JSON objects are represented as ROW types.
The schema might be nested.
schemaType
- type information that describes the schema@Deprecated public Json deriveSchema()
This allows for defining schema information only once.
The names, types, and fields' order of the format are determined by the table's schema. Time attributes are ignored if their origin is not a field. A "from" definition is interpreted as a field renaming in the format.
protected Map<String,String> toFormatProperties()
FormatDescriptor
FormatDescriptorValidator.FORMAT
.toFormatProperties
in class FormatDescriptor
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.