This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch branch-1.5
in repository https://gitbox.apache.org/repos/asf/inlong.git

commit b2a2a2301e1f49d236abb3c06b8babb1491e741d
Author: Xin Gong <[email protected]>
AuthorDate: Tue Jan 17 21:34:08 2023 +0800

    [INLONG-7252][Sort] Fix Doris connector throw NPE when DATE type data is 
null (#7259)
---
 .../inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java
 
b/inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java
index efa04a630..91f3c67b3 100644
--- 
a/inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java
+++ 
b/inlong-sort/sort-connectors/doris/src/main/java/org/apache/inlong/sort/doris/table/DorisDynamicSchemaOutputFormat.java
@@ -254,7 +254,12 @@ public class DorisDynamicSchemaOutputFormat<T> extends 
RichOutputFormat<T> {
                 fieldGetters[i] = RowData.createFieldGetter(logicalTypes[i], 
i);
                 if ("DATE".equalsIgnoreCase(logicalTypes[i].toString())) {
                     int finalI = i;
-                    fieldGetters[i] = row -> 
DorisParseUtils.epochToDate(row.getInt(finalI));
+                    fieldGetters[i] = row -> {
+                        if (row.isNullAt(finalI)) {
+                            return null;
+                        }
+                        return DorisParseUtils.epochToDate(row.getInt(finalI));
+                    };
                 }
             }
         }

Reply via email to