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

rong 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 f66fcd91642 Pipe: Fixed the NPE of OPC UA Sink in table model when 
there are null values & Deleted the extra folder of opc ua sink in table model 
(#15215)
f66fcd91642 is described below

commit f66fcd91642396e146484990e92e70dbe48e6dff
Author: Caideyipi <[email protected]>
AuthorDate: Thu Mar 27 21:44:42 2025 +0800

    Pipe: Fixed the NPE of OPC UA Sink in table model when there are null 
values & Deleted the extra folder of opc ua sink in table model (#15215)
---
 .../db/pipe/connector/protocol/opcua/OpcUaNameSpace.java      | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcua/OpcUaNameSpace.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcua/OpcUaNameSpace.java
index acb759df111..41f8a20e587 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcua/OpcUaNameSpace.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/opcua/OpcUaNameSpace.java
@@ -149,7 +149,7 @@ public class OpcUaNameSpace extends 
ManagedNamespaceWithLifecycle {
 
       for (int i = 0; i < tablet.getRowSize(); ++i) {
         final Object[] segments = tablet.getDeviceID(i).getSegments();
-        final String[] folderSegments = new String[segments.length + 2];
+        final String[] folderSegments = new String[segments.length + 1];
         folderSegments[0] = databaseName;
 
         for (int j = 0; j < segments.length; ++j) {
@@ -164,8 +164,10 @@ public class OpcUaNameSpace extends 
ManagedNamespaceWithLifecycle {
             columnIndexes.stream()
                 .map(
                     index ->
-                        getTabletObjectValue4Opc(
-                            tablet.getValues()[index], finalI, 
schemas.get(index).getType()))
+                        tablet.isNull(finalI, index)
+                            ? null
+                            : getTabletObjectValue4Opc(
+                                tablet.getValues()[index], finalI, 
schemas.get(index).getType()))
                 .collect(Collectors.toList()));
       }
     }
@@ -228,6 +230,9 @@ public class OpcUaNameSpace extends 
ManagedNamespaceWithLifecycle {
 
     final String currentFolder = currentStr.toString();
     for (int i = 0; i < measurementSchemas.size(); ++i) {
+      if (Objects.isNull(values.get(i))) {
+        continue;
+      }
       final String name = measurementSchemas.get(i).getMeasurementName();
       final TSDataType type = measurementSchemas.get(i).getType();
       final NodeId nodeId = newNodeId(currentFolder + name);

Reply via email to