This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-doris-flink-connector.git
commit aa4013d03ca8ce014c14b2fc9da3d92ae6a769ba Author: wudi <676366...@qq.com> AuthorDate: Thu Jul 8 09:55:50 2021 +0800 [Bug][Flink] Fix when data null , flink-connector throw NullPointerException (#6165) --- .../org/apache/doris/flink/table/DorisDynamicOutputFormat.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/doris/flink/table/DorisDynamicOutputFormat.java b/src/main/java/org/apache/doris/flink/table/DorisDynamicOutputFormat.java index 4b2f5fe..33f5c85 100644 --- a/src/main/java/org/apache/doris/flink/table/DorisDynamicOutputFormat.java +++ b/src/main/java/org/apache/doris/flink/table/DorisDynamicOutputFormat.java @@ -54,6 +54,7 @@ public class DorisDynamicOutputFormat extends RichOutputFormat<RowData> { private DorisStreamLoad dorisStreamLoad; private final String fieldDelimiter = "\t"; private final String lineDelimiter = "\n"; + private final String NULL_VALUE = "\\N"; private final List<String> batch = new ArrayList<>(); private transient volatile boolean closed = false; @@ -118,7 +119,12 @@ public class DorisDynamicOutputFormat extends RichOutputFormat<RowData> { StringJoiner value = new StringJoiner(this.fieldDelimiter); GenericRowData rowData = (GenericRowData) row; for(int i = 0; i < row.getArity(); ++i) { - value.add(rowData.getField(i).toString()); + Object field = rowData.getField(i); + if(field != null){ + value.add(field.toString()); + }else{ + value.add(this.NULL_VALUE); + } } batch.add(value.toString()); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org