You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2026/03/24 20:32:06 UTC
(streampipes) branch fix-influx-precision created (now ef53159c85)
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a change to branch fix-influx-precision
in repository https://gitbox.apache.org/repos/asf/streampipes.git
at ef53159c85 fix: Properly parse float64 values before writing to db
This branch includes the following new commits:
new ef53159c85 fix: Properly parse float64 values before writing to db
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(streampipes) 01/01: fix: Properly parse float64 values before writing to db
Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch fix-influx-precision
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit ef53159c85f13ff0d6c83670548f386a6de8243e
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Tue Mar 24 21:31:46 2026 +0100
fix: Properly parse float64 values before writing to db
---
.../dataexplorer/influx/PropertyHandler.java | 3 ++-
.../influx/TimeSeriesStorageInfluxTest.java | 19 +++++++++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/streampipes-data-explorer-influx/src/main/java/org/apache/streampipes/dataexplorer/influx/PropertyHandler.java b/streampipes-data-explorer-influx/src/main/java/org/apache/streampipes/dataexplorer/influx/PropertyHandler.java
index a19c7d9ed8..388f9cedee 100644
--- a/streampipes-data-explorer-influx/src/main/java/org/apache/streampipes/dataexplorer/influx/PropertyHandler.java
+++ b/streampipes-data-explorer-influx/src/main/java/org/apache/streampipes/dataexplorer/influx/PropertyHandler.java
@@ -167,7 +167,8 @@ public class PropertyHandler {
String sanitizedRuntimeName,
PrimitiveField eventPropertyPrimitiveField
) {
- p.addField(sanitizedRuntimeName, eventPropertyPrimitiveField.getAsFloat());
+ // Influx stores floating point values as float64. Parsing as float32 first truncates precision.
+ p.addField(sanitizedRuntimeName, eventPropertyPrimitiveField.getAsDouble());
}
private void handleLongProperty(
diff --git a/streampipes-data-explorer-influx/src/test/java/org/apache/streampipes/dataexplorer/influx/TimeSeriesStorageInfluxTest.java b/streampipes-data-explorer-influx/src/test/java/org/apache/streampipes/dataexplorer/influx/TimeSeriesStorageInfluxTest.java
index d8e95bb1b0..9874f081c8 100644
--- a/streampipes-data-explorer-influx/src/test/java/org/apache/streampipes/dataexplorer/influx/TimeSeriesStorageInfluxTest.java
+++ b/streampipes-data-explorer-influx/src/test/java/org/apache/streampipes/dataexplorer/influx/TimeSeriesStorageInfluxTest.java
@@ -92,7 +92,7 @@ public class TimeSeriesStorageInfluxTest {
@Test
public void onEventWithIntegerFloatValue() {
var expected = getPointBuilderWithTimestamp()
- .addField(FIELD_NAME, 1.0f)
+ .addField(FIELD_NAME, 1.0)
.build();
var actualPoint = testEventWithOneField(XSD.INTEGER, 1.0f);
@@ -114,7 +114,7 @@ public class TimeSeriesStorageInfluxTest {
@Test
public void onEventWithLongFloatValue() {
var expected = getPointBuilderWithTimestamp()
- .addField(FIELD_NAME, 1.0f)
+ .addField(FIELD_NAME, 1.0)
.build();
var actualPoint = testEventWithOneField(XSD.LONG, 1.0f);
@@ -125,7 +125,7 @@ public class TimeSeriesStorageInfluxTest {
@Test
public void onEventWithFloat() {
var expected = getPointBuilderWithTimestamp()
- .addField(FIELD_NAME, 1.0f)
+ .addField(FIELD_NAME, 1.0)
.build();
var actualPoint = testEventWithOneField(XSD.FLOAT, 1.0f);
@@ -133,6 +133,17 @@ public class TimeSeriesStorageInfluxTest {
assertEquals(expected, actualPoint);
}
+ @Test
+ public void onEventWithFloatKeepsDecimalPrecision() {
+ var expected = getPointBuilderWithTimestamp()
+ .addField(FIELD_NAME, 1.03)
+ .build();
+
+ var actualPoint = testEventWithOneField(XSD.FLOAT, 1.03);
+
+ assertEquals(expected, actualPoint);
+ }
+
@Test
public void onEventWithDouble() {
var expected = getPointBuilderWithTimestamp()
@@ -390,4 +401,4 @@ public class TimeSeriesStorageInfluxTest {
return new TimeSeriesStorageInflux(measure, null, influxClientProviderMock);
}
-}
\ No newline at end of file
+}