Help Center/ Data Ingestion Service/ FAQs/ Dump Questions/ How Does a Schema Support Default Fields or NULL Fields?
Updated on 2024-10-25 GMT+08:00

How Does a Schema Support Default Fields or NULL Fields?

A source data schema is a user's JSON data sample used to describe the JSON data format. DIS can generate the Avro schema based on the JSON data sample. By default, the default field or NULL is not supported, as shown in Figure 1.

Figure 1 Example of not supporting the default field

The type of the key1 field is String (type: string in Avro Schema). If the key1 field in the source data is not transferred or the transferred value is null, the dump task reports an error.

To enable the schema generated based on the JSON data sample supports the default value or null, select the Convert and Move and click Convert Source Data Sample, as shown in Figure 2.

Figure 2 Example of supporting the default field

In this case, the type of the key1 field is Union (type: [null, string] in Avro Schema). If the key1 field in the source data is not transferred or the transferred value is null, null is automatically filled as the default value. The dump task can properly convert the format.