使用Apache IoTDB进行IoT相关开发的架构设计与功能实现(12)

简介: 现在到了使用Apache IoTDB进行IoT相关开发的架构设计与功能实现的最后一个环境,在本文中我将向大家介绍IoTDB的查询语言。IoTDB为咱们广大开发者提供了类似SQL的查询语言,用于与IoTDB进行交互,查询语言可以分为4个主要部分:架构语句、数据管理语句、数据库管理语句、功能。

现在到了使用Apache IoTDB进行IoT相关开发的架构设计与功能实现的最后一个环境,在本文中我将向大家介绍IoTDB的查询语言。IoTDB为咱们广大开发者提供了类似SQL的查询语言,用于与IoTDB进行交互,查询语言可以分为4个主要部分:

  • 架构语句:本节中列出了有关架构管理的语句。
  • 数据管理语句:本节中列出了有关数据管理的语句(如:数据插入、数据查询等)。
  • 数据库管理语句:本节中列出了有关数据库管理和身份验证的语句。
  • 功能:IoTDB提供的功能均在本节中列出。

关键字

请不要使用这些关键字作为标识符。

  1. CREATE, INSERT, UPDATE, DELETE, SELECT, SHOW, GRANT, INTO, SET, WHERE, FROM, TO, BY, DEVICE,
  2. CONFIGURATION, DESCRIBE, SLIMIT, LIMIT, UNLINK, OFFSET, SOFFSET, FILL, LINEAR, PREVIOUS, PREVIOUSUNTILLAST,
  3. METADATA, TIMESERIES, TIMESTAMP, PROPERTY, WITH, ROOT, DATATYPE, COMPRESSOR, STORAGE, GROUP, LABEL,INT32,
  4. INT64, FLOAT, DOUBLE, BOOLEAN, TEXT, ENCODING, PLAIN, PLAIN_DICTIONARY, RLE, DIFF, TS_2DIFF, GORILLA, REGULAR,
  5. BITMAP, ADD, UPSERT, VALUES, NOW, LINK, INDEX, USING, ON, DROP, MERGE, LIST, USER, PRIVILEGES, ROLE, ALL, OF,
  6. ALTER, PASSWORD, REVOKE, LOAD, WATERMARK_EMBEDDING, UNSET, TTL, FLUSH, TASK, INFO, DYNAMIC, PARAMETER, VERSION,
  7. REMOVE, MOVE, CHILD, PATHS, DEVICES, COUNT, NODES, LEVEL, MIN_TIME, MAX_TIME, MIN_VALUE, MAX_VALUE, AVG, FIRST_VALUE,
  8. SUM, LAST_VALUE, LAST, DISABLE, ALIGN, COMPRESSION, TIME, ATTRIBUTES, TAGS,RENAME, FULL, CLEAR, CACHE

显示版本

  1. show version
  2. +---------------+
  3. | version|
  4. +---------------+
  5. |0.10.0-SNAPSHOT|
  6. +---------------+
  7. Total line number = 1
  8. It costs 0.417s

架构语句

  • 设置存储组
  1. SET STORAGE GROUP TO <FullPath>
  2. Eg: IoTDB > SET STORAGE GROUP TO root.ln.wf01.wt01
  3. Note: FullPath can not include `*`
  • 删除存储组
  1. DELETE STORAGE GROUP <FullPath> [COMMA <FullPath>]*
  2. Eg: IoTDB > DELETE STORAGE GROUP root.ln.wf01.wt01
  3. Eg: IoTDB > DELETE STORAGE GROUP root.ln.wf01.wt01, root.ln.wf01.wt02
  4. Note: FullPath can not include `*`
  • 创建时间序列语句
  1. CREATE TIMESERIES <FullPath> WITH <AttributeClauses>
  2. alias
  3. : LR_BRACKET ID RR_BRACKET
  4. ;
  5. attributeClauses
  6. : DATATYPE OPERATOR_EQ dataType COMMA ENCODING OPERATOR_EQ encoding
  7. (COMMA (COMPRESSOR | COMPRESSION) OPERATOR_EQ compressor=propertyValue)?
  8. (COMMA property)*
  9. tagClause
  10. attributeClause
  11. ;
  12. attributeClause
  13. : (ATTRIBUTES LR_BRACKET property (COMMA property)* RR_BRACKET)?
  14. ;
  15. tagClause
  16. : (TAGS LR_BRACKET property (COMMA property)* RR_BRACKET)?
  17. ;
  18. DataTypeValue: BOOLEAN | DOUBLE | FLOAT | INT32 | INT64 | TEXT
  19. EncodingValue: GORILLA | PLAIN | RLE | TS_2DIFF | REGULAR
  20. CompressorValue: UNCOMPRESSED | SNAPPY
  21. Eg: CREATE TIMESERIES root.ln.wf01.wt01.status WITH DATATYPE=BOOLEAN, ENCODING=PLAIN
  22. Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE
  23. Eg: CREATE TIMESERIES root.ln.wf01.wt01.temperature WITH DATATYPE=FLOAT, ENCODING=RLE, COMPRESSOR=SNAPPY, MAX_POINT_NUMBER=3
  24. Eg: create timeseries root.turbine.d0.s0(temperature) with datatype=FLOAT, encoding=RLE, compression=SNAPPY tags(unit=f, description='turbine this is a test1') attributes(H_Alarm=100, M_Alarm=50)
  25. Note: Datatype and encoding type must be corresponding. Please check Chapter 3 Encoding Section for details.
  • 删除时间序列语句
  1. DELETE TIMESERIES <PrefixPath> [COMMA <PrefixPath>]*
  2. Eg: IoTDB > DELETE TIMESERIES root.ln.wf01.wt01.status
  3. Eg: IoTDB > DELETE TIMESERIES root.ln.wf01.wt01.status, root.ln.wf01.wt01.temperature
  4. Eg: IoTDB > DELETE TIMESERIES root.ln.wf01.wt01.*
  • 更改时间序列语句
  1. ALTER TIMESERIES fullPath alterClause
  2. alterClause
  3. : RENAME beforeName=ID TO currentName=ID
  4. | SET property (COMMA property)*
  5. | DROP ID (COMMA ID)*
  6. | ADD TAGS property (COMMA property)*
  7. | ADD ATTRIBUTES property (COMMA property)*
  8. | UPSERT tagClause attributeClause
  9. ;
  10. attributeClause
  11. : (ATTRIBUTES LR_BRACKET property (COMMA property)* RR_BRACKET)?
  12. ;
  13. tagClause
  14. : (TAGS LR_BRACKET property (COMMA property)* RR_BRACKET)?
  15. ;
  16. Eg: ALTER timeseries root.turbine.d1.s1 RENAME tag1 TO newTag1
  17. Eg: ALTER timeseries root.turbine.d1.s1 SET tag1=newV1, attr1=newV1
  18. Eg: ALTER timeseries root.turbine.d1.s1 DROP tag1, tag2
  19. Eg: ALTER timeseries root.turbine.d1.s1 ADD TAGS tag3=v3, tag4=v4
  20. Eg: ALTER timeseries root.turbine.d1.s1 ADD ATTRIBUTES attr3=v3, attr4=v4
  21. EG: ALTER timeseries root.turbine.d1.s1 UPSERT TAGS(tag2=newV2, tag3=v3) ATTRIBUTES(attr3=v3, attr4=v4)
  • 显示所有时间序列语句
  1. SHOW TIMESERIES
  2. Eg: IoTDB > SHOW TIMESERIES
  3. Note: This statement can only be used in IoTDB Client. If you need to show all timeseries in JDBC, please use `DataBaseMetadata` interface.
  • 显示特定时间序列语句
  1. SHOW TIMESERIES <Path>
  2. Eg: IoTDB > SHOW TIMESERIES root
  3. Eg: IoTDB > SHOW TIMESERIES root.ln
  4. Eg: IoTDB > SHOW TIMESERIES root.ln.*.*.status
  5. Eg: IoTDB > SHOW TIMESERIES root.ln.wf01.wt01.status
  6. Note: The path can be prefix path, star path or timeseries path
  7. Note: This statement can be used in IoTDB Client and JDBC.
  • 显示带有 where 子句的特定时间序列语句
  1. SHOW TIMESERIES prefixPath? showWhereClause?
  2. showWhereClause
  3. : WHERE (property | containsExpression)
  4. ;
  5. containsExpression
  6. : name=ID OPERATOR_CONTAINS value=propertyValue
  7. ;
  8. Eg: show timeseries root.ln where unit='c'
  9. Eg: show timeseries root.ln where description contains 'test1'
  • 显示特定时间序列语句,其中子句从偏移量开始并限制结果总数
  1. SHOW TIMESERIES prefixPath? showWhereClause? limitClause?
  2. showWhereClause
  3. : WHERE (property | containsExpression)
  4. ;
  5. containsExpression
  6. : name=ID OPERATOR_CONTAINS value=propertyValue
  7. ;
  8. limitClause
  9. : LIMIT INT offsetClause?
  10. | offsetClause? LIMIT INT
  11. ;
  12. Eg: show timeseries root.ln where unit='c'
  13. Eg: show timeseries root.ln where description contains 'test1'
  14. Eg: show timeseries root.ln where unit='c' limit 10 offset 10
  • 显示存储组声明
  1. SHOW STORAGE GROUP
  2. Eg: IoTDB > SHOW STORAGE GROUP
  3. Note: This statement can be used in IoTDB Client and JDBC.
  • 计数时间序列语句
  1. COUNT TIMESERIES <Path>
  2. Eg: IoTDB > COUNT TIMESERIES root
  3. Eg: IoTDB > COUNT TIMESERIES root.ln
  4. Eg: IoTDB > COUNT TIMESERIES root.ln.*.*.status
  5. Eg: IoTDB > COUNT TIMESERIES root.ln.wf01.wt01.status
  6. Note: The path can be prefix path, star path or timeseries path.
  7. Note: This statement can be used in IoTDB Client and JDBC.
  8. COUNT TIMESERIES <Path> GROUP BY LEVEL=<INTEGER>
  9. Eg: IoTDB > COUNT TIMESERIES root GROUP BY LEVEL=1
  10. Eg: IoTDB > COUNT TIMESERIES root.ln GROUP BY LEVEL=2
  11. Eg: IoTDB > COUNT TIMESERIES root.ln.wf01 GROUP BY LEVEL=3
  12. Note: The path can be prefix path or timeseries path.
  13. Note: This statement can be used in IoTDB Client and JDBC.
  • 计数节点声明
  1. COUNT NODES <Path> LEVEL=<INTEGER>
  2. Eg: IoTDB > COUNT NODES root LEVEL=2
  3. Eg: IoTDB > COUNT NODES root.ln LEVEL=2
  4. Eg: IoTDB > COUNT NODES root.ln.wf01 LEVEL=3
  5. Note: The path can be prefix path or timeseries path.
  6. Note: This statement can be used in IoTDB Client and JDBC.
  • 显示所有设备声明
  1. SHOW Devices
  2. Eg: IoTDB > SHOW Devices
  3. Note: This statement can be used in IoTDB Client and JDBC.
  • 显示特定设备声明
  1. SHOW DEVICES <PrefixPath>
  2. Eg: IoTDB > SHOW DEVICES root
  3. Eg: IoTDB > SHOW DEVICES root.ln
  4. Eg: IoTDB > SHOW DEVICES root.*.wf01
  5. Note: The path can be prefix path or star path.
  6. Note: This statement can be used in IoTDB Client and JDBC.
  • 显示根语句的子路径
  1. SHOW CHILD PATHS
  2. Eg: IoTDB > SHOW CHILD PATHS
  3. Note: This statement can be used in IoTDB Client and JDBC.
  • 显示子路径声明
  1. SHOW CHILD PATHS <Path>
  2. Eg: IoTDB > SHOW CHILD PATHS root
  3. Eg: IoTDB > SHOW CHILD PATHS root.ln
  4. Eg: IoTDB > SHOW CHILD PATHS root.*.wf01
  5. Eg: IoTDB > SHOW CHILD PATHS root.ln.wf*
  6. Note: The path can be prefix path or star path, the nodes can be in a "prefix + star" format.
  7. Note: This statement can be used in IoTDB Client and JDBC.

数据管理声明

  • 插入记录语句
  1. INSERT INTO <PrefixPath> LPAREN TIMESTAMP COMMA <Sensor> [COMMA <Sensor>]* RPAREN VALUES LPAREN <TimeValue>, <PointValue> [COMMA <PointValue>]* RPAREN
  2. Sensor : Identifier
  3. Eg: IoTDB > INSERT INTO root.ln.wf01.wt01(timestamp,status) values(1509465600000,true)
  4. Eg: IoTDB > INSERT INTO root.ln.wf01.wt01(timestamp,status) VALUES(NOW(), false)
  5. Eg: IoTDB > INSERT INTO root.ln.wf01.wt01(timestamp,temperature) VALUES(2017-11-01T00:17:00.000+08:00,24.22028)
  6. Eg: IoTDB > INSERT INTO root.ln.wf01.wt01(timestamp, status, temperature) VALUES (1509466680000, false, 20.060787);
  7. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  8. Note: The order of Sensor and PointValue need one-to-one correspondence
  • 更新记录声明
  1. UPDATE <UpdateClause> SET <SetClause> WHERE <WhereClause>
  2. UpdateClause: <prefixPath>
  3. SetClause: <SetExpression>
  4. SetExpression: <Path> EQUAL <PointValue>
  5. WhereClause : <Condition> [(AND | OR) <Condition>]*
  6. Condition : <Expression> [(AND | OR) <Expression>]*
  7. Expression : [NOT | !]? TIME PrecedenceEqualOperator <TimeValue>
  8. Eg: IoTDB > UPDATE root.ln.wf01.wt01 SET temperature = 23 WHERE time < NOW() and time > 2017-11-1T00:15:00+08:00
  9. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  • 删除记录语句
  1. DELETE FROM <PrefixPath> [COMMA <PrefixPath>]* WHERE TIME LESSTHAN <TimeValue>
  2. Eg: DELETE FROM root.ln.wf01.wt01.temperature WHERE time < 2017-11-1T00:05:00+08:00
  3. Eg: DELETE FROM root.ln.wf01.wt01.status, root.ln.wf01.wt01.temperature WHERE time < NOW()
  4. Eg: DELETE FROM root.ln.wf01.wt01.* WHERE time < 1509466140000
  • 选择记录语句
  1. SELECT <SelectClause> FROM <FromClause> [WHERE <WhereClause>]?
  2. SelectClause : <SelectPath> (COMMA <SelectPath>)*
  3. SelectPath : <FUNCTION> LPAREN <Path> RPAREN | <Path>
  4. FUNCTION : COUNT , MIN_TIME’, MAX_TIME’, MIN_VALUE’, MAX_VALUE
  5. FromClause : <PrefixPath> (COMMA <PrefixPath>)?
  6. WhereClause : <Condition> [(AND | OR) <Condition>]*
  7. Condition : <Expression> [(AND | OR) <Expression>]*
  8. Expression : [NOT | !]? <TimeExpr> | [NOT | !]? <SensorExpr>
  9. TimeExpr : TIME PrecedenceEqualOperator (<TimeValue> | <RelativeTime>)
  10. RelativeTimeDurationUnit = Integer ('Y'|'MO'|'W'|'D'|'H'|'M'|'S'|'MS'|'US'|'NS')
  11. RelativeTime : (now() | <TimeValue>) [(+|-) RelativeTimeDurationUnit]+
  12. SensorExpr : (<Timeseries> | <Path>) PrecedenceEqualOperator <PointValue>
  13. Eg: IoTDB > SELECT status, temperature FROM root.ln.wf01.wt01 WHERE temperature < 24 and time > 2017-11-1 0:13:00
  14. Eg. IoTDB > SELECT * FROM root
  15. Eg. IoTDB > SELECT * FROM root where time > now() - 5m
  16. Eg. IoTDB > SELECT * FROM root.ln.*.wf*
  17. Eg. IoTDB > SELECT COUNT(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 25
  18. Eg. IoTDB > SELECT MIN_TIME(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 25
  19. Eg. IoTDB > SELECT MAX_TIME(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature > 24
  20. Eg. IoTDB > SELECT MIN_VALUE(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature > 23
  21. Eg. IoTDB > SELECT MAX_VALUE(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 25
  22. Note: the statement needs to satisfy this constraint: <Path>(SelectClause) + <PrefixPath>(FromClause) = <Timeseries>
  23. Note: If the <SensorExpr>(WhereClause) is started with <Path> and not with ROOT, the statement needs to satisfy this constraint: <PrefixPath>(FromClause) + <Path>(SensorExpr) = <Timeseries>
  24. Note: In Version 0.7.0, if <WhereClause> includes `OR`, time filter can not be used.
  25. Note: There must be a space on both sides of the plus and minus operator appearing in the time expression
  • 分组依据语句
  1. SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause> GROUP BY <GroupByClause>
  2. SelectClause : <Function> [COMMA < Function >]*
  3. Function : <AggregationFunction> LPAREN <Path> RPAREN
  4. FromClause : <PrefixPath>
  5. WhereClause : <Condition> [(AND | OR) <Condition>]*
  6. Condition : <Expression> [(AND | OR) <Expression>]*
  7. Expression : [NOT | !]? <TimeExpr> | [NOT | !]? <SensorExpr>
  8. TimeExpr : TIME PrecedenceEqualOperator (<TimeValue> | <RelativeTime>)
  9. RelativeTimeDurationUnit = Integer ('Y'|'MO'|'W'|'D'|'H'|'M'|'S'|'MS'|'US'|'NS')
  10. RelativeTime : (now() | <TimeValue>) [(+|-) RelativeTimeDurationUnit]+
  11. SensorExpr : (<Timeseries> | <Path>) PrecedenceEqualOperator <PointValue>
  12. GroupByClause : LPAREN <TimeInterval> COMMA <TimeUnit> (COMMA <TimeUnit>)? RPAREN
  13. TimeInterval: LSBRACKET <TimeValue> COMMA <TimeValue> RRBRACKET | LRBRACKET <TimeValue> COMMA <TimeValue> RSBRACKET
  14. TimeUnit : Integer <DurationUnit>
  15. DurationUnit : "ms" | "s" | "m" | "h" | "d" | "w"
  16. Eg: SELECT COUNT(status), COUNT(temperature) FROM root.ln.wf01.wt01 where temperature < 24 GROUP BY([1509465720000, 1509466380000), 5m)
  17. Eg: SELECT COUNT(status), COUNT(temperature) FROM root.ln.wf01.wt01 where temperature < 24 GROUP BY((1509465720000, 1509466380000], 5m)
  18. Eg. SELECT COUNT (status), MAX_VALUE(temperature) FROM root.ln.wf01.wt01 WHERE time < 1509466500000 GROUP BY([1509465720000, 1509466380000), 5m, 10m)
  19. Eg. SELECT MIN_TIME(status), MIN_VALUE(temperature) FROM root.ln.wf01.wt01 WHERE temperature < 25 GROUP BY ([1509466140000, 1509466380000), 3m, 5ms)
  20. Eg. SELECT MIN_TIME(status), MIN_VALUE(temperature) FROM root.ln.wf01.wt01 WHERE temperature < 25 GROUP BY ((1509466140000, 1509466380000], 3m, 5ms)
  21. Note: the statement needs to satisfy this constraint: <Path>(SelectClause) + <PrefixPath>(FromClause) = <Timeseries>
  22. Note: If the <SensorExpr>(WhereClause) is started with <Path> and not with ROOT, the statement needs to satisfy this constraint: <PrefixPath>(FromClause) + <Path>(SensorExpr) = <Timeseries>
  23. Note: <TimeValue>(TimeInterval) needs to be greater than 0
  24. Note: First <TimeValue>(TimeInterval) in needs to be smaller than second <TimeValue>(TimeInterval)
  25. Note: <TimeUnit> needs to be greater than 0
  26. Note: Third <TimeUnit> if set shouldn't be smaller than second <TimeUnit>
  • 填写声明
  1. SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause> FILL <FillClause>
  2. SelectClause : <Path> [COMMA <Path>]*
  3. FromClause : < PrefixPath > [COMMA < PrefixPath >]*
  4. WhereClause : <WhereExpression>
  5. WhereExpression : TIME EQUAL <TimeValue>
  6. FillClause : LPAREN <TypeClause> [COMMA <TypeClause>]* RPAREN
  7. TypeClause : <Int32Clause> | <Int64Clause> | <FloatClause> | <DoubleClause> | <BoolClause> | <TextClause>
  8. Int32Clause: INT32 LBRACKET (<LinearClause> | <PreviousClause>) RBRACKET
  9. Int64Clause: INT64 LBRACKET (<LinearClause> | <PreviousClause>) RBRACKET
  10. FloatClause: FLOAT LBRACKET (<LinearClause> | <PreviousClause>) RBRACKET
  11. DoubleClause: DOUBLE LBRACKET (<LinearClause> | <PreviousClause>) RBRACKET
  12. BoolClause: BOOLEAN LBRACKET (<LinearClause> | <PreviousClause>) RBRACKET
  13. TextClause: TEXT LBRACKET (<LinearClause> | <PreviousClause>) RBRACKET
  14. PreviousClause : PREVIOUS [COMMA <ValidPreviousTime>]?
  15. LinearClause : LINEAR [COMMA <ValidPreviousTime> COMMA <ValidBehindTime>]?
  16. ValidPreviousTime, ValidBehindTime: <TimeUnit>
  17. TimeUnit : Integer <DurationUnit>
  18. DurationUnit : "ms" | "s" | "m" | "h" | "d" | "w"
  19. Eg: SELECT temperature FROM root.ln.wf01.wt01 WHERE time = 2017-11-01T16:37:50.000 FILL(float[previous, 1m])
  20. Eg: SELECT temperature,status FROM root.ln.wf01.wt01 WHERE time = 2017-11-01T16:37:50.000 FILL (float[linear, 1m, 1m], boolean[previous, 1m])
  21. Eg: SELECT temperature,status,hardware FROM root.ln.wf01.wt01 WHERE time = 2017-11-01T16:37:50.000 FILL (float[linear, 1m, 1m], boolean[previous, 1m], text[previous])
  22. Eg: SELECT temperature,status,hardware FROM root.ln.wf01.wt01 WHERE time = 2017-11-01T16:37:50.000 FILL (float[linear], boolean[previous, 1m], text[previous])
  23. Note: the statement needs to satisfy this constraint: <PrefixPath>(FromClause) + <Path>(SelectClause) = <Timeseries>
  24. Note: Integer in <TimeUnit> needs to be greater than 0
  • 分组依据填充语句
  1. SELECT <SelectClause> FROM <FromClause> WHERE <WhereClause> GROUP BY <GroupByClause> (FILL <GROUPBYFillClause>)?
  2. GroupByClause : LPAREN <TimeInterval> COMMA <TimeUnit> RPAREN
  3. GROUPBYFillClause : LPAREN <TypeClause> RPAREN
  4. TypeClause : <AllClause> | <Int32Clause> | <Int64Clause> | <FloatClause> | <DoubleClause> | <BoolClause> | <TextClause>
  5. AllClause: ALL LBRACKET (<PreviousUntilLastClause> | <PreviousClause>) RBRACKET
  6. Int32Clause: INT32 LBRACKET (<PreviousUntilLastClause> | <PreviousClause>) RBRACKET
  7. Int64Clause: INT64 LBRACKET (<PreviousUntilLastClause> | <PreviousClause>) RBRACKET
  8. FloatClause: FLOAT LBRACKET (<PreviousUntilLastClause> | <PreviousClause>) RBRACKET
  9. DoubleClause: DOUBLE LBRACKET (<PreviousUntilLastClause> | <PreviousClause>) RBRACKET
  10. BoolClause: BOOLEAN LBRACKET (<PreviousUntilLastClause> | <PreviousClause>) RBRACKET
  11. TextClause: TEXT LBRACKET (<PreviousUntilLastClause> | <PreviousClause>) RBRACKET
  12. PreviousClause : PREVIOUS
  13. PreviousUntilLastClause : PREVIOUSUNTILLAST
  14. Eg: SELECT last_value(temperature) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (float[PREVIOUS])
  15. Eg: SELECT last_value(temperature) FROM root.ln.wf01.wt01 GROUP BY((15, 100], 5m) FILL (float[PREVIOUS])
  16. Eg: SELECT last_value(power) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (int32[PREVIOUSUNTILLAST])
  17. Eg: SELECT last_value(power) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (int32[PREVIOUSUNTILLAST, 5m])
  18. Eg: SELECT last_value(temperature), last_value(power) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (ALL[PREVIOUS])
  19. Eg: SELECT last_value(temperature), last_value(power) FROM root.ln.wf01.wt01 GROUP BY([20, 100), 5m) FILL (ALL[PREVIOUS, 5m])
  20. Note: In group by fill, sliding step is not supported in group by clause
  21. Note: Now, only last_value aggregation function is supported in group by fill.
  22. Note: Linear fill is not supported in group by fill.
  • 限价声明
  1. SELECT <SelectClause> FROM <FromClause> [WHERE <WhereClause>] [<LIMITClause>] [<SLIMITClause>]
  2. SelectClause : [<Path> | Function]+
  3. Function : <AggregationFunction> LPAREN <Path> RPAREN
  4. FromClause : <Path>
  5. WhereClause : <Condition> [(AND | OR) <Condition>]*
  6. Condition : <Expression> [(AND | OR) <Expression>]*
  7. Expression: [NOT|!]?<TimeExpr> | [NOT|!]?<SensorExpr>
  8. TimeExpr : TIME PrecedenceEqualOperator (<TimeValue> | <RelativeTime>)
  9. RelativeTimeDurationUnit = Integer ('Y'|'MO'|'W'|'D'|'H'|'M'|'S'|'MS'|'US'|'NS')
  10. RelativeTime : (now() | <TimeValue>) [(+|-) RelativeTimeDurationUnit]+
  11. SensorExpr : (<Timeseries>|<Path>) PrecedenceEqualOperator <PointValue>
  12. LIMITClause : LIMIT <N> [OFFSETClause]?
  13. N : Integer
  14. OFFSETClause : OFFSET <OFFSETValue>
  15. OFFSETValue : Integer
  16. SLIMITClause : SLIMIT <SN> [SOFFSETClause]?
  17. SN : Integer
  18. SOFFSETClause : SOFFSET <SOFFSETValue>
  19. SOFFSETValue : Integer
  20. Eg: IoTDB > SELECT status, temperature FROM root.ln.wf01.wt01 WHERE temperature < 24 and time > 2017-11-1 0:13:00 LIMIT 3 OFFSET 2
  21. Eg. IoTDB > SELECT COUNT (status), MAX_VALUE(temperature) FROM root.ln.wf01.wt01 WHERE time < 1509466500000 GROUP BY([1509465720000, 1509466380000], 5m) LIMIT 3
  22. Note: N, OFFSETValue, SN and SOFFSETValue must be greater than 0.
  23. Note: The order of <LIMITClause> and <SLIMITClause> does not affect the grammatical correctness.
  24. Note: <FillClause> can not use <LIMITClause> but not <SLIMITClause>.
  • 按设备对齐语句
  1. AlignbyDeviceClause : ALIGN BY DEVICE
  2. Rules:
  3. 1. Both uppercase and lowercase are ok.
  4. Correct example: select * from root.sg1 align by device
  5. Correct example: select * from root.sg1 ALIGN BY DEVICE
  6. 2. AlignbyDeviceClause can only be used at the end of a query statement.
  7. Correct example: select * from root.sg1 where time > 10 align by device
  8. Wrong example: select * from root.sg1 align by device where time > 10
  9. 3. The paths of the SELECT clause can only be single level. In other words, the paths of the SELECT clause can only be measurements or STAR, without DOT.
  10. Correct example: select s0,s1 from root.sg1.* align by device
  11. Correct example: select s0,s1 from root.sg1.d0, root.sg1.d1 align by device
  12. Correct example: select * from root.sg1.* align by device
  13. Correct example: select * from root align by device
  14. Correct example: select s0,s1,* from root.*.* align by device
  15. Wrong example: select d0.s1, d0.s2, d1.s0 from root.sg1 align by device
  16. Wrong example: select *.s0, *.s1 from root.* align by device
  17. Wrong example: select *.*.* from root align by device
  18. 4. The data types of the same measurement column should be the same across devices.
  19. Note that when it comes to aggregated paths, the data type of the measurement column will reflect
  20. the aggregation function rather than the original timeseries.
  21. Correct example: select s0 from root.sg1.d0,root.sg1.d1 align by device
  22. root.sg1.d0.s0 and root.sg1.d1.s0 are both INT32.
  23. Correct example: select count(s0) from root.sg1.d0,root.sg1.d1 align by device
  24. count(root.sg1.d0.s0) and count(root.sg1.d1.s0) are both INT64.
  25. Wrong example: select s0 from root.sg1.d0, root.sg2.d3 align by device
  26. root.sg1.d0.s0 is INT32 while root.sg2.d3.s0 is FLOAT.
  27. 5. The display principle of the result table is that all the columns (no matther whther a column has has existing data) will be shown, with nonexistent cells being null. Besides, the select clause support const column (e.g., 'a', '123' etc..).
  28. For example, "select s0,s1,s2,'abc',s1,s2 from root.sg.d0, root.sg.d1, root.sg.d2 align by device". Suppose that the actual existing timeseries are as follows:
  29. - root.sg.d0.s0
  30. - root.sg.d0.s1
  31. - root.sg.d1.s0
  32. Then you could expect a table like:
  33. | Time | Device | s0 | s1 | s2 | 'abc' | s1 | s2 |
  34. | --- | --- | ---| ---| null | 'abc' | ---| null |
  35. | 1 |root.sg.d0| 20 | 2.5| null | 'abc' | 2.5| null |
  36. | 2 |root.sg.d0| 23 | 3.1| null | 'abc' | 3.1| null |
  37. | ... | ... | ...| ...| null | 'abc' | ...| null |
  38. | 1 |root.sg.d1| 12 |null| null | 'abc' |null| null |
  39. | 2 |root.sg.d1| 19 |null| null | 'abc' |null| null |
  40. | ... | ... | ...| ...| null | 'abc' | ...| null |
  41. Note that the cells of measurement 's0' and device 'root.sg.d1' are all null.
  42. 6. The duplicated devices in the prefix paths are neglected.
  43. For example, "select s0,s1 from root.sg.d0,root.sg.d0,root.sg.d1 align by device" is equal to "select s0,s1 from root.sg.d0,root.sg.d1 align by device".
  44. For example. "select s0,s1 from root.sg.*,root.sg.d0 align by device" is equal to "select s0,s1 from root.sg.* align by device".
  45. 7. The duplicated measurements in the suffix paths are not neglected.
  46. For example, "select s0,s0,s1 from root.sg.* align by device" is not equal to "select s0,s1 from root.sg.* align by device".
  47. 8. Both time predicates and value predicates are allowed in Where Clause. The paths of the value predicates can be the leaf node or full path started with ROOT. And wildcard is not allowed here. For example:
  48. - select * from root.sg.* where time = 1 align by device
  49. - select * from root.sg.* where s0 < 100 align by device
  50. - select * from root.sg.* where time < 20 AND s0 > 50 align by device
  51. - select * from root.sg.d0 where root.sg.d0.s0 = 15 align by device
  52. 9. More correct examples:
  53. - select * from root.vehicle align by device
  54. - select s0,s0,s1 from root.vehicle.* align by device
  55. - select s0,s1 from root.vehicle.* limit 10 offset 1 align by device
  56. - select * from root.vehicle slimit 10 soffset 2 align by device
  57. - select * from root.vehicle where time > 10 align by device
  58. - select * from root.vehicle.* where time < 10 AND s0 > 25 align by device
  59. - select * from root.vehicle where root.vehicle.d0.s0>0 align by device
  60. - select count(*) from root.vehicle align by device
  61. - select sum(*) from root.vehicle GROUP BY (20ms,0,[2,50]) align by device
  62. - select * from root.vehicle where time = 3 Fill(int32[previous, 5ms]) align by device
  • 禁用对齐语句
  1. Disable Align Clause: DISABLE ALIGN
  2. Rules:
  3. 1. Both uppercase and lowercase are ok.
  4. Correct example: select * from root.sg1 disable align
  5. Correct example: select * from root.sg1 DISABLE ALIGN
  6. 2. Disable Align Clause can only be used at the end of a query statement.
  7. Correct example: select * from root.sg1 where time > 10 disable align
  8. Wrong example: select * from root.sg1 disable align where time > 10
  9. 3. Disable Align Clause cannot be used with Aggregation, Fill Statements, Group By or Group By Device Statements, but can with Limit Statements.
  10. Correct example: select * from root.sg1 limit 3 offset 2 disable align
  11. Correct example: select * from root.sg1 slimit 3 soffset 2 disable align
  12. Wrong example: select count(s0),count(s1) from root.sg1.d1 disable align
  13. Wrong example: select * from root.vehicle where root.vehicle.d0.s0>0 disable align
  14. Wrong example: select * from root.vehicle align by device disable align
  15. 4. The display principle of the result table is that only when the column (or row) has existing data will the column (or row) be shown, with nonexistent cells being empty.
  16. You could expect a table like:
  17. | Time | root.sg.d0.s1 | Time | root.sg.d0.s2 | Time | root.sg.d1.s1 |
  18. | --- | --- | --- | --- | --- | --- |
  19. | 1 | 100 | 20 | 300 | 400 | 600 |
  20. | 2 | 300 | 40 | 800 | 700 | 900 |
  21. | 4 | 500 | | | 800 | 1000 |
  22. | | | | | 900 | 8000 |
  23. 5. More correct examples:
  24. - select * from root.vehicle disable align
  25. - select s0,s0,s1 from root.vehicle.* disable align
  26. - select s0,s1 from root.vehicle.* limit 10 offset 1 disable align
  27. - select * from root.vehicle slimit 10 soffset 2 disable align
  28. - select * from root.vehicle where time > 10 disable align
  • 选择最后记录语句

LAST 函数返回给定时间序列的最后一个时间值对。目前,LAST 查询不支持筛选器。

  1. SELECT LAST <SelectClause> FROM <FromClause>
  2. Select Clause : <Path> [COMMA <Path>]*
  3. FromClause : < PrefixPath > [COMMA < PrefixPath >]*
  4. Eg. SELECT LAST s1 FROM root.sg.d1
  5. Eg. SELECT LAST s1, s2 FROM root.sg.d1
  6. Eg. SELECT LAST s1 FROM root.sg.d1, root.sg.d2
  7. Rules:
  8. 1. the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  9. 2. The result set of last query will always be displayed in a fixed three column table format.
  10. For example, "select last s1, s2 from root.sg.d1, root.sg.d2", the query result would be:
  11. | Time | Path | Value |
  12. | --- | ------------ | ----- |
  13. | 5 | root.sg.d1.s1| 100 |
  14. | 2 | root.sg.d1.s2| 400 |
  15. | 4 | root.sg.d2.s1| 250 |
  16. | 9 | root.sg.d2.s2| 600 |
  17. 3. It is not supported to use "diable align" in LAST query.

数据库管理声明

  • 创建用户
  1. CREATE USER <userName> <password>;
  2. userName:=identifier
  3. password:=string
  4. Eg: IoTDB > CREATE USER thulab 'pwd';
  • 删除用户
  1. DROP USER <userName>;
  2. userName:=identifier
  3. Eg: IoTDB > DROP USER xiaoming;
  • 创建角色
  1. CREATE ROLE <roleName>;
  2. roleName:=identifie
  3. Eg: IoTDB > CREATE ROLE admin;
  • 删除角色
  1. DROP ROLE <roleName>;
  2. roleName:=identifier
  3. Eg: IoTDB > DROP ROLE admin;
  • 授予用户权限
  1. GRANT USER <userName> PRIVILEGES <privileges> ON <nodeName>;
  2. userName:=identifier
  3. nodeName:=identifier (DOT identifier)*
  4. privileges:= string (COMMA string)*
  5. Eg: IoTDB > GRANT USER tempuser PRIVILEGES 'DELETE_TIMESERIES' on root.ln;
  • 授予角色权限
  1. GRANT ROLE <roleName> PRIVILEGES <privileges> ON <nodeName>;
  2. privileges:= string (COMMA string)*
  3. roleName:=identifier
  4. nodeName:=identifier (DOT identifier)*
  5. Eg: IoTDB > GRANT ROLE temprole PRIVILEGES 'DELETE_TIMESERIES' ON root.ln;
  • 授予用户角色
  1. GRANT <roleName> TO <userName>;
  2. roleName:=identifier
  3. userName:=identifier
  4. Eg: IoTDB > GRANT temprole TO tempuser;
  • 撤销用户权限
  1. REVOKE USER <userName> PRIVILEGES <privileges> ON <nodeName>;
  2. privileges:= string (COMMA string)*
  3. userName:=identifier
  4. nodeName:=identifier (DOT identifier)*
  5. Eg: IoTDB > REVOKE USER tempuser PRIVILEGES 'DELETE_TIMESERIES' on root.ln;
  • 撤销角色特权
  1. REVOKE ROLE <roleName> PRIVILEGES <privileges> ON <nodeName>;
  2. privileges:= string (COMMA string)*
  3. roleName:= identifier
  4. nodeName:=identifier (DOT identifier)*
  5. Eg: IoTDB > REVOKE ROLE temprole PRIVILEGES 'DELETE_TIMESERIES' ON root.ln;
  • 撤消用户的角色
  1. REVOKE <roleName> FROM <userName>;
  2. roleName:=identifier
  3. userName:=identifier
  4. Eg: IoTDB > REVOKE temproleFROM tempuser;
  • 列出用户
  1. LIST USER
  2. Eg: IoTDB > LIST USER
  • 列出角色
  1. LIST ROLE
  2. Eg: IoTDB > LIST ROLE
  • 列出权限
  1. LIST PRIVILEGES USER <username> ON <path>;
  2. username:=identifier
  3. path=‘root (DOT identifier)*
  4. Eg: IoTDB > LIST PRIVIEGES USER sgcc_wirte_user ON root.sgcc;
  • 列出角色权限(在特定路径上)
  1. LIST PRIVILEGES ROLE <roleName> ON <path>;
  2. roleName:=identifier
  3. path=‘root (DOT identifier)*
  4. Eg: IoTDB > LIST PRIVIEGES ROLE wirte_role ON root.sgcc;
  • 列出用户的权限
  1. LIST USER PRIVILEGES <username> ;
  2. username:=identifier
  3. Eg: IoTDB > LIST USER PRIVIEGES tempuser;
  • 列出角色的权限
  1. LIST ROLE PRIVILEGES <roleName>
  2. roleName:=identifier
  3. Eg: IoTDB > LIST ROLE PRIVIEGES actor;
  • 列出用户的角色
  1. LIST ALL ROLE OF USER <username> ;
  2. username:=identifier
  3. Eg: IoTDB > LIST ALL ROLE OF USER tempuser;
  • 列出角色的用户
  1. LIST ALL USER OF ROLE <roleName>;
  2. roleName:=identifier
  3. Eg: IoTDB > LIST ALL USER OF ROLE roleuser;
  • 更改密码
  1. ALTER USER <username> SET PASSWORD <password>;
  2. roleName:=identifier
  3. password:=identifier
  4. Eg: IoTDB > ALTER USER tempuser SET PASSWORD 'newpwd';

功能

  • 计数

COUNT 函数返回由 SELECT 语句选择的时间序列(一个或多个)非空值的值数。结果是一个有符号的 64 位整数。如果没有匹配的行,则 COUNT () 返回 0。

  1. SELECT COUNT(Path) (COMMA COUNT(Path))* FROM <FromClause> [WHERE <WhereClause>]?
  2. Eg. SELECT COUNT(status), COUNT(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 24
  3. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  • FIRST_VALUE(从FIRSTV0.10.0)

FIRST_VALUE函数返回所选时间序列的第一个点值(一个或多个)。

  1. SELECT FIRST_VALUE (Path) (COMMA FIRST_VALUE (Path))* FROM <FromClause> [WHERE <WhereClause>]?
  2. Eg. SELECT FIRST_VALUE (status), FIRST_VALUE (temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 24
  3. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  • LAST_VALUE

LAST_VALUE函数返回所选时间序列的最后一个点值(一个或多个)。

  1. SELECT LAST_VALUE (Path) (COMMA LAST_VALUE (Path))* FROM <FromClause> [WHERE <WhereClause>]?
  2. Eg. SELECT LAST_VALUE (status), LAST_VALUE (temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 24
  3. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  • MAX_TIME

MAX_TIME函数返回所选时间序列的最大时间戳(一个或多个)。结果是一个有符号的 64 位整数,大于 0。

  1. SELECT MAX_TIME (Path) (COMMA MAX_TIME (Path))* FROM <FromClause> [WHERE <WhereClause>]?
  2. Eg. SELECT MAX_TIME(status), MAX_TIME(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 24
  3. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  • MAX_VALUE

MAX_VALUE 函数返回所选时间序列(一个或多个)的最大值(按字典顺序排列)。

  1. SELECT MAX_VALUE (Path) (COMMA MAX_VALUE (Path))* FROM <FromClause> [WHERE <WhereClause>]?
  2. Eg. SELECT MAX_VALUE(status), MAX_VALUE(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 24
  3. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  • AVG(从MEANV0.9.0)

AVG 函数返回指定时间段内所选时间序列的算术平均值。时间序列必须是 int32、int64、float、double 类型,其他类型不计算。结果是一个双精度类型数字。

  1. SELECT AVG (Path) (COMMA AVG (Path))* FROM <FromClause> [WHERE <WhereClause>]?
  2. Eg. SELECT AVG (temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 24
  3. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  • MIN_TIME

MIN_TIME函数返回所选时间序列(一个或多个)的最小时间戳。结果是一个有符号的 64 位整数,大于 0。

  1. SELECT MIN_TIME (Path) (COMMA MIN_TIME (Path))*FROM <FromClause> [WHERE <WhereClause>]?
  2. Eg. SELECT MIN_TIME(status), MIN_TIME(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 24
  3. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  • MIN_VALUE

MIN_VALUE函数返回所选时间序列(一个或多个)的最小值(按字典顺序排列)。

  1. SELECT MIN_VALUE (Path) (COMMA MIN_VALUE (Path))* FROM <FromClause> [WHERE <WhereClause>]?
  2. Eg. SELECT MIN_VALUE(status),MIN_VALUE(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 24
  3. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>
  • 现在

NOW 函数返回当前时间戳。此函数可以在数据操作语句中用于表示时间。结果是一个有符号的 64 位整数,大于 0。

  1. NOW()
  2. Eg. INSERT INTO root.ln.wf01.wt01(timestamp,status) VALUES(NOW(), false)
  3. Eg. UPDATE root.ln.wf01.wt01 SET temperature = 23 WHERE time < NOW()
  4. Eg. DELETE FROM root.ln.wf01.wt01.status, root.ln.wf01.wt01.temperature WHERE time < NOW()
  5. Eg. SELECT * FROM root WHERE time < NOW()
  6. Eg. SELECT COUNT(temperature) FROM root.ln.wf01.wt01 WHERE time < NOW()

SUM 函数返回指定时间段内所选时间序列(一个或多个)的总和。时间序列必须是 int32、int64、float、double 类型,其他类型不计算。结果是一个双精度类型数字。

  1. SELECT SUM(Path) (COMMA SUM(Path))* FROM <FromClause> [WHERE <WhereClause>]?
  2. Eg. SELECT SUM(temperature) FROM root.ln.wf01.wt01 WHERE root.ln.wf01.wt01.temperature < 24
  3. Note: the statement needs to satisfy this constraint: <PrefixPath> + <Path> = <Timeseries>

TTL

IoTDB支持存储级TTL设置,这意味着它能够自动和定期删除旧数据。使用 TTL 的好处是,希望您可以控制总磁盘空间使用量并防止计算机耗尽磁盘。此外,查询性能可能会随着文件总数的增加而下降,并且随着文件数量的增加,内存使用量也会增加。及时删除此类文件有助于保持较高的查询性能级别并减少内存使用量。IoTDB 中的 TTL 操作由以下三个语句支持:

  • 设置 TTL
  1. SET TTL TO StorageGroupName TTLTime
  2. Eg. SET TTL TO root.group1 3600000
  3. This example means that for data in root.group1, only that of the latest 1 hour will remain, the
  4. older one is removed or made invisible.
  5. Note: TTLTime should be millisecond timestamp. When TTL is set, insertions that fall
  6. out of TTL will be rejected.
  • 未设置 TTL
  1. UNSET TTL TO StorageGroupName
  2. Eg. UNSET TTL TO root.group1
  3. This example means that data of all time will be accepted in this group.
  • 显示 TTL
  1. SHOW ALL TTL
  2. SHOW TTL ON StorageGroupNames
  3. Eg.1 SHOW ALL TTL
  4. This example will show TTLs of all storage groups.
  5. Eg.2 SHOW TTL ON root.group1,root.group2,root.group3
  6. This example will show TTLs of the specified 3 groups.
  7. Notice: storage groups without TTL will show a "null"

注意:将 TTL 设置为某些存储组时,TTL 外的数据将立即变得不可见,但由于数据文件可能包含过时数据和活动数据,或者数据文件可能正被查询使用,因此数据的物理删除是过时的。如果在之前设置TTL后增加或取消设置TTL,则可能会再次看到一些以前不可见的数据,但物理删除的数据将永远丢失。换句话说,与删除语句不同,出于效率考虑,不保证数据删除的原子性。因此,我们建议您不要在设置TTL后更改它,或者至少不要经常重置它,除非您决心遭受不可预测性。

参考

关键字

  1. Keywords for IoTDB (case insensitive):
  2. ADD, BY, COMPRESSOR, CREATE, DATATYPE, DELETE, DESCRIBE, DROP, ENCODING, EXIT, FROM, GRANT, GROUP, LABLE, LINK, INDEX, INSERT, INTO, LOAD, MAX_POINT_NUMBER, MERGE, METADATA, ON, ORDER, PASSWORD, PRIVILEGES, PROPERTY, QUIT, REVOKE, ROLE, ROOT, SELECT, SET, SHOW, STORAGE, TIME, TIMESERIES, TIMESTAMP, TO, UNLINK, UPDATE, USER, USING, VALUE, VALUES, WHERE, WITH
  3. Keywords with special meanings (case insensitive):
  4. * Data Types: BOOLEAN, DOUBLE, FLOAT, INT32, INT64, TEXT
  5. * Encoding Methods: BITMAP, DFT, GORILLA, PLAIN, RLE, TS_2DIFF
  6. * Compression Methods: UNCOMPRESSED, SNAPPY, GZIP, LZ0, ZDT, PAA, PLA
  7. * Logical symbol: AND, &, &&, OR, | , ||, NOT, !, TRUE, FALSE

标识符

  1. QUOTE := '\'';
  2. DOT := '.';
  3. COLON : ':' ;
  4. COMMA := ',' ;
  5. SEMICOLON := ';' ;
  6. LPAREN := '(' ;
  7. RPAREN := ')' ;
  8. LBRACKET := '[';
  9. RBRACKET := ']';
  10. EQUAL := '=' | '==';
  11. NOTEQUAL := '<>' | '!=';
  12. LESSTHANOREQUALTO := '<=';
  13. LESSTHAN := '<';
  14. GREATERTHANOREQUALTO := '>=';
  15. GREATERTHAN := '>';
  16. DIVIDE := '/';
  17. PLUS := '+';
  18. MINUS := '-';
  19. STAR := '*';
  20. Letter := 'a'..'z' | 'A'..'Z';
  21. HexDigit := 'a'..'f' | 'A'..'F';
  22. Digit := '0'..'9';
  23. Boolean := TRUE | FALSE | 0 | 1 (case insensitive)
  24. StringLiteral := ( '\'' ( ~('\'') )* '\'' | '\"' ( ~('\"') )* '\"');
  25. eg. 'abc'
  26. eg. 'abc'
  27. Integer := ('-' | '+')? Digit+;
  28. eg. 123
  29. eg. -222
  30. Float := ('-' | '+')? Digit+ DOT Digit+ (('e' | 'E') ('-' | '+')? Digit+)?;
  31. eg. 3.1415
  32. eg. 1.2E10
  33. eg. -1.33
  34. Identifier := (Letter | '_') (Letter | Digit | '_' | MINUS)*;
  35. eg. a123
  36. eg. _abc123

文字

  1. PointValue : Integer | Float | StringLiteral | Boolean
  2. TimeValue : Integer | DateTime | ISO8601 | NOW()
  3. Note: Integer means timestamp type.
  4. DateTime :
  5. eg. 2016-11-16T16:22:33+08:00
  6. eg. 2016-11-16 16:22:33+08:00
  7. eg. 2016-11-16T16:22:33.000+08:00
  8. eg. 2016-11-16 16:22:33.000+08:00
  9. Note: DateTime Type can support several types, see Chapter 3 Datetime section for details.
  10. PrecedenceEqualOperator : EQUAL | NOTEQUAL | LESSTHANOREQUALTO | LESSTHAN | GREATERTHANOREQUALTO | GREATERTHAN
  11. Timeseries : ROOT [DOT <LayerName>]* DOT <SensorName>
  12. LayerName : Identifier
  13. SensorName : Identifier
  14. eg. root.ln.wf01.wt01.status
  15. eg. root.sgcc.wf03.wt01.temperature
  16. Note: Timeseries must be start with `root`(case insensitive) and end with sensor name.
  17. PrefixPath : ROOT (DOT <LayerName>)*
  18. LayerName : Identifier | STAR
  19. eg. root.sgcc
  20. eg. root.*
  21. Path: (ROOT | <LayerName>) (DOT <LayerName>)*
  22. LayerName: Identifier | STAR
  23. eg. root.ln.wf01.wt01.status
  24. eg. root.*.wf01.wt01.status
  25. eg. root.ln.wf01.wt01.*
  26. eg. *.wt01.*
  27. eg. *
相关文章
|
12天前
|
API 持续交付 开发者
后端开发中的微服务架构实践与挑战
在数字化时代,后端服务的构建和管理变得日益复杂。本文将深入探讨微服务架构在后端开发中的应用,分析其在提高系统可扩展性、灵活性和可维护性方面的优势,同时讨论实施微服务时面临的挑战,如服务拆分、数据一致性和部署复杂性等。通过实际案例分析,本文旨在为开发者提供微服务架构的实用见解和解决策略。
|
25天前
|
Java 持续交付 微服务
后端开发中的微服务架构实践与挑战####
本文深入探讨了微服务架构在现代后端开发中的应用,通过具体案例分析,揭示了其如何助力企业应对业务复杂性、提升系统可维护性和可扩展性。文章首先概述了微服务的核心概念及其优势,随后详细阐述了实施微服务过程中的关键技术选型、服务拆分策略、容错机制以及持续集成/持续部署(CI/CD)的最佳实践。最后,通过一个真实世界的应用实例,展示了微服务架构在实际项目中的成功应用及其带来的显著成效。 ####
|
11天前
|
存储 SQL Apache
Apache Doris 开源最顶级基于MPP架构的高性能实时分析数据库
Apache Doris 是一个基于 MPP 架构的高性能实时分析数据库,以其极高的速度和易用性著称。它支持高并发点查询和复杂分析场景,适用于报表分析、即席查询、数据仓库和数据湖查询加速等。最新发布的 2.0.2 版本在性能、稳定性和多租户支持方面有显著提升。社区活跃,已广泛应用于电商、广告、用户行为分析等领域。
Apache Doris 开源最顶级基于MPP架构的高性能实时分析数据库
|
6天前
|
监控 API 持续交付
后端开发中的微服务架构实践与挑战####
本文深入探讨了微服务架构在后端开发中的应用,分析了其优势、面临的挑战以及最佳实践策略。不同于传统的单体应用,微服务通过细粒度的服务划分促进了系统的可维护性、可扩展性和敏捷性。文章首先概述了微服务的核心概念及其与传统架构的区别,随后详细阐述了构建微服务时需考虑的关键技术要素,如服务发现、API网关、容器化部署及持续集成/持续部署(CI/CD)流程。此外,还讨论了微服务实施过程中常见的问题,如服务间通信复杂度增加、数据一致性保障等,并提供了相应的解决方案和优化建议。总之,本文旨在为开发者提供一份关于如何在现代后端系统中有效采用和优化微服务架构的实用指南。 ####
|
8天前
|
消息中间件 设计模式 运维
后端开发中的微服务架构实践与挑战####
本文深入探讨了微服务架构在现代后端开发中的应用,通过实际案例分析,揭示了其在提升系统灵活性、可扩展性及促进技术创新方面的显著优势。同时,文章也未回避微服务实施过程中面临的挑战,如服务间通信复杂性、数据一致性保障及部署运维难度增加等问题,并基于实践经验提出了一系列应对策略,为开发者在构建高效、稳定的微服务平台时提供有价值的参考。 ####
|
8天前
|
消息中间件 监控 数据管理
后端开发中的微服务架构实践与挑战####
【10月更文挑战第29天】 在当今快速发展的软件开发领域,微服务架构已成为构建高效、可扩展和易于维护应用程序的首选方案。本文探讨了微服务架构的核心概念、实施策略以及面临的主要挑战,旨在为开发者提供一份实用的指南,帮助他们在项目中成功应用微服务架构。通过具体案例分析,我们将深入了解如何克服服务划分、数据管理、通信机制等关键问题,以实现系统的高可用性和高性能。 --- ###
30 2
|
16天前
|
分布式计算 大数据 Apache
Apache Spark & Paimon Meetup · 北京站,助力 LakeHouse 架构生产落地
2024年11月15日13:30北京市朝阳区阿里中心-望京A座-05F,阿里云 EMR 技术团队联合 Apache Paimon 社区举办 Apache Spark & Paimon meetup,助力企业 LakeHouse 架构生产落地”线下 meetup,欢迎报名参加!
80 3
|
18天前
|
缓存 运维 监控
后端开发中的微服务架构实践与挑战#### 一、
【10月更文挑战第22天】 本文探讨了微服务架构在后端开发中的应用实践,深入剖析了其核心优势、常见挑战及应对策略。传统后端架构难以满足快速迭代与高可用性需求,而微服务通过服务拆分与独立部署,显著提升了系统的灵活性和可维护性。文章指出,实施微服务需关注服务划分的合理性、通信机制的选择及数据一致性等问题。以电商系统为例,详细阐述了微服务改造过程,包括用户、订单、商品等服务的拆分与交互。最终强调,微服务虽优势明显,但落地需谨慎规划,持续优化。 #### 二、
|
17天前
|
监控 安全 Serverless
"揭秘D2终端大会热点技术:Serverless架构最佳实践全解析,让你的开发效率翻倍,迈向技术新高峰!"
【10月更文挑战第23天】D2终端大会汇聚了众多前沿技术,其中Serverless架构备受瞩目。它让开发者无需关注服务器管理,专注于业务逻辑,提高开发效率。本文介绍了选择合适平台、设计合理函数架构、优化性能及安全监控的最佳实践,助力开发者充分挖掘Serverless潜力,推动技术发展。
39 1
|
24天前
|
监控 API 开发者
后端开发中的微服务架构实践与优化
【10月更文挑战第17天】 本文深入探讨了微服务架构在后端开发中的应用及其优化策略。通过分析微服务的核心理念、设计原则及实际案例,揭示了如何构建高效、可扩展的微服务系统。文章强调了微服务架构对于提升系统灵活性、降低耦合度的重要性,并提供了实用的优化建议,帮助开发者更好地应对复杂业务场景下的挑战。
19 7

热门文章

最新文章

推荐镜像

更多