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

rong pushed a commit to branch rel/1.2
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/1.2 by this push:
     new 23e889c0ff0 [To rel/1.2][ISSUE-11199] Pipe: fix NPE when casting from 
null values in InsertRowNode deserialization (#11200) (#11205)
23e889c0ff0 is described below

commit 23e889c0ff0d45184144e2ba9196cf9af0178df0
Author: V_Galaxy <[email protected]>
AuthorDate: Mon Sep 25 02:00:37 2023 +0800

    [To rel/1.2][ISSUE-11199] Pipe: fix NPE when casting from null values in 
InsertRowNode deserialization (#11200) (#11205)
    
    * fix: allow casting from null when deserializing InsertRowNode
---
 .../src/main/java/org/apache/iotdb/db/utils/CommonUtils.java       | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
index de6d3cec39f..caed7e9178e 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/CommonUtils.java
@@ -38,6 +38,7 @@ import org.apache.commons.lang3.StringUtils;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.Objects;
 
 @SuppressWarnings("java:S106") // for console outputs
 public class CommonUtils {
@@ -110,6 +111,9 @@ public class CommonUtils {
   }
 
   public static boolean checkCanCastType(TSDataType src, TSDataType dest) {
+    if (Objects.isNull(src)) {
+      return true;
+    }
     switch (src) {
       case INT32:
         if (dest == TSDataType.INT64 || dest == TSDataType.FLOAT || dest == 
TSDataType.DOUBLE) {
@@ -128,6 +132,9 @@ public class CommonUtils {
   }
 
   public static Object castValue(TSDataType srcDataType, TSDataType 
destDataType, Object value) {
+    if (Objects.isNull(value)) {
+      return null;
+    }
     switch (srcDataType) {
       case INT32:
         if (destDataType == TSDataType.INT64) {

Reply via email to