influxdb-cxx icon indicating copy to clipboard operation
influxdb-cxx copied to clipboard

Avoid rounding of double fields

Open maxim-levy opened this issue 4 years ago • 2 comments

Adding a Point with a double field which has more than 6 digits results in the value being rounded, due to the default rounding precision, see here. This behavior might lead to field type conflicts in the InfluxDb. These happen if the rounded value was the first one inserted into the measurement. In this case the database decides that the type for the specific value is integer, and inserting doubles into that field is not possible anymore, the following error shows up:

write failed: field type conflict: input field "value" on measurement "temp" is type float, already exists as type integer

maxim-levy avatar Mar 31 '20 01:03 maxim-levy

Hi, Which version of InfluxDB are you using? Influx Line Protocol uses https://github.com/awegrzyn/influxdb-cxx/issues/65 i to mark integers and nothing for floats/doubles I can't see how you could end up with such? Could you provide steps to reproduce it?

awegrzyn avatar Apr 03 '20 16:04 awegrzyn

Related with this question, I have included precision management for floating point numbers at branch support_create_db Test and functionality added at this commit could help you.

jmsanchezff avatar Jun 12 '20 09:06 jmsanchezff