This is an automated email from the ASF dual-hosted git repository.
justinchen pushed a commit to branch opc-ua
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/opc-ua by this push:
new 94ef525ace0 Fix
94ef525ace0 is described below
commit 94ef525ace0bd911428c46cb4f126f316e05ea8b
Author: Caideyipi <[email protected]>
AuthorDate: Wed Dec 17 16:39:54 2025 +0800
Fix
---
.../api/customizer/parameter/PipeParameters.java | 5 ++-
.../pipe/sink/protocol/opcua/OpcUaNameSpace.java | 36 +++++++++++++++++-----
2 files changed, 32 insertions(+), 9 deletions(-)
diff --git
a/iotdb-api/pipe-api/src/main/java/org/apache/iotdb/pipe/api/customizer/parameter/PipeParameters.java
b/iotdb-api/pipe-api/src/main/java/org/apache/iotdb/pipe/api/customizer/parameter/PipeParameters.java
index 22e97bbe806..989590f40a6 100644
---
a/iotdb-api/pipe-api/src/main/java/org/apache/iotdb/pipe/api/customizer/parameter/PipeParameters.java
+++
b/iotdb-api/pipe-api/src/main/java/org/apache/iotdb/pipe/api/customizer/parameter/PipeParameters.java
@@ -384,15 +384,18 @@ public class PipeParameters {
if (key == null) {
return null;
}
- final String lowerCaseKey = key.toLowerCase();
+ String lowerCaseKey = key.toLowerCase();
for (final String prefix : FIRST_PREFIXES) {
if (lowerCaseKey.startsWith(prefix)) {
key = key.substring(prefix.length());
+ lowerCaseKey = lowerCaseKey.substring(prefix.length());
+ break;
}
}
for (final String prefix : SECOND_PREFIXES) {
if (lowerCaseKey.startsWith(prefix)) {
key = key.substring(prefix.length());
+ break;
}
}
return key;
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaNameSpace.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaNameSpace.java
index 78d776b4d1d..6850fba8f20 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaNameSpace.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/sink/protocol/opcua/OpcUaNameSpace.java
@@ -226,8 +226,13 @@ public class OpcUaNameSpace extends
ManagedNamespaceWithLifecycle {
}
final String currentFolder = currentStr.toString();
+
StatusCode currentQuality =
Objects.isNull(sink.valueName) ? StatusCode.GOOD :
StatusCode.UNCERTAIN;
+ UaVariableNode valueNode = null;
+ Object value = null;
+ long timestamp = 0;
+
for (int i = 0; i < measurementSchemas.size(); ++i) {
if (Objects.isNull(values.get(i))) {
continue;
@@ -283,15 +288,30 @@ public class OpcUaNameSpace extends
ManagedNamespaceWithLifecycle {
}
final long utcTimestamp =
timestampToUtc(timestamps.get(timestamps.size() > 1 ? i : 0));
- if (Objects.isNull(measurementNode.getValue())
- ||
Objects.requireNonNull(measurementNode.getValue().getSourceTime()).getUtcTime()
- < utcTimestamp) {
- measurementNode.setValue(
+ if (Objects.isNull(sink.valueName)) {
+ if (Objects.isNull(measurementNode.getValue())
+ ||
Objects.requireNonNull(measurementNode.getValue().getSourceTime()).getUtcTime()
+ < utcTimestamp) {
+ measurementNode.setValue(
+ new DataValue(
+ new Variant(values.get(i)),
+ currentQuality,
+ new DateTime(utcTimestamp),
+ new DateTime()));
+ }
+ } else {
+ valueNode = measurementNode;
+ value = values.get(i);
+ timestamp = utcTimestamp;
+ }
+ }
+ if (Objects.nonNull(valueNode)) {
+ if (Objects.isNull(valueNode.getValue())
+ ||
Objects.requireNonNull(valueNode.getValue().getSourceTime()).getUtcTime()
+ < timestamp) {
+ valueNode.setValue(
new DataValue(
- new Variant(values.get(i)),
- currentQuality,
- new DateTime(utcTimestamp),
- new DateTime()));
+ new Variant(value), currentQuality, new DateTime(timestamp),
new DateTime()));
}
}
}