[ https://issues.apache.org/jira/browse/FLINK-19912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17224679#comment-17224679 ]
hailong wang commented on FLINK-19912: -------------------------------------- When MapData key is null, This may cause some error, 1. We use `keyArray.getString(i).toString()` to get the key, If the key is null, the result is empty but not null, maybe we can add a condition `keyArray.isNullAt(i)` or use `keyGetter.getElementOrNull(keyArray, i)`. 2. If we add the null key to objectNode, `mapper.writeValueAsBytes(node)` will throw NPE after converting RowData to ObjectNode, {code:java} Caused by: java.lang.NullPointerException at org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.json.WriterBasedJsonGenerator._writeString(WriterBasedJsonGenerator.java:905) at org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.json.WriterBasedJsonGenerator._writeFieldName(WriterBasedJsonGenerator.java:146) at org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.json.WriterBasedJsonGenerator.writeFieldName(WriterBasedJsonGenerator.java:111) at org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.node.ObjectNode.serialize(ObjectNode.java:287) at org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.SerializableSerializer.serialize(SerializableSerializer.java:49) at org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.std.SerializableSerializer.serialize(SerializableSerializer.java:27) at org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:130) ... 3 more {code} According to the above, I think there maybe have two things to do. 1. Fix the error result when mapData key is null in MapConverter. 2. Add an option to skip errors like above or some other errors in serialization , just like 'ignoreParseErrors', eg, ignoreSerializationErrors. > Support ignoreParseErrors option for json serializationSchema > -------------------------------------------------------------- > > Key: FLINK-19912 > URL: https://issues.apache.org/jira/browse/FLINK-19912 > Project: Flink > Issue Type: Improvement > Components: Formats (JSON, Avro, Parquet, ORC, SequenceFile) > Affects Versions: 1.12.0 > Reporter: hailong wang > Priority: Major > Fix For: 1.12.0 > > > Support ignoreParseErrors to skip error when serializing `RowData` in json > serializationSchema. -- This message was sent by Atlassian Jira (v8.3.4#803005)