Table of Contents |
---|
时间序列
一元时间序列
多元时间序列
...
可以 aligned
3、“设备”
// 创建时间序列语句创建一元时间序列的完整语句(v0.12及之前) create timeseries root.turbine.d1.s2(temperature2) with datatype=FLOAT, encoding=RLE, compression=SNAPPY, tags(tag1=v1, tag2=v2), attributes(attr1=v1, attr2=v2) // 创建语句(新语法,后续修改)v0.13之后,创建语句的新语法,示例: create timeseries root.sg.d3.s1 FLOAT [encoding=RLE] [compression=SNAPPY] [tags(tag1=v1, tag2=v2)] [attributes(attr1=v1, attr2=v2)] create timeseries root.sg.d3.s2 FLOAT [encoding=RLE] [compression=SNAPPY] [tags(tag1=v1, tag2=v2)] [attributes(attr1=v1, attr2=v2)]
// 插入语句 insert into root.sg.d3(time, s1) values(1,1)
insert into root.sg.d3(time, s1, s2) values(1,1,2)
//
...
注意:多元的时间序列的压缩方式必须相同
...
create
...
[aligned]
...
timeseries
...
root.sg1.d1.电表(s1
...
FLOAT,
...
s2
...
INT32)
...
//
...
可以指定多元时间序列各物理量的编码(encoding)和压缩方式(compression)
...
//
...
但是暂不支持指定别名(alias),props,
...
attributes,
...
tags
...
等
...
create
...
[aligned]
...
timeseries
...
root.sg1.d1.b (
...
s3
...
FLOAT
...
[encoding=RLE
...
] ,
...
s4
...
INT32
...
[encoding=Grollia]
...
[compression=SNAPPY/GZIP/LZ4/UNCOMPRESSED]
...
)
...
[compression=SNAPPY
...
]
小括号内未制定compression的列,则采用系统默认配置;
小括号外的compression定义时间列压缩方式和未显式声明的列的压缩方式。
// 插入语句
insert into root.sg.d1(time, b(s1, s2)) values(1,(1,2))
可以扩充一元或多元物理量
可以扩充
create timeseries root.sg1.d1.c FLOAT
...
// 创建语句 create [aligned] timeseries root.sg.d1.(s1 FLOAT, s2 INT32) // 插入语句 insert into root.sg.d1(time, d1(s1, s2)) values(1, (1,2))
不能
// 创建语句 create [aligned] timeseries root.sg.d3.陀螺仪(s1 FLOAT, s2 INT32) create [aligned] timeseries root.sg.d3.GPS(s3 FLOAT, s4 INT32) // 插入语句 insert into root.sg.d3(time, 陀螺仪(s1, s2), GPS(s3, s4)) values(1, (1, 2),(3,4)) insert into root.sg.d3(time, 陀螺仪(s1, s2)) values(1, (1, 2)) // 查询语句 select s1,s2 from root.sg.d3.陀螺仪 select * from root.sg.d3.陀螺仪 select 陀螺仪.* from root.sg.d3 select 陀螺仪.s1 from root.sg.d3 select d3.* from root.ssg
可以扩充
...
List<IMeasurementSchema>
...
schemaList
...
=
...
new
...
ArrayList<>();
...
schemaList.add(
...
new
...
VectorMeasurementSchema(
...
new
...
String[]
...
{"s1",
...
"s2"},
...
new
...
TSDataType[]
...
{TSDataType.INT64,
...
TSDataType.INT32}));
...
Tablet
...
tablet
...
=
...
new
...
Tablet("root.sg1.d1.GPS",
...
schemaList);
Tablet支持某列的某一行是null?(单元、多元保持统一)