Data Type

Basic Data Type

IoTDB supports the following data types:

  • BOOLEAN (Boolean)
  • INT32 (Integer)
  • INT64 (Long Integer)
  • FLOAT (Single Precision Floating Point)
  • DOUBLE (Double Precision Floating Point)
  • TEXT (String)

Float Precision

The time series of FLOAT and DOUBLE type can specify (MAX_POINT_NUMBER, see this page for more information on how to specify), which is the number of digits after the decimal point of the floating point number, if the encoding method is RLE or TS_2DIFF. If MAX_POINT_NUMBER is not specified, the system will use float_precision in the configuration file iotdb-common.properties.

  1. CREATE TIMESERIES root.vehicle.d0.s0 WITH DATATYPE=FLOAT, ENCODING=RLE, 'MAX_POINT_NUMBER'='2';
  • For Float data value, The data range is (-Integer.MAX_VALUE, Integer.MAX_VALUE), rather than Float.MAX_VALUE, and the max_point_number is 19, caused by the limition of function Math.round(float) in Java.
  • For Double data value, The data range is (-Long.MAX_VALUE, Long.MAX_VALUE), rather than Double.MAX_VALUE, and the max_point_number is 19, caused by the limition of function Math.round(double) in Java (Long.MAX_VALUE=9.22E18).

Data Type Compatibility

When the written data type is inconsistent with the data type of time-series,

  • If the data type of time-series is not compatible with the written data type, the system will give an error message.
  • If the data type of time-series is compatible with the written data type, the system will automatically convert the data type.

The compatibility of each data type is shown in the following table:

Series Data TypeSupported Written Data Types
BOOLEANBOOLEAN
INT32INT32
INT64INT32 INT64
FLOATINT32 FLOAT
DOUBLEINT32 INT64 FLOAT DOUBLE
TEXTTEXT

Timestamp

The timestamp is the time point at which data is produced. It includes absolute timestamps and relative timestamps

Absolute timestamp

Absolute timestamps in IoTDB are divided into two types: LONG and DATETIME (including DATETIME-INPUT and DATETIME-DISPLAY). When a user inputs a timestamp, he can use a LONG type timestamp or a DATETIME-INPUT type timestamp, and the supported formats of the DATETIME-INPUT type timestamp are shown in the table below:

Supported formats of DATETIME-INPUT type timestamp

Format
yyyy-MM-dd HH:mm:ss
yyyy/MM/dd HH:mm:ss
yyyy.MM.dd HH:mm:ss
yyyy-MM-dd HH:mm:ssZZ
yyyy/MM/dd HH:mm:ssZZ
yyyy.MM.dd HH:mm:ssZZ
yyyy/MM/dd HH:mm:ss.SSS
yyyy-MM-dd HH:mm:ss.SSS
yyyy.MM.dd HH:mm:ss.SSS
yyyy-MM-dd HH:mm:ss.SSSZZ
yyyy/MM/dd HH:mm:ss.SSSZZ
yyyy.MM.dd HH:mm:ss.SSSZZ
ISO8601 standard time format

IoTDB can support LONG types and DATETIME-DISPLAY types when displaying timestamps. The DATETIME-DISPLAY type can support user-defined time formats. The syntax of the custom time format is shown in the table below:

The syntax of the custom time format

SymbolMeaningPresentationExamples
Geraeraera
Ccentury of era (>=0)number20
Yyear of era (>=0)year1996
xweekyearyear1996
wweek of weekyearnumber27
eday of weeknumber2
Eday of weektextTuesday; Tue
yyearyear1996
Dday of yearnumber189
Mmonth of yearmonthJuly; Jul; 07
dday of monthnumber10
ahalfday of daytextPM
Khour of halfday (0~11)number0
hclockhour of halfday (1~12)number12
Hhour of day (0~23)number0
kclockhour of day (1~24)number24
mminute of hournumber30
ssecond of minutenumber55
Sfraction of secondmillis978
ztime zonetextPacific Standard Time; PST
Ztime zone offset/idzone-0800; -08:00; America/Los_Angeles
escape for textdelimiter
‘’single quoteliteral

Relative timestamp

Relative time refers to the time relative to the server time now() and DATETIME time.

Syntax:

  1. Duration = (Digit+ ('Y'|'MO'|'W'|'D'|'H'|'M'|'S'|'MS'|'US'|'NS'))+
  2. RelativeTime = (now() | DATETIME) ((+|-) Duration)+

The syntax of the duration unit

SymbolMeaningPresentationExamples
yyear1y=365 days1y
momonth1mo=30 days1mo
wweek1w=7 days1w
dday1d=1 day1d
hhour1h=3600 seconds1h
mminute1m=60 seconds1m
ssecond1s=1 second1s
msmillisecond1ms=1000_000 nanoseconds1ms
usmicrosecond1us=1000 nanoseconds1us
nsnanosecond1ns=1 nanosecond1ns

eg:

  1. now() - 1d2h //1 day and 2 hours earlier than the current server time
  2. now() - 1w //1 week earlier than the current server time

Note:There must be spaces on the left and right of ‘+’ and ‘-‘.