Hi, > In Java we could model it as a variable Optional<> x which could be null, Optional.empty(), Optional.of(true), Optional.of(false).
It make sense. And, using a new data type to achieve in IoTDB it is ok. > Or scale formulas like a*x+b which allows to leverage the precision even for “small” double values or even integers. So, are you considering a use case like: the time series value should be [1, 1, 0, 0, 1, 1, 1, 0, 0...] but actually we get [0.99, 0.99, 0.01, 0, 1, 1, 0.999, 0, 0.01] (because of the precision of sensors)? And, what values do you want to save? (1)save them as 1 and 0. Or, (2) save them as 0.99, 0.01 indeed, but using a specific query API to return data like 1 and 0? My another question is, is there a general data type can support the above cases? Best, ----------------------------------- Xiangdong Huang School of Software, Tsinghua University 黄向东 清华大学 软件学院 Julian Feinauer <[email protected]> 于2019年10月29日周二 上午3:58写道: > Hi all, > > I wanted to discuss a possible new feature I will call Rich Datatypes > (RDT) API in the following. > I worked a lot in the automotive industry and there is a broadly adopted > open Standard called ASAM MDF (https://www.asam.net/standards/detail/mdf/ > ). > It is a format which is targeted at the efficient storage but at the same > time it supports VERY complex types (which are often used in automotive > controllers). > > Take something as simple as a boolean. We could store it as a boolean (as > java bool) in 1 bit. > BUT we have overall 4 possibilities: > > * No value is available for a timestamp (NULL / nothing stored) > * We had a successful request but the Controller does not know whether > true or false (or had an internal error), this is a bit like > Optional.isPresent() == false > * True > * False > In Java we could model it as a variable Optional<> x which could be null, > Optional.empty(), Optional.of(true), Optional.of(false). > > Other examples are discrete values like “ON”, “OFF” (which are handled as > “lookup tables” on integer rows, internally). > Or scale formulas like a*x+b which allows to leverage the precision even > for “small” double values or even integers. > A formula but also a “fallback” lookup value like “NV”. > > I think this could be a valuable extension to IoTDB as an additional API > (not change anything below but just provide an API on top to do the > calculation). > > What do others think? > > Julian >
