- All the data in `tag_set` will be converted to nchar type automatically .
- Each data in `field_set` must be self-descriptive for its data type. For example 1.2f32 means a value 1.2 of float type. Without the "f" type suffix, it will be treated as type double.
- Multiple kinds of precision can be used for the `timestamp` field. Time precision can be from nanosecond (ns) to hour (h).
- You can configure smlChildTableName in taos.cfg to specify table names, for example, `smlChildTableName=tname`. You can insert `st,tname=cpul,t1=4 c1=3 1626006833639000000` and the cpu1 table will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
- It is assumed that the order of field_set in a supertable is consistent, meaning that the first record contains all fields and subsequent records store fields in the same order. If the order is not consistent, set smlDataFormat in taos.cfg to false. Otherwise, data will be written out of order and a database error will occur.(smlDataFormat in taos.cfg default to false after version of 3.0.1.3)
:::
For more details please refer to [InfluxDB Line Protocol](https://docs.influxdata.com/influxdb/v2.0/reference/syntax/line-protocol/) and [TDengine Schemaless](/reference/schemaless/#Schemaless-Line-Protocol)
...
...
@@ -64,3 +65,7 @@ For more details please refer to [InfluxDB Line Protocol](https://docs.influxdat
<CLine />
</TabItem>
</Tabs>
## Query Examples
If you want query the data of `location=California.LosAngeles,groupid=2`,here is the query sql:
select * from `meters.voltage` where location="California.LosAngeles" and groupid=2
- The defult child table name is generated by rules.You can configure smlChildTableName in taos.cfg to specify chile table names, for example, `smlChildTableName=tname`. You can insert `meters.current 1648432611250 11.3 tname=cpu1 location=California.LosAngeles groupid=3` and the cpu1 table will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
Please refer to [OpenTSDB Telnet API](http://opentsdb.net/docs/build/html/api_telnet/put.html) for more details.
## Examples
...
...
@@ -79,3 +79,6 @@ taos> select tbname, * from `meters.current`;
@@ -48,7 +48,7 @@ Please refer to [OpenTSDB HTTP API](http://opentsdb.net/docs/build/html/api_http
- In JSON protocol, strings will be converted to nchar type and numeric values will be converted to double type.
- Only data in array format is accepted and so an array must be used even if there is only one row.
- The defult child table name is generated by rules.You can configure smlChildTableName in taos.cfg to specify chile table names, for example, `smlChildTableName=tname`. You can insert `"tags": { "host": "web02","dc": "lga","tname":"cpu1"}` and the cpu1 table will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
:::
## Examples
...
...
@@ -94,3 +94,6 @@ taos> select * from `meters.current`;
- The number of rows in the result set of `INTERP` is determined by the parameter `EVERY`. Starting from timestamp1, one interpolation is performed for every time interval specified `EVERY` parameter.
- Interpolation is performed based on `FILL` parameter.
- `INTERP` can only be used to interpolate in single timeline. So it must be used with `partition by tbname` when it's used on a STable.
- Pseudo column `_irowts` can be used along with `INTERP` to return the timestamps associated with interpolation points(support after version 3.0.1.4).
@@ -11,7 +11,15 @@ TDengine includes a built-in database named `INFORMATION_SCHEMA` to provide acce
4. Future versions of TDengine can add new columns to INFORMATION_SCHEMA tables without affecting existing business systems.
5. It is easier for users coming from other database management systems. For example, Oracle users can query data dictionary tables.
Note: SHOW statements are still supported for the convenience of existing users.
:::info
- SHOW statements are still supported for the convenience of existing users.
- Some columns in the system table may be keywords, and you need to use the escape character '\`' when querying, for example, to query the VGROUPS in the database `test`:
```sql
select`vgroups`fromins_databaseswherename='test';
```
:::
This document introduces the tables of INFORMATION_SCHEMA and their structure.
...
...
@@ -102,7 +110,11 @@ Provides information about user-created databases. Similar to SHOW DATABASES.
| 24 | wal_retention_period | INT | WAL retention period |
| 25 | wal_retention_size | INT | Maximum WAL size |
| 26 | wal_roll_period | INT | WAL rotation period |
@@ -47,9 +47,8 @@ In the schemaless writing data line protocol, each data item in the field_set ne
-`t`, `T`, `true`, `True`, `TRUE`, `f`, `F`, `false`, and `False` will be handled directly as BOOL types.
For example, the following data rows indicate that the t1 label is "3" (NCHAR), the t2 label is "4" (NCHAR), and the t3 label
is "t3" to the super table named `st` labeled "t3" (NCHAR), write c1 column as 3 (BIGINT), c2 column as false (BOOL), c3 column
is "passit" (BINARY), c4 column is 4 (DOUBLE), and the primary key timestamp is 1626006833639000000 in one row.
For example, the following data rows write c1 column as 3 (BIGINT), c2 column as false (BOOL), c3 column
as "passit" (BINARY), c4 column as 4 (DOUBLE), and the primary key timestamp as 1626006833639000000 to child table with the t1 label as "3" (NCHAR), the t2 label as "4" (NCHAR), and the t3 label as "t3" (NCHAR) and the super table named `st`.
@@ -69,7 +68,7 @@ Schemaless writes process row data according to the following principles.
Note that tag_key1, tag_key2 are not the original order of the tags entered by the user but the result of using the tag names in ascending order of the strings. Therefore, tag_key1 is not the first tag entered in the line protocol.
The string's MD5 hash value "md5_val" is calculated after the ranking is completed. The calculation result is then combined with the string to generate the table name: "t_md5_val". "t_" is a fixed prefix that every table generated by this mapping relationship has.
You can configure smlChildTableName to specify table names, for example, `smlChildTableName=tname`. You can insert `st,tname=cpul,t1=4 c1=3 1626006833639000000` and the cpu1 table will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
You can configure smlChildTableName in taos.cfg to specify table names, for example, `smlChildTableName=tname`. You can insert `st,tname=cpul,t1=4 c1=3 1626006833639000000` and the cpu1 table will be automatically created. Note that if multiple rows have the same tname but different tag_set values, the tag_set of the first row is used to create the table and the others are ignored.
2. If the super table obtained by parsing the line protocol does not exist, this super table is created.
3. If the subtable obtained by the parse line protocol does not exist, Schemaless creates the sub-table according to the subtable name determined in steps 1 or 2.
...
...
@@ -78,7 +77,7 @@ You can configure smlChildTableName to specify table names, for example, `smlChi
NULL.
6. For BINARY or NCHAR columns, if the length of the value provided in a data row exceeds the column type limit, the maximum length of characters allowed to be stored in the column is automatically increased (only incremented and not decremented) to ensure complete preservation of the data.
7. Errors encountered throughout the processing will interrupt the writing process and return an error code.
8. It is assumed that the order of field_set in a supertable is consistent, meaning that the first record contains all fields and subsequent records store fields in the same order. If the order is not consistent, set smlDataFormat to false. Otherwise, data will be written out of order and a database error will occur.
8. It is assumed that the order of field_set in a supertable is consistent, meaning that the first record contains all fields and subsequent records store fields in the same order. If the order is not consistent, set smlDataFormat in taos.cfg to false. Otherwise, data will be written out of order and a database error will occur.(smlDataFormat in taos.cfg default to false after version of 3.0.1.3)
:::tip
All processing logic of schemaless will still follow TDengine's underlying restrictions on data structures, such as the total length of each row of data cannot exceed
echo-e"${GREEN_DARK}To access ${productName}${NC}: use ${GREEN_UNDERLINE}${clientName} -h $serverFqdn${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${nginx_port}${NC}"
echo-e"${GREEN_DARK}To access ${productName}${NC}: use ${GREEN_UNDERLINE}${clientName} -h $serverFqdn${NC} in shell OR from ${GREEN_UNDERLINE}http://127.0.0.1:${web_port}${NC}"
else
echo-e"${GREEN_DARK}To access ${productName}${NC}: use ${GREEN_UNDERLINE}${clientName} -h $serverFqdn${NC} in shell${NC}"
fi
...
...
@@ -906,6 +859,7 @@ function installProduct() {
install_connector
fi
install_examples
install_web
if[-z$1];then# install service and client
# For installing new
...
...
@@ -915,17 +869,6 @@ function installProduct() {
install_adapter_config
openresty_work=false
if["$verMode"=="cluster"];then
# Check if nginx is installed successfully
if type curl &>/dev/null;then
if curl -sSf http://127.0.0.1:${nginx_port} &>/dev/null;then
echo-e"\033[44;32;1mNginx for ${productName} is installed successfully!${NC}"
openresty_work=true
else
echo-e"\033[44;31;5mNginx for ${productName} does not work! Please try again!\033[0m"
sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));
sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL);
sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300);
sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next);
sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev);
sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear);
sql insert into t1 values(1648791213000,1,1,1,1.0,'aaa');
sleep 200
$loop_count = 0
loop0:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $rows != 1 then
print =====rows=$rows
goto loop0
endi
sql delete from t1;
$loop_count = 0
loop1:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $rows != 0 then
print =====rows1=$rows
goto loop1
endi
sql select * from streamt2 order by ts;
if $rows != 0 then
print =====rows2=$rows
goto loop1
endi
sql select * from streamt3 order by ts;
if $rows != 0 then
print =====rows3=$rows
goto loop1
endi
sql select * from streamt4 order by ts;
if $rows != 0 then
print =====rows4=$rows
goto loop1
endi
sql select * from streamt5 order by ts;
if $rows != 0 then
print =====rows5=$rows
goto loop1
endi
sql insert into t1 values(1648791210000,4,4,4,4.0,'ddd');
sql insert into t1 values(1648791215000,2,2,2,2.0,'bbb');
sql insert into t1 values(1648791217000,3,3,3,3.0,'ccc');
sql insert into t1 values(1648791219000,5,5,5,5.0,'eee');
$loop_count = 0
loop2:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $rows != 10 then
print =====rows=$rows
goto loop2
endi
#temp
system sh/stop_dnodes.sh
return 1
sql delete from t1 where ts >= 1648791214000;
$loop_count = 0
loop3:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $rows != 1 then
print =====rows1=$rows
goto loop3
endi
sql select * from streamt2 order by ts;
if $rows != 1 then
print =====rows2=$rows
goto loop3
endi
sql select * from streamt3 order by ts;
if $rows != 1 then
print =====rows3=$rows
goto loop3
endi
sql select * from streamt4 order by ts;
if $rows != 1 then
print =====rows4=$rows
goto loop3
endi
sql select * from streamt5 order by ts;
if $rows != 1 then
print =====rows5=$rows
goto loop3
endi
if $data01 != 4 then
print =====data01=$data01
return -1
endi
sql insert into t1 values(1648791213000,5,5,5,5.0,'eee');
sql insert into t1 values(1648791215000,5,5,5,5.0,'eee');
sql insert into t1 values(1648791219000,6,6,6,6.0,'fff');
$loop_count = 0
loop4:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $rows != 4 then
print =====rows=$rows
goto loop4
endi
sql delete from t1 where ts <= 1648791216000;
$loop_count = 0
loop5:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $rows != 1 then
print =====rows1=$rows
goto loop5
endi
sql select * from streamt2 order by ts;
if $rows != 1 then
print =====rows2=$rows
goto loop5
endi
sql select * from streamt3 order by ts;
if $rows != 1 then
print =====rows3=$rows
goto loop5
endi
sql select * from streamt4 order by ts;
if $rows != 1 then
print =====rows4=$rows
goto loop5
endi
sql select * from streamt5 order by ts;
if $rows != 1 then
print =====rows5=$rows
goto loop5
endi
if $data01 != 6 then
print =====data01=$data01
return -1
endi
sql drop stream if exists streams6;
sql drop stream if exists streams7;
sql drop stream if exists streams8;
sql drop stream if exists streams9;
sql drop stream if exists streams10;
sql drop database if exists test6;
sql create database test6 vgroups 1;
sql use test6;
sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,1,1);
sql create table t2 using st tags(1,1,1);
sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL);
sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300);
sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next);
sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev);
sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear);
sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa');
sql insert into t1 values(1648791217000,1,1,1,1.0,'aaa');
sql insert into t2 values(1648791215000,1,1,1,1.0,'aaa');
sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));
sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL);
sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300);
sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next);
sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev);
sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a), sum(b), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear);
sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa');
sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb');
sql insert into t1 values(1648791215000,5,5,5,5.0,'ccc');
sql insert into t1 values(1648791217000,6,6,6,6.0,'ddd');
$loop_count = 0
loop0:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $rows != 8 then
print =====rows=$rows
goto loop0
endi
sql delete from t1 where ts = 1648791213000;
$loop_count = 0
loop2:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $rows != 8 then
print ====streamt1=rows1=$rows
goto loop2
endi
if $data31 != NULL then
print ====streamt1=data31=$data31
goto loop2
endi
sql select * from streamt2 order by ts;
if $rows != 8 then
print ====streamt2=rows2=$rows
goto loop2
endi
if $data31 != 100 then
print ====streamt2=data31=$data31
goto loop2
endi
sql select * from streamt3 order by ts;
if $rows != 8 then
print ====streamt3=rows3=$rows
goto loop2
endi
if $data31 != 5 then
print ====streamt3=data31=$data31
goto loop2
endi
sql select * from streamt4 order by ts;
if $rows != 8 then
print ====streamt4=rows4=$rows
goto loop2
endi
if $data31 != 0 then
print ====streamt4=data31=$data31
goto loop2
endi
sql select * from streamt5 order by ts;
if $rows != 8 then
print ====streamt5=rows5=$rows
goto loop2
endi
if $data31 != 3 then
print ====streamt5=data31=$data31
goto loop2
endi
sql insert into t1 values(1648791212000,5,5,5,5.0,'eee');
sql insert into t1 values(1648791213000,6,6,6,6.0,'fff');
$loop_count = 0
loop3:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $data21 != 5 then
print ====133=rows=$rows
goto loop3
endi
if $data31 != 6 then
print ====137=rows=$rows
goto loop3
endi
sql delete from t1 where ts >= 1648791211000 and ts <= 1648791214000;
$loop_count = 0
loop4:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by ts;
if $rows != 8 then
print ====streamt1=rows1=$rows
goto loop4
endi
if $data31 != NULL then
print ====streamt1=data31=$data31
goto loop4
endi
sql select * from streamt2 order by ts;
if $rows != 8 then
print ====streamt2=rows2=$rows
goto loop4
endi
if $data31 != 100 then
print ====streamt2=data31=$data31
goto loop4
endi
sql select * from streamt3 order by ts;
if $rows != 8 then
print ====streamt3=rows3=$rows
goto loop4
endi
if $data31 != 5 then
print ====streamt3=data31=$data31
goto loop4
endi
sql select * from streamt4 order by ts;
if $rows != 8 then
print ====streamt4=rows4=$rows
goto loop4
endi
if $data31 != 0 then
print ====streamt4=data31=$data31
goto loop4
endi
sql select * from streamt5 order by ts;
if $rows != 8 then
print ====streamt5=rows5=$rows
goto loop4
endi
if $data31 != 3 then
print ====streamt5=data31=$data31
goto loop4
endi
sql drop stream if exists streams6;
sql drop stream if exists streams7;
sql drop stream if exists streams8;
sql drop stream if exists streams9;
sql drop stream if exists streams10;
sql drop database if exists test6;
sql create database test6 vgroups 1;
sql use test6;
sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,1,1);
sql create table t2 using st tags(1,1,1);
sql create stream streams6 trigger at_once into streamt6 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(NULL);
sql create stream streams7 trigger at_once into streamt7 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(value,100,200,300);
sql create stream streams8 trigger at_once into streamt8 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(next);
sql create stream streams9 trigger at_once into streamt9 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(prev);
sql create stream streams10 trigger at_once into streamt10 as select _wstart as ts, max(a), sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear);
sql insert into t1 values(1648791210000,1,1,1,1.0,'aaa');
sql insert into t1 values(1648791215000,6,8,8,8.0,'bbb');
sql insert into t1 values(1648791220000,11,10,10,10.0,'ccc');
sql insert into t1 values(1648791221000,6,6,6,6.0,'fff');
sql insert into t2 values(1648791212000,4,4,4,4.0,'ddd');
sql insert into t2 values(1648791214000,5,5,5,5.0,'eee');
sql insert into t2 values(1648791216000,2,2,2,2.0,'bbb');
sql insert into t2 values(1648791222000,6,6,6,6.0,'fff');
sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));
sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear);
sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb');
sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee');
$loop_count = 0
loop1:
sleep 200
sql use test1;
sql select * from streamt1 order by ts;
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
if $rows != 13 then
print =====rows=$rows
goto loop1
endi
if $data01 != 2.000000000 then
print =====data01=$data01
return -1
endi
if $data02 != 1.000000000 then
print =====data02=$data02
return -1
endi
if $data03 != ccc then
print =====data03=$data03
return -1
endi
if $data04 != 1 then
print =====data04=$data04
return -1
endi
if $data11 != 4.000000000 then
print =====data11=$data11
return -1
endi
if $data12 != 2.000000000 then
print =====data12=$data12
return -1
endi
if $data13 != NULL then
print =====data13=$data13
return -1
endi
if $data21 != 6.000000000 then
print =====data21=$data21
return -1
endi
if $data22 != 3.000000000 then
print =====data22=$data22
return -1
endi
if $data23 != NULL then
print =====data23=$data23
return -1
endi
if $data31 != 8.000000000 then
print =====data31=$data31
return -1
endi
if $data32 != 4.000000000 then
print =====data32=$data32
return -1
endi
if $data33 != aaa then
print =====data33=$data33
return -1
endi
if $data41 != 8.666666667 then
print =====data41=$data41
return -1
endi
if $data42 != 4.333333333 then
print =====data42=$data42
return -1
endi
if $data43 != NULL then
print =====data43=$data43
return -1
endi
if $data51 != 9.333333333 then
print =====data01=$data01
return -1
endi
if $data52 != 4.666666667 then
print =====data52=$data52
return -1
endi
if $data53 != NULL then
print =====data53=$data53
return -1
endi
if $data61 != 10.000000000 then
print =====data61=$data61
return -1
endi
if $data62 != 5.000000000 then
print =====data62=$data62
return -1
endi
if $data71 != 8.000000000 then
print =====data71=$data71
return -1
endi
if $data72 != 4.000000000 then
print =====data72=$data72
return -1
endi
if $data81 != 6.000000000 then
print =====data81=$data81
return -1
endi
if $data82 != 3.000000000 then
print =====data82=$data82
return -1
endi
if $data91 != 4.000000000 then
print =====data91=$data91
return -1
endi
if $data92 != 2.000000000 then
print =====data92=$data92
return -1
endi
if $data[10][1] != 4.666666667 then
print =====data[10][1]=$data[10][1]
return -1
endi
if $data[10][2] != 2.333333333 then
print =====data[10][2]=$data[10][2]
return -1
endi
if $data[11][1] != 5.333333333 then
print =====data[11][1]=$data[11][1]
return -1
endi
if $data[11][2] != 2.666666667 then
print =====data[11][2]=$data[11][2]
return -1
endi
if $data[12][1] != 6.000000000 then
print =====data[12][1]=$data[12][1]
return -1
endi
if $data[12][2] != 3.000000000 then
print =====data[12][2]=$data[12][2]
return -1
endi
sql drop stream if exists streams2;
sql drop database if exists test2;
sql create database test2 vgroups 1;
sql use test2;
sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));
sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a)+sum(c), avg(b), first(s), count(*) from t1 where ts >= 1648791210000 and ts < 1648791261000 interval(1s) fill(linear);
sql insert into t1 values(1648791210000,1,1,1,1.0,'ccc') (1648791219000,2,2,2,2.0,'ddd') (1648791222000,3,3,3,3.0,'eee');
sql insert into t1 values(1648791213000,4,4,4,4.0,'aaa') (1648791216000,5,5,5,5.0,'bbb');
$loop_count = 0
loop2:
sleep 200
sql select * from streamt2 order by ts;
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
if $rows != 13 then
print =====rows=$rows
goto loop2
endi
if $data01 != 2.000000000 then
print =====data01=$data01
return -1
endi
if $data02 != 1.000000000 then
print =====data02=$data02
return -1
endi
if $data03 != ccc then
print =====data03=$data03
return -1
endi
if $data04 != 1 then
print =====data04=$data04
return -1
endi
if $data11 != 4.000000000 then
print =====data11=$data11
return -1
endi
if $data12 != 2.000000000 then
print =====data12=$data12
return -1
endi
if $data13 != NULL then
print =====data13=$data13
return -1
endi
if $data21 != 6.000000000 then
print =====data21=$data21
return -1
endi
if $data22 != 3.000000000 then
print =====data22=$data22
return -1
endi
if $data23 != NULL then
print =====data23=$data23
return -1
endi
if $data31 != 8.000000000 then
print =====data31=$data31
return -1
endi
if $data32 != 4.000000000 then
print =====data32=$data32
return -1
endi
if $data33 != aaa then
print =====data33=$data33
return -1
endi
if $data41 != 8.666666667 then
print =====data41=$data41
return -1
endi
if $data42 != 4.333333333 then
print =====data42=$data42
return -1
endi
if $data43 != NULL then
print =====data43=$data43
return -1
endi
if $data51 != 9.333333333 then
print =====data01=$data01
return -1
endi
if $data52 != 4.666666667 then
print =====data52=$data52
return -1
endi
if $data53 != NULL then
print =====data53=$data53
return -1
endi
if $data61 != 10.000000000 then
print =====data61=$data61
return -1
endi
if $data62 != 5.000000000 then
print =====data62=$data62
return -1
endi
if $data71 != 8.000000000 then
print =====data71=$data71
return -1
endi
if $data72 != 4.000000000 then
print =====data72=$data72
return -1
endi
if $data81 != 6.000000000 then
print =====data81=$data81
return -1
endi
if $data82 != 3.000000000 then
print =====data82=$data82
return -1
endi
if $data91 != 4.000000000 then
print =====data91=$data91
return -1
endi
if $data92 != 2.000000000 then
print =====data92=$data92
return -1
endi
if $data[10][1] != 4.666666667 then
print =====data[10][1]=$data[10][1]
return -1
endi
if $data[10][2] != 2.333333333 then
print =====data[10][2]=$data[10][2]
return -1
endi
if $data[11][1] != 5.333333333 then
print =====data[11][1]=$data[11][1]
return -1
endi
if $data[11][2] != 2.666666667 then
print =====data[11][2]=$data[11][2]
return -1
endi
if $data[12][1] != 6.000000000 then
print =====data[12][1]=$data[12][1]
return -1
endi
if $data[12][2] != 3.000000000 then
print =====data[12][2]=$data[12][2]
return -1
endi
sql drop stream if exists streams3;
sql drop database if exists test3;
sql create database test3 vgroups 1;
sql use test3;
sql create table t1(ts timestamp, a int, b int , c int, d double, s varchar(20));
sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a), b+c, s, b+1, 1 from t1 where ts >= 1648791150000 and ts < 1648791261000 interval(1s) fill(linear);
sql insert into t1 values(1648791215000,1,1,1,1.0,'aaa');
sql insert into t1 values(1648791217000,2,2,2,2.0,'bbb');
sql insert into t1 values(1648791211000,3,3,3,3.0,'ccc');
sql insert into t1 values(1648791213000,4,4,4,4.0,'ddd');
$loop_count = 0
loop3:
sleep 300
sql select * from streamt3 order by ts;
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
if $rows != 7 then
print =====rows=$rows
goto loop3
endi
if $data01 != 3 then
print =====data01=$data01
return -1
endi
if $data02 != 6.000000000 then
print =====data02=$data02
return -1
endi
if $data03 != ccc then
print =====data03=$data03
return -1
endi
if $data11 != 3 then
print =====data11=$data11
return -1
endi
if $data12 != 7.000000000 then
print =====data12=$data12
return -1
endi
if $data13 != NULL then
print =====data13=$data13
return -1
endi
if $data21 != 4 then
print =====data21=$data21
return -1
endi
if $data22 != 8.000000000 then
print =====data22=$data22
return -1
endi
if $data23 != ddd then
print =====data23=$data23
return -1
endi
if $data31 != 2 then
print =====data31=$data31
return -1
endi
if $data32 != 5.000000000 then
print =====data32=$data32
return -1
endi
if $data33 != NULL then
print =====data33=$data33
return -1
endi
if $data41 != 1 then
print =====data41=$data41
return -1
endi
if $data42 != 2.000000000 then
print =====data42=$data42
return -1
endi
if $data43 != aaa then
print =====data43=$data43
return -1
endi
if $data51 != 1 then
print =====data51=$data51
return -1
endi
if $data52 != 3.000000000 then
print =====data52=$data52
return -1
endi
if $data53 != NULL then
print =====data53=$data53
return -1
endi
if $data61 != 2 then
print =====data61=$data61
return -1
endi
if $data62 != 4.000000000 then
print =====data62=$data62
return -1
endi
if $data63 != bbb then
print =====data63=$data63
return -1
endi
sql insert into t1 values(1648791212000,5,5,5,5.0,'eee');
sql insert into t1 values(1648791207000,6,6,6,6.0,'fff') (1648791209000,7,7,7,7.0,'ggg') (1648791219000,8,8,8,8.0,'hhh') (1648791221000,9,9,9,9.0,'iii');
sql create stable st(ts timestamp, a int, b int , c int, d double, s varchar(20)) tags(ta int,tb int,tc int);
sql create table t1 using st tags(1,1,1);
sql create table t2 using st tags(2,2,2);
sql create stream streams1 trigger at_once into streamt1 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(NULL);
sql create stream streams2 trigger at_once into streamt2 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(value,100,200,300);
sql create stream streams3 trigger at_once into streamt3 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(next);
sql create stream streams4 trigger at_once into streamt4 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(prev);
sql create stream streams5 trigger at_once into streamt5 as select _wstart as ts, max(a) c1, sum(b), count(*) from st where ts >= 1648791210000 and ts < 1648791261000 partition by ta interval(1s) fill(linear);
sql insert into t1 values(1648791210000,0,0,0,0.0,'aaa');
sql insert into t1 values(1648791213000,1,1,1,1.0,'bbb');
sql insert into t1 values(1648791215000,5,5,5,5.0,'ccc');
sql insert into t1 values(1648791216000,6,6,6,6.0,'ddd');
sql insert into t2 values(1648791210000,7,0,0,0.0,'aaa');
sql insert into t2 values(1648791213000,8,1,1,1.0,'bbb');
sql insert into t2 values(1648791215000,9,5,5,5.0,'ccc');
sql insert into t2 values(1648791216000,10,6,6,6.0,'ddd');
$loop_count = 0
loop2:
sleep 200
$loop_count = $loop_count + 1
if $loop_count == 10 then
return -1
endi
sql select * from streamt1 order by group_id, ts;
if $rows != 14 then
print ====streamt1=rows1=$rows
goto loop2
endi
sql select * from streamt2 order by group_id, ts;
if $rows != 14 then
print ====streamt2=rows2=$rows
goto loop2
endi
sql select * from streamt3 order by group_id, ts;
if $rows != 14 then
print ====streamt3=rows3=$rows
goto loop2
endi
sql select * from streamt4 order by group_id, ts;
if $rows != 14 then
print ====streamt4=rows4=$rows
goto loop2
endi
sql select * from streamt5 order by group_id, ts;
if $rows != 14 then
print ====streamt5=rows5=$rows
goto loop2
endi
sql delete from t1 where ts = 1648791216000;
print ======delete from t1 where ts = 1648791216000;