@@ -374,7 +374,7 @@ The following is the content of a typical query JSON example file.
...
@@ -374,7 +374,7 @@ The following is the content of a typical query JSON example file.
}
}
```
```
The following parameters are specific to the query in the JSON file.
The following parameters are specific to the query in the JSON file.
```
"query_times": the number of queries per query type
"query_times": the number of queries per query type
"query_mode": query data interface, "tosc": call TDengine's c interface; "resetful": use restfule interface. Options are available. Default is "taosc".
"query_mode": query data interface, "tosc": call TDengine's c interface; "resetful": use restfule interface. Options are available. Default is "taosc".
"specified_table_query": { query for the specified table
"specified_table_query": { query for the specified table
...
@@ -389,7 +389,7 @@ The following parameters are specific to the query in the JSON file.
...
@@ -389,7 +389,7 @@ The following parameters are specific to the query in the JSON file.
"threads": the number of threads to execute sqls concurrently, optional, default is 1. Each thread is responsible for a part of sub-tables and executes all sqls.
"threads": the number of threads to execute sqls concurrently, optional, default is 1. Each thread is responsible for a part of sub-tables and executes all sqls.
"sql": "select count(*) from xxxx". Query statement for all sub-tables in the super table, where the table name must be written as "xxxx" and the instance will be replaced with the sub-table name automatically.
"sql": "select count(*) from xxxx". Query statement for all sub-tables in the super table, where the table name must be written as "xxxx" and the instance will be replaced with the sub-table name automatically.
"result": the name of the file to which the query result is written. Optional, the default is null, which means the query results are not written to a file.
"result": the name of the file to which the query result is written. Optional, the default is null, which means the query results are not written to a file.
```
The following is a typical subscription JSON example file content.
The following is a typical subscription JSON example file content.
```
```
...
@@ -432,13 +432,13 @@ The following is a typical subscription JSON example file content.
...
@@ -432,13 +432,13 @@ The following is a typical subscription JSON example file content.
}
}
```
```
The following are the meanings of the parameters specific to the subscription function.
The following are the meanings of the parameters specific to the subscription function.
```
"interval": interval for executing subscriptions, in seconds. Optional, default is 0.
"interval": interval for executing subscriptions, in seconds. Optional, default is 0.
"restart": subscription restart." yes": restart the subscription if it already exists, "no": continue the previous subscription. (Please note that the executing user needs to have read/write access to the dataDir directory)
"restart": subscription restart." yes": restart the subscription if it already exists, "no": continue the previous subscription. (Please note that the executing user needs to have read/write access to the dataDir directory)
"keepProgress": keep the progress of the subscription information. yes means keep the subscription information, no means don't keep it. The value is yes and restart is no to continue the previous subscriptions.
"keepProgress": keep the progress of the subscription information. yes means keep the subscription information, no means don't keep it. The value is yes and restart is no to continue the previous subscriptions.
"resubAfterConsume": Used in conjunction with keepProgress to call unsubscribe after the subscription has been consumed the appropriate number of times and to subscribe again.
"resubAfterConsume": Used in conjunction with keepProgress to call unsubscribe after the subscription has been consumed the appropriate number of times and to subscribe again.
"result": the name of the file to which the query result is written. Optional, default is null, means the query result will not be written to the file. Note: The file to save the result after each sql statement cannot be renamed, and the file name will be appended with the thread number when generating the result file.
"result": the name of the file to which the query result is written. Optional, default is null, means the query result will not be written to the file. Note: The file to save the result after each sql statement cannot be renamed, and the file name will be appended with the thread number when generating the result file.
```
Conclusion
Conclusion
--
--
TDengine is a big data platform designed and optimized for IoT, Telematics, Industrial Internet, DevOps, etc. TDengine shows a high performance that far exceeds similar products due to the innovative data storage and query engine design in the database kernel. And withSQL syntax support and connectors for multiple programming languages (currently Java, Python, Go, C#, NodeJS, Rust, etc. are supported), it is extremely easy to use and has zero learning cost. To facilitate the operation and maintenance needs, we also provide data migration and monitoring functions and other related ecological tools and software.
TDengine is a big data platform designed and optimized for IoT, Telematics, Industrial Internet, DevOps, etc. TDengine shows a high performance that far exceeds similar products due to the innovative data storage and query engine design in the database kernel. And withSQL syntax support and connectors for multiple programming languages (currently Java, Python, Go, C#, NodeJS, Rust, etc. are supported), it is extremely easy to use and has zero learning cost. To facilitate the operation and maintenance needs, we also provide data migration and monitoring functions and other related ecological tools and software.
case1<pxiao>: [TS-854] normal table batch insert with binding same table, different number of columns and timestamp in ascending order
case2<pxiao>: [TS-854] normal table batch insert with binding same table, different number of columns and timestamp in descending order
case3<pxiao>: [TS-854] normal table batch insert with binding same table, different number of columns and timestamp out of order
case4<pxiao>: [TS-854] normal table batch insert with binding same table, different number of columns and same timestamp
case5<pxiao>: [TS-854] normal table batch insert with binding different tables, different number of columns and timestamp in ascending order
case6<pxiao>: [TS-854] normal table batch insert with binding different tables, different number of columns and timestamp in descending order
case7<pxiao>: [TS-854] normal table batch insert with binding different tables, different number of columns and timestamp out of order
case8<pxiao>: [TS-854] normal table batch insert with binding different tables, different number of columns and same timestamp
case9<pxiao>: [TS-854] sub table batch insert with binding same table, different number of columns and timestamp in ascending order
case10<pxiao>: [TS-854] sub table batch insert with binding same table, different number of columns and timestamp in descending order
case11<pxiao>: [TS-854] sub table batch insert with binding same table, different number of columns and timestamp out of order
case12<pxiao>: [TS-854] sub table batch insert with binding same table, different number of columns and same timestamp
case13<pxiao>: [TS-854] sub table batch insert with binding different tables, different number of columns and timestamp in ascending order
case14<pxiao>: [TS-854] sub table batch insert with binding different tables, different number of columns and timestamp in descending order
case15<pxiao>: [TS-854] sub table batch insert with binding different tables, different number of columns and timestamp out of order
case16<pxiao>: [TS-854] sub table batch insert with binding different tables, different number of columns and same timestamp
case17<pxiao>: [TS-854] sub table batch insert with binding same table, different number of columns, different number of tags and timestamp in ascending order
case18<pxiao>: [TS-854] sub table batch insert with binding same table, different number of columns, different number of tags and timestamp in descending order
case19<pxiao>: [TS-854] sub table batch insert with binding same table, different number of columns, different number of tags and timestamp out of order
case20<pxiao>: [TS-854] sub table batch insert with binding same table, different number of columns, different number of tags and same timestamp
case21<pxiao>: [TS-854] sub table batch insert with binding different tables, different number of columns, different number of tags and timestamp in ascending order
case22<pxiao>: [TS-854] sub table batch insert with binding different tables, different number of columns, different number of tags and timestamp in descending order
case23<pxiao>: [TS-854] sub table batch insert with binding different tables, different number of columns, different number of tags and timestamp out of order
case24<pxiao>: [TS-854] sub table batch insert with binding different tables, different number of columns, different number of tags and same timestamp
tdSql.query("select jtag from jsons1 where jtag->'k1'=''")
tdSql.checkRows(1)
tdSql.query("select jtag from jsons1 where jtag->'k2'=true")
tdSql.checkRows(1)
tdSql.query("select jtag from jsons1 where jtag is null")
tdSql.checkRows(4)
tdSql.query("select jtag from jsons1 where jtag is not null")
tdSql.checkRows(6)
tdSql.query("select * from jsons1 where jtag->'location' is not null")
tdSql.checkRows(3)
tdSql.query("select tbname,jtag from jsons1 where jtag->'location' is null")
tdSql.checkRows(7)
tdSql.query("select * from jsons1 where jtag->'num' is not null")
tdSql.checkRows(2)
tdSql.query("select * from jsons1 where jtag->'location'='null'")
tdSql.checkRows(0)
tdSql.error("select * from jsons1 where jtag->'num'='null'")
# test distinct
tdSql.query("select distinct jtag from jsons1")
tdSql.checkRows(7)
tdSql.query("select distinct jtag->'location' from jsons1")
tdSql.checkRows(2)
# test chinese
tdSql.execute("CREATE TABLE if not exists jsons1_11 using jsons1 tags('{\"k1\":\"中国\",\"k5\":\"是是是\"}')")
tdSql.query("select tbname,jtag from jsons1 where jtag->'k1' match '中'")
tdSql.checkRows(1)
tdSql.query("select tbname,jtag from jsons1 where jtag->'k1'='中国'")
tdSql.checkRows(1)
#test dumplicate key with normal colomn
tdSql.execute("INSERT INTO jsons1_12 using jsons1 tags('{\"tbname\":\"tt\",\"databool\":true,\"dataStr\":\"是是是\"}') values(now, 4, \"你就会\")")
tdSql.query("select *,tbname,jtag from jsons1 where jtag->'dataStr' match '是'")
tdSql.checkRows(1)
tdSql.query("select tbname,jtag->'tbname' from jsons1 where jtag->'tbname'='tt'")
tdSql.checkRows(1)
# test filter : and /or / in/ like
tdSql.query("select * from jsons1 where jtag->'num' is not null or jtag?'class' and jtag?'databool'")
tdSql.checkRows(2)
tdSql.query("select * from jsons1 where jtag->'num' is not null and jtag?'class' or jtag?'databool'")
tdSql.checkRows(1)
tdSql.checkData(0,1,4)
tdSql.query("select * from jsons1 where jtag->'num' is not null or jtag?'class' and jtag?'databool' and jtag->'k1' match '中' or jtag->'location' in ('beijing') and jtag->'location' like 'bei%'")
tdSql.checkRows(3)
tdSql.query("select * from jsons1 where datastr like '你就会' and ( jtag->'num' is not null or jtag?'tbname' and jtag?'databool' )")
tdSql.checkRows(1)
tdSql.checkData(0,1,4)
tdSql.error("select * from jsons1 where datastr like '你就会' and jtag->'num' is not null or jtag?'class' and jtag?'databool'")
tdSql.error("select * from jsons1 where datastr like '你就会' or jtag->'num' is not null or jtag?'class' and jtag?'databool' and jtag->'k1' match '中' or jtag->'location' in ('beijing') and jtag->'location' like 'bei%' ")
tdSql.query("select * from jsons1 where datastr like '你就会' and (jtag->'num' is not null or jtag?'class' and jtag?'databool' and jtag->'k1' match '中' or jtag->'location' in ('beijing') and jtag->'location' like 'bei%' )")
tdSql.checkRows(0)
tdSql.error("select *,tbname,jtag from jsons1 where dataBool=true")
# test error
tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags(3333)")
tdSql.execute("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"1loc\":\"fff\",\";id\":5}')")
tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"。loc\":\"fff\",\"fsd\":5}')")
tdSql.error("CREATE TABLE if not exists jsons1_13 using jsons1 tags('{\"试试\":\"fff\",\";id\":5}')")
tdSql.error("insert into jsons1_13 using jsons1 tags(3)")
# test query normal column,tag and tbname
tdSql.execute("create stable if not exists jsons3(ts timestamp, dataInt3 int(100), dataBool3 bool, dataStr3 nchar(50)) tags(jtag3 json)")
tdSql.execute("create table jsons3_2 using jsons3 tags('{\"t\":true,\"t123\":123,\"\":\"true\"}')")
tdSql.execute("create table jsons3_3 using jsons3 tags('{\"t\":true,\"t123\":456,\"k1\":true,\"str1\":\"111\"}')")
tdSql.execute("insert into jsons3_3 values(now, 4, true, 'test')")
tdSql.execute("insert into jsons3_4 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":false,\"s\":null,\"str1\":\"112\"}') values(now, 5, true, 'test')")
tdSql.query("select * from jsons3 where jtag3->'k1'=true")
tdSql.checkRows(1)
tdSql.error("select jtag3->k1 from jsons3 ")
tdSql.error("select jtag3 from jsons3 where jtag3->'k1'")
tdSql.error("select jtag3 from jsons3 where jtag3?'k1'=true")
tdSql.error("select jtag3?'k1' from jsons3;")
tdSql.error("select jtag3?'k1'=true from jsons3;")
tdSql.error("select jtag3->'k1'=true from jsons3;")
tdSql.error("insert into jsons3_5 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":1,\"s\":null}') values(now, 5, true, 'test')")
tdSql.execute("insert into jsons3_5 using jsons3 tags('{\"t\":true,\"t123\":012,\"k2\":null,\"s\":null}') values(now, 5, true, 'test')")
tdSql.execute("insert into jsons3_6 using jsons3 tags('{\"t\":true,\"t123\":789,\"k1\":false,\"s\":null}') values(now, 5, true, 'test')")
tdSql.query("select jtag3 from jsons3 where jtag3->'t123'=12 or jtag3?'k1'")
tdSql.checkRows(4)
tdSql.query("select distinct jtag3 from jsons3 where jtag3->'t123'=12 or jtag3?'k1'")
tdSql.checkRows(4)
tdSql.execute("INSERT INTO jsons1_14 using jsons1 tags('{\"tbname\":\"tt\",\"location\":\"tianjing\",\"dataStr\":\"是是是\"}') values(now,5, \"你就会\")")
tdSql.query("select ts,jtag->'tbname',tbname from jsons1 where dataint>=1 and jtag->'location' in ('tianjing','123') and jtag?'tbname'")
tdSql.checkRows(1)
tdSql.checkData(0,1,'\"tt\"')
tdSql.query("select ts,jtag->'tbname',tbname from jsons1 where dataint between 1 and 5 and jtag->'location' in ('tianjing','123')")
tdSql.checkRows(1)
tdSql.checkData(0,2,'jsons1_14')
tdSql.query("select ts,jtag3->'tbname', jtag3->'str1',tbname from jsons3 where jtag3->'t123' between 456 and 789 and jtag3->'str1' like '11%' ")
tdSql.checkRows(2)
foriinrange(1):
iftdSql.queryResult[i][1]=='jsons3_3':
tdSql.checkData(i,2,111)
tdSql.query("select jtag3->'',dataint3 from jsons3")
tdSql.checkRows(4)
foriinrange(4):
iftdSql.queryResult[i][1]==4:
tdSql.checkData(i,0,None)
tdSql.query("select tbname,dataint3,jtag3->'k1' from jsons3;")
tdSql.checkRows(4)
foriinrange(3):
iftdSql.queryResult[i][1]==4:
tdSql.checkData(i,2,'true')
# Select_exprs is SQL function -Aggregation function , tests includes group by and order by
tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by jtag->'location';")
tdSql.checkData(2,3,'\"tianjing\"')
tdSql.checkRows(3)
foriinrange(2):
iftdSql.queryResult[i][3]=='\"beijing\"':
tdSql.checkData(i,0,1)
tdSql.checkData(i,1,3)
# tdSql.query("select avg(dataInt) as 123 ,count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by 123")
# tdSql.query("select avg(dataInt) as avgdata ,count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by avgdata ;")
tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'location' order by ts;")
tdSql.checkRows(3)
#tdSql.query("select avg(dataInt),count(dataint),sum(dataint) from jsons1 group by jtag->'age' order by tbname;")
#tdSql.checkRows(2)
tdSql.error("select avg(dataInt) from jsons1 group by jtag->'location' order by dataInt;")
tdSql.error("select avg(dataInt),tbname from jsons1 group by jtag->'location' order by tbname;")
tdSql.execute("CREATE TABLE if not exists jsons1_15 using jsons1 tags('{\"tbname\":\"tt\",\"location\":\"beijing\"}')")
tdSql.execute("insert into jsons1_15 values(now+1s, 2, 'json1')")
tdSql.error("select twa(dataint) from jsons1 group by jtag->'location' order by jtag->'location';")
tdSql.error("select irate(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
# tdSql.query(" select stddev(dataint) from jsons1 group by jtag->'location';")
# tdSql.checkRows(2)
tdSql.query(" select stddev(dataint) from jsons1 where jtag->'location'='beijing';")
tdSql.checkRows(1)
tdSql.error(" select LEASTSQUARES(dataint,1,2) from jsons1_1 where jtag->'location' ='beijing' ;")
# Select_exprs is SQL function -Selection function
tdSql.query(" select min(dataint),jtag from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.checkData(0,0,1)
tdSql.query(" select max(dataint),jtag from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.checkData(0,0,12)
tdSql.query(" select first(*) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.query(" select last(*) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.error(" select last(*),jtag from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.query(" select last_row(*) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.query(" select apercentile(dataint,0) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.query(" select apercentile(dataint,50) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.query(" select apercentile(dataint,90) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.query(" select apercentile(dataint,100) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.query(" select apercentile(dataint,0,'t-digest') from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.query(" select apercentile(dataint,50,'t-digest') from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.query(" select apercentile(dataint,100,'t-digest') from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkRows(1)
tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location';")
#tdSql.query("select tbname,top(dataint,1) from jsons1 group by jtag->'location' order by tbname asc;")
#tdSql.query("select tbname,top(dataint,1) from jsons1 group by jtag->'location' order by tbname desc")
tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by jtag->'location' asc;")
tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by jtag->'location' desc;")
tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by ts desc;")
tdSql.query("select top(dataint,1) from jsons1 group by jtag->'location' order by ts asc;")
# tdSql.query("select top(dataint,100) from jsons1 group by jtag->'location';")
# tdSql.query("select bottom(dataint,1) from jsons1 group by jtag->'location';")
# tdSql.query("select bottom(dataint,100) from jsons1 group by jtag->'location';")
tdSql.execute("create table if not exists jsons_interp(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50)) tags(jtag json)")
tdSql.execute("insert into jsons_interp_1 using jsons_interp tags('{\"nv\":null,\"tea\":true,\"\":false,\"rate\":456,\"tea\":false}') values ('2021-07-25 02:19:54.119',2,'true',0.9,0.1,'123')")
tdSql.execute("insert into jsons_interp_1 values ('2021-07-25 02:19:54.219',3,'true',-4.8,-5.5,'123') ")
tdSql.execute("insert into jsons_interp_2 using jsons_interp tags('{\"nv\":null,\"tea\":true,\"level\":\"123456\",\"rate\":123,\"tea\":false}') values ('2021-07-25 02:19:54.319',4,'true',0.9,0.1,'123')")
tdSql.execute("insert into jsons_interp_2 values ('2021-07-25 02:19:54.419',5,'true',-5.1,1.3,'123') ")
#tdSql.query(" select interp(dataint) from jsons_interp where jtag->'rate' in (123,456) and ts >= '2021-07-25 02:19:53.19' and ts<= '2021-07-25 02:19:54.519' every(100a) ;")
#tdSql.query(" select interp(dataint) from jsons_interp where jtag->'rate'=123 and ts >= '2021-07-25 02:19:53.19' and ts<= '2021-07-25 02:19:54.519' every(100a) ;")
#tdSql.query(" select interp(dataint) from jsons_interp where ts >= '2021-07-25 02:19:53.19' and ts<= '2021-07-25 02:19:54.519' every(100a) ;")
# tdSql.checkData(0,0,1)
# tdSql.checkRows(1)
# Select_exprs is SQL function -Calculation function
tdSql.error(" select diff(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.error(" select Derivative(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.query(" select SPREAD(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.checkData(0,0,11)
tdSql.query(" select ceil(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.query(" select floor(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
tdSql.query(" select round(dataint) from jsons1 where jtag->'location' in ('beijing','tianjing') or jtag?'num' or jtag->'age'=35 ;")
#need insert new data --data type is double or float and tests ceil floor round .
tdSql.execute("create table if not exists jsons7(ts timestamp, dataInt int, dataBool bool, datafloat float, datadouble double,dataStr nchar(50)) tags(jtag json)")
tdSql.execute("insert into jsons7_1 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\"\":123,\"tea\":false}') values (now,2,'true',0.9,0.1,'123')")
tdSql.query("select * from jsons7 where jtag->'tea'=0 ;")
tdSql.checkRows(0)
tdSql.query("select * from jsons7 where jtag->'tea'=3;")
# tdSql.checkRows(0)
tdSql.execute("insert into jsons7_1 values (now+1s,3,'true',-4.8,-5.5,'123') ")
tdSql.execute("insert into jsons7_1 values (now+2s,4,'true',1.9998,2.00001,'123') ")
tdSql.execute("insert into jsons7_2 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\"tag\":123,\"tea\":false}') values (now,5,'true',4.01,2.2,'123') ")
tdSql.execute("insert into jsons7_2 (ts,datadouble) values (now+3s,-0.9) ")
tdSql.execute("insert into jsons7_2 (ts,datadouble) values (now+4s,-2.9) ")
tdSql.execute("insert into jsons7_2 (ts,datafloat) values (now+1s,-0.9) ")
tdSql.execute("insert into jsons7_2 (ts,datafloat) values (now+2s,-1.9) ")
# tdSql.execute("CREATE TABLE if not exists jsons7_3 using jsons7 tags('{\"nv\":null,\"tea\":true,\"\":false,\"tag\":4569\"tea\":false}') ")
tdSql.query("select ts,ceil(dataint),ceil(datafloat),ceil(datadouble) from jsons7 where jtag?'tea';")
tdSql.query("select ceil(dataint),ceil(datafloat),ceil(datadouble) from jsons7 where jtag?'tea';")
tdSql.query("select ts,floor(dataint),floor(datafloat),floor(datadouble) from jsons7 where jtag?'tea';")
tdSql.query("select floor(dataint),floor(datafloat),floor(datadouble) from jsons7 where jtag?'tea';")
tdSql.query("select ts,round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag?'tea';")
tdSql.query("select round(dataint),round(datafloat),round(datadouble) from jsons7 where jtag?'tea';")
# test join
tdSql.execute("create table if not exists jsons6(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)")
tdSql.execute("create table if not exists jsons5(ts timestamp, dataInt int, dataBool bool, dataStr nchar(50)) tags(jtag json)")
tdSql.execute("CREATE TABLE if not exists jsons6_1 using jsons6 tags('{\"loc\":\"fff\",\"id\":6,\"user\":\"ffc\"}')")
tdSql.execute("CREATE TABLE if not exists jsons6_2 using jsons6 tags('{\"loc\":\"ffc\",\"id\":5}')")
tdSql.execute("insert into jsons6_1 values ('2020-04-18 15:00:00.000', 1, false, 'json1')")
tdSql.execute("insert into jsons6_2 values ('2020-04-18 15:00:01.000', 2, false, 'json1')")
tdSql.execute("insert into jsons5_1 using jsons5 tags('{\"loc\":\"fff\",\"num\":5,\"location\":\"beijing\"}') values ('2020-04-18 15:00:00.000', 2, true, 'json2')")
tdSql.execute("insert into jsons5_2 using jsons5 tags('{\"loc\":\"fff\",\"id\":5,\"location\":\"beijing\"}') values ('2020-04-18 15:00:01.000', 2, true, 'json2')")
tdSql.error("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'loc'=b.jtag->'loc'")
tdSql.error("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'user'=b.jtag->'loc';")
tdSql.query("select 'sss',33,a.jtag->'loc' from jsons6 a,jsons5 b where a.ts=b.ts and a.jtag->'id'=b.jtag->'id'")
tdSql.checkData(0,0,"sss")
tdSql.checkData(0,2,"\"ffc\"")
#nested query
tdSql.query("select jtag->'tag' from (select tbname,jtag,ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag?'tea') where cdata=3 ")
# tdSql.query("select * from (select tbname,jtag,ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag?'tea') where cdata=3 ")
# tdSql.query("select jtag from (select tbname,jtag,ts,ceil(dataint) as cdata,ceil(datafloat) ,ceil(datadouble) from jsons7 where jtag?'tea') where jtag->'tag'=123 ")
# query child table
# tdSql.error("select * from jsons3_2 where jtag3->'k1'=true;")