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

haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new f82390a7343 Add a judgment in order to avoid occur NPE when one value 
of measurementSchemas is null (#15574)
f82390a7343 is described below

commit f82390a7343e3aeaccfb61e33cbe68059ed12f24
Author: libo <[email protected]>
AuthorDate: Mon May 26 11:31:24 2025 +0800

    Add a judgment in order to avoid occur NPE when one value of 
measurementSchemas is null (#15574)
---
 .../iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java      | 4 ++++
 .../relational/metadata/fetcher/cache/TreeDeviceNormalSchema.java     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java
index 2f78b092744..ed34f0de310 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/resource/memory/InsertNodeMemoryEstimator.java
@@ -669,6 +669,10 @@ public class InsertNodeMemoryEstimator {
         RamUsageEstimator.alignObjectSize(
             NUM_BYTES_ARRAY_HEADER + NUM_BYTES_OBJECT_REF * values.length);
     for (int i = 0; i < values.length; i++) {
+      if (measurementSchemas[i] == null || measurementSchemas[i].getType() == 
null) {
+        size += NUM_BYTES_OBJECT_HEADER;
+        continue;
+      }
       switch (measurementSchemas[i].getType()) {
         case INT64:
         case TIMESTAMP:
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceNormalSchema.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceNormalSchema.java
index 9b44b7feead..8651e8199e5 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceNormalSchema.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/relational/metadata/fetcher/cache/TreeDeviceNormalSchema.java
@@ -63,7 +63,7 @@ public class TreeDeviceNormalSchema implements IDeviceSchema {
 
     for (int i = 0; i < length; ++i) {
       // Skip this to avoid instance creation/gc for writing performance
-      if (measurementMap.containsKey(measurements[i])) {
+      if (measurements[i] == null || 
measurementMap.containsKey(measurements[i])) {
         continue;
       }
       diff += putEntry(measurements[i], schemas[i], null);

Reply via email to