muyangye commented on code in PR #2196:
URL: https://github.com/apache/streampipes/pull/2196#discussion_r1403095559


##########
streampipes-data-explorer-commons/src/main/java/org/apache/streampipes/dataexplorer/commons/influx/InfluxStore.java:
##########
@@ -218,6 +226,21 @@ private void handleMeasurementProperty(Point.Builder p,
     }
   }
 
+  private void handleNonPrimitiveMeasurementProperty(Point.Builder p, Event 
event, String preparedRuntimeName) {
+    var field = event.getRaw().get(preparedRuntimeName);
+    ObjectMapper mapper = new ObjectMapper();
+    try {
+      String json = mapper.writeValueAsString(field);
+      p.addField(preparedRuntimeName, json);
+      // Deserialize in this way, tested the primitive types can be correctly 
deducted from Object
+//      TypeFactory typeFactory = mapper.getTypeFactory();

Review Comment:
   I agree, probably we should refactor the serialization/deserialization logic 
into a class called `FieldSerializer` that extends from `Serializer` in 
`client/serializer/` and overwrites the `deserialize` method which returns a 
`Map<String, Object>`. Then, any code that uses the returned value will judge 
based on runtime type.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to