This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to refs/heads/dev by this push:
new 55571156e1 fix(#4101): Increase precision for correction value
transformation migration (#4102)
55571156e1 is described below
commit 55571156e1215db18c5247380130320d805a6e7a
Author: Philipp Zehnder <[email protected]>
AuthorDate: Fri Jan 16 17:51:01 2026 +0100
fix(#4101): Increase precision for correction value transformation
migration (#4102)
---
.../migrations/v099/connect/AdapterRuleConverter.java | 2 +-
.../v099/MigrateAdaptersToUseScriptTest.java | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/v099/connect/AdapterRuleConverter.java
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/v099/connect/AdapterRuleConverter.java
index 193a712d1d..d964ae32ed 100644
---
a/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/v099/connect/AdapterRuleConverter.java
+++
b/streampipes-service-core/src/main/java/org/apache/streampipes/service/core/migrations/v099/connect/AdapterRuleConverter.java
@@ -130,7 +130,7 @@ public class AdapterRuleConverter {
}
var symbols = new DecimalFormatSymbols(Locale.US);
- var df = new DecimalFormat("0.###", symbols);
+ var df = new DecimalFormat("0.########################", symbols);
var formattedValue = df.format(rule.getCorrectionValue());
scriptBuilder.appendLine(String.format("event['%s'] = Number(event['%s'])
%s %s;",
diff --git
a/streampipes-service-core/src/test/java/org/apache/streampipes/service/core/migrations/v099/MigrateAdaptersToUseScriptTest.java
b/streampipes-service-core/src/test/java/org/apache/streampipes/service/core/migrations/v099/MigrateAdaptersToUseScriptTest.java
index b12978ec67..4d816d9432 100644
---
a/streampipes-service-core/src/test/java/org/apache/streampipes/service/core/migrations/v099/MigrateAdaptersToUseScriptTest.java
+++
b/streampipes-service-core/src/test/java/org/apache/streampipes/service/core/migrations/v099/MigrateAdaptersToUseScriptTest.java
@@ -189,6 +189,24 @@ class MigrateAdaptersToUseScriptTest {
assertTrue(adapter.getTransformationConfig().isScriptActive());
}
+ @Test
+ void executeMigration_TransformsCorrectionValueRuleWithVerySmallNumber()
throws IOException {
+ CorrectionValueTransformationRuleDescription rule = new
CorrectionValueTransformationRuleDescription();
+ rule.setRuntimeKey("temperature");
+ rule.setOperator("MULTIPLY");
+ rule.setCorrectionValue(0.000000000000000000001);
+
+ var adapter = createBaseAdapter(rule);
+ when(mockStorage.findAll()).thenReturn(List.of(adapter));
+
+ migration.executeMigration();
+
+ var script = adapter.getTransformationConfig().getScript();
+ assertTrue(script.contains("event['temperature'] =
Number(event['temperature']) * 0.000000000000000000001"));
+ assertTrue(adapter.getTransformationConfig().isScriptActive());
+ }
+
+
@Test
void executeMigration_TransformsRegexRule() throws IOException {
RegexTransformationRuleDescription rule = new
RegexTransformationRuleDescription();