Storing null values in avro files

前端 未结 2 1084
无人及你
无人及你 2021-02-14 05:06

I have some json data that looks like this:

  {
    \"id\": 1998983092,
    \"name\": \"Test Name 1\",
    \"type\": \"search string\",
    \"creationDate\": \"2         


        
2条回答
  •  Happy的楠姐
    2021-02-14 05:29

    I have this issue too and now resolved it.

    I found @Nullable annotation in Apache Avro to declare the field is nullable.

    So, in this example, we should

    import org.apache.avro.reflect.Nullable;
    
    public class MyAvroRecord {
        long id;
        String name;
        String type;
        Date timestamp;
        Date lastModifcationDate;
        String lastModifiedUsername;
        @Nullable
        Boolean lockedQuery;
    }
    

提交回复
热议问题