bieli / IoText-data-protocol

Internet of Things data protocol - simplistic text and CSV-friendly IoT data protocol. Options: Schema-less, schema+versioning, building deltas for data values. Easy to re-use.
Apache License 2.0
0 stars 2 forks source link

Decimal format in schema definition in IoText data protocol need precision #4

Open bieli opened 1 year ago

bieli commented 1 year ago

We need to define in schema, what will be destination precision of metrics values, in case of DECIMAL type metrics like d:12.345. In Python, there is a Decimal object and context global state, when we define prec value - here is the spec.

This something easy to implement with one two-digit value (max. 28), but in other languages, we can define two values (precision and scale in BigDecimal class) e.g. in Java language it's like this spec.

Another example, from the data engineering world is definition for AVRO schema in Kafka ecosystem. We can express Decimals in schema definition like in Java lang. e.g.

{
  "type": "bytes",
  "logicalType": "decimal",
  "precision": 4,
  "scale": 2
}

We are open to proposals here.