Merge branch 'develop' into fix/TD-5578

This commit is contained in:
wangmm0220 2021-08-05 15:52:10 +08:00
commit 7f9710effe
123 changed files with 9395 additions and 1966 deletions

6
Jenkinsfile vendored
View File

@ -41,6 +41,7 @@ def pre_test(){
sh ''' sh '''
killall -9 taosd ||echo "no taosd running" killall -9 taosd ||echo "no taosd running"
killall -9 gdb || echo "no gdb running" killall -9 gdb || echo "no gdb running"
killall -9 python3.8 || echo "no python program running"
cd ${WKC} cd ${WKC}
git reset --hard HEAD~10 >/dev/null git reset --hard HEAD~10 >/dev/null
''' '''
@ -223,12 +224,14 @@ pipeline {
steps { steps {
pre_test() pre_test()
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
timeout(time: 60, unit: 'MINUTES'){
sh ''' sh '''
cd ${WKC}/tests/pytest cd ${WKC}/tests/pytest
./crash_gen.sh -a -p -t 4 -s 2000 ./crash_gen.sh -a -p -t 4 -s 2000
''' '''
} }
}
timeout(time: 60, unit: 'MINUTES'){
sh ''' sh '''
cd ${WKC}/tests/pytest cd ${WKC}/tests/pytest
rm -rf /var/lib/taos/* rm -rf /var/lib/taos/*
@ -241,6 +244,7 @@ pipeline {
rm -rf /var/log/taos/* rm -rf /var/log/taos/*
./handle_taosd_val_log.sh ./handle_taosd_val_log.sh
''' '''
}
timeout(time: 45, unit: 'MINUTES'){ timeout(time: 45, unit: 'MINUTES'){
sh ''' sh '''
date date

View File

@ -4,7 +4,7 @@ PROJECT(TDengine)
IF (DEFINED VERNUMBER) IF (DEFINED VERNUMBER)
SET(TD_VER_NUMBER ${VERNUMBER}) SET(TD_VER_NUMBER ${VERNUMBER})
ELSE () ELSE ()
SET(TD_VER_NUMBER "2.1.5.0") SET(TD_VER_NUMBER "2.1.6.0")
ENDIF () ENDIF ()
IF (DEFINED VERCOMPATIBLE) IF (DEFINED VERCOMPATIBLE)

View File

@ -126,7 +126,7 @@ taos> source <filename>;
$ taosdemo $ taosdemo
``` ```
该命令将在数据库 test 下面自动创建一张超级表 meters该超级表下有 1 万张表,表名为 "d0" 到 "d9999",每张表有 1 万条记录,每条记录有 (ts, current, voltage, phase) 四个字段,时间戳从 "2017-07-14 10:40:00 000" 到 "2017-07-14 10:40:09 999",每张表带有标签 location 和 groupdIdgroupdId 被设置为 1 到 10 location 被设置为 "beijing" 或者 "shanghai"。 该命令将在数据库 test 下面自动创建一张超级表 meters该超级表下有 1 万张表,表名为 "d0" 到 "d9999",每张表有 1 万条记录,每条记录有 (ts, current, voltage, phase) 四个字段,时间戳从 "2017-07-14 10:40:00 000" 到 "2017-07-14 10:40:09 999",每张表带有标签 location 和 groupIdgroupId 被设置为 1 到 10 location 被设置为 "beijing" 或者 "shanghai"。
执行这条命令大概需要几分钟,最后共插入 1 亿条记录。 执行这条命令大概需要几分钟,最后共插入 1 亿条记录。
@ -150,10 +150,10 @@ taos> select avg(current), max(voltage), min(phase) from test.meters;
taos> select count(*) from test.meters where location="beijing"; taos> select count(*) from test.meters where location="beijing";
``` ```
- 查询 groupdId=10 的所有记录的平均值、最大值、最小值等: - 查询 groupId=10 的所有记录的平均值、最大值、最小值等:
```mysql ```mysql
taos> select avg(current), max(voltage), min(phase) from test.meters where groupdId=10; taos> select avg(current), max(voltage), min(phase) from test.meters where groupId=10;
``` ```
- 对表 d10 按 10s 进行平均值、最大值和最小值聚合统计: - 对表 d10 按 10s 进行平均值、最大值和最小值聚合统计:

View File

@ -33,7 +33,7 @@ USE power;
一个物联网系统往往存在多种类型的设备比如对于电网存在智能电表、变压器、母线、开关等等。为便于多表之间的聚合使用TDengine, 需要对每个类型的数据采集点创建一超级表。以表一中的智能电表为例可以使用如下的SQL命令创建超级表 一个物联网系统往往存在多种类型的设备比如对于电网存在智能电表、变压器、母线、开关等等。为便于多表之间的聚合使用TDengine, 需要对每个类型的数据采集点创建一超级表。以表一中的智能电表为例可以使用如下的SQL命令创建超级表
```mysql ```mysql
CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int); CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);
``` ```
**注意:**这一指令中的 STABLE 关键字,在 2.0.15 之前的版本中需写作 TABLE 。 **注意:**这一指令中的 STABLE 关键字,在 2.0.15 之前的版本中需写作 TABLE 。

View File

@ -17,7 +17,7 @@ TDengine提供的连续查询与普通流计算中的时间窗口计算具有以
下面以智能电表场景为例介绍连续查询的具体使用方法。假设我们通过下列SQL语句创建了超级表和子表 下面以智能电表场景为例介绍连续查询的具体使用方法。假设我们通过下列SQL语句创建了超级表和子表
```sql ```sql
create table meters (ts timestamp, current float, voltage int, phase float) tags (location binary(64), groupdId int); create table meters (ts timestamp, current float, voltage int, phase float) tags (location binary(64), groupId int);
create table D1001 using meters tags ("Beijing.Chaoyang", 2); create table D1001 using meters tags ("Beijing.Chaoyang", 2);
create table D1002 using meters tags ("Beijing.Haidian", 2); create table D1002 using meters tags ("Beijing.Haidian", 2);
... ...

View File

@ -143,7 +143,7 @@ taosd -C
TDengine集群中加入一个新的dnode时涉及集群相关的一些参数必须与已有集群的配置相同否则不能成功加入到集群中。会进行校验的参数如下 TDengine集群中加入一个新的dnode时涉及集群相关的一些参数必须与已有集群的配置相同否则不能成功加入到集群中。会进行校验的参数如下
- numOfMnodes系统中管理节点个数。默认值3。 - numOfMnodes系统中管理节点个数。默认值3。2.0 版本从 2.0.20.11 开始、2.1 及以上版本从 2.1.6.0 开始numOfMnodes 默认值改为 1。
- mnodeEqualVnodeNum: 一个mnode等同于vnode消耗的个数。默认值4。 - mnodeEqualVnodeNum: 一个mnode等同于vnode消耗的个数。默认值4。
- offlineThreshold: dnode离线阈值超过该时间将导致该dnode从集群中删除。单位为秒默认值86400*10即10天 - offlineThreshold: dnode离线阈值超过该时间将导致该dnode从集群中删除。单位为秒默认值86400*10即10天
- statusInterval: dnode向mnode报告状态时长。单位为秒默认值1。 - statusInterval: dnode向mnode报告状态时长。单位为秒默认值1。

View File

@ -34,7 +34,7 @@ taos> DESCRIBE meters;
- 时间格式为 ```YYYY-MM-DD HH:mm:ss.MS```,默认时间分辨率为毫秒。比如:```2017-08-12 18:25:58.128``` - 时间格式为 ```YYYY-MM-DD HH:mm:ss.MS```,默认时间分辨率为毫秒。比如:```2017-08-12 18:25:58.128```
- 内部函数 now 是客户端的当前时间 - 内部函数 now 是客户端的当前时间
- 插入记录时,如果时间戳为 now插入数据时使用提交这条记录的客户端的当前时间 - 插入记录时,如果时间戳为 now插入数据时使用提交这条记录的客户端的当前时间
- Epoch Time时间戳也可以是一个长整数表示从 1970-01-01 08:00:00.000 开始的毫秒数 - Epoch Time时间戳也可以是一个长整数表示从格林威治时间 1970-01-01 00:00:00.000 (UTC/GMT) 开始的毫秒数(相应地,如果所在 Database 的时间精度设置为“微秒”,则长整型格式的时间戳含义也就对应于从格林威治时间 1970-01-01 00:00:00.000 (UTC/GMT) 开始的微秒数)
- 时间可以加减,比如 now-2h表明查询时刻向前推 2 个小时(最近 2 小时)。数字后面的时间单位可以是 u(微秒)、a(毫秒)、s(秒)、m(分)、h(小时)、d(天)、w(周)。 比如 `select * from t1 where ts > now-2w and ts <= now-1w`表示查询两周前整整一周的数据。在指定降频操作down sampling的时间窗口interval时间单位还可以使用 n(自然月) 和 y(自然年)。 - 时间可以加减,比如 now-2h表明查询时刻向前推 2 个小时(最近 2 小时)。数字后面的时间单位可以是 u(微秒)、a(毫秒)、s(秒)、m(分)、h(小时)、d(天)、w(周)。 比如 `select * from t1 where ts > now-2w and ts <= now-1w`表示查询两周前整整一周的数据。在指定降频操作down sampling的时间窗口interval时间单位还可以使用 n(自然月) 和 y(自然年)。
TDengine 缺省的时间戳是毫秒精度,但通过在 CREATE DATABASE 时传递的 PRECISION 参数就可以支持微秒。 TDengine 缺省的时间戳是毫秒精度,但通过在 CREATE DATABASE 时传递的 PRECISION 参数就可以支持微秒。
@ -414,13 +414,13 @@ INSERT INTO
``` ```
也可以在自动建表时,只是指定部分 TAGS 列的取值,未被指定的 TAGS 列将置为 NULL。例如 也可以在自动建表时,只是指定部分 TAGS 列的取值,未被指定的 TAGS 列将置为 NULL。例如
```mysql ```mysql
INSERT INTO d21001 USING meters (groupdId) TAGS (2) VALUES ('2021-07-13 14:06:33.196', 10.15, 217, 0.33); INSERT INTO d21001 USING meters (groupId) TAGS (2) VALUES ('2021-07-13 14:06:33.196', 10.15, 217, 0.33);
``` ```
自动建表语法也支持在一条语句中向多个表插入记录。例如: 自动建表语法也支持在一条语句中向多个表插入记录。例如:
```mysql ```mysql
INSERT INTO d21001 USING meters TAGS ('Beijing.Chaoyang', 2) VALUES ('2021-07-13 14:06:34.630', 10.2, 219, 0.32) ('2021-07-13 14:06:35.779', 10.15, 217, 0.33) INSERT INTO d21001 USING meters TAGS ('Beijing.Chaoyang', 2) VALUES ('2021-07-13 14:06:34.630', 10.2, 219, 0.32) ('2021-07-13 14:06:35.779', 10.15, 217, 0.33)
d21002 USING meters (groupdId) TAGS (2) VALUES ('2021-07-13 14:06:34.255', 10.15, 217, 0.33) d21002 USING meters (groupId) TAGS (2) VALUES ('2021-07-13 14:06:34.255', 10.15, 217, 0.33)
d21003 USING meters (groupdId) TAGS (2) (ts, current, phase) VALUES ('2021-07-13 14:06:34.255', 10.27, 0.31); d21003 USING meters (groupId) TAGS (2) (ts, current, phase) VALUES ('2021-07-13 14:06:34.255', 10.27, 0.31);
``` ```
**说明:**在 2.0.20.5 版本之前,在使用自动建表语法并指定列时,子表的列名必须紧跟在子表名称后面,而不能如例子里那样放在 TAGS 和 VALUES 之间。从 2.0.20.5 版本开始,两种写法都可以,但不能在一条 SQL 语句中混用,否则会报语法错误。 **说明:**在 2.0.20.5 版本之前,在使用自动建表语法并指定列时,子表的列名必须紧跟在子表名称后面,而不能如例子里那样放在 TAGS 和 VALUES 之间。从 2.0.20.5 版本开始,两种写法都可以,但不能在一条 SQL 语句中混用,否则会报语法错误。

View File

@ -32,7 +32,7 @@ Replace the database operating in the current connection with “power”, other
An IoT system often has many types of devices, such as smart meters, transformers, buses, switches, etc. for power grids. In order to facilitate aggregation among multiple tables, using TDengine, it is necessary to create a STable for each type of data collection point. Taking the smart meter in Table 1 as an example, you can use the following SQL command to create a STable: An IoT system often has many types of devices, such as smart meters, transformers, buses, switches, etc. for power grids. In order to facilitate aggregation among multiple tables, using TDengine, it is necessary to create a STable for each type of data collection point. Taking the smart meter in Table 1 as an example, you can use the following SQL command to create a STable:
```mysql ```mysql
CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupdId int); CREATE STABLE meters (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);
``` ```
**Note:** The STABLE keyword in this instruction needs to be written as TABLE in versions before 2.0.15. **Note:** The STABLE keyword in this instruction needs to be written as TABLE in versions before 2.0.15.

View File

@ -17,7 +17,7 @@ The continuous query provided by TDengine differs from the time window calculati
The following is an example of the smart meter scenario to introduce the specific use of continuous query. Suppose we create a STables and sub-tables through the following SQL statement: The following is an example of the smart meter scenario to introduce the specific use of continuous query. Suppose we create a STables and sub-tables through the following SQL statement:
```sql ```sql
create table meters (ts timestamp, current float, voltage int, phase float) tags (location binary(64), groupdId int); create table meters (ts timestamp, current float, voltage int, phase float) tags (location binary(64), groupId int);
create table D1001 using meters tags ("Beijing.Chaoyang", 2); create table D1001 using meters tags ("Beijing.Chaoyang", 2);
create table D1002 using meters tags ("Beijing.Haidian", 2); create table D1002 using meters tags ("Beijing.Haidian", 2);
... ...

View File

@ -132,7 +132,7 @@ The SQL creates a database demo, each data file stores 10 days of data, the memo
When adding a new dnode to the TDengine cluster, some parameters related to the cluster must be the same as the configuration of the existing cluster, otherwise it cannot be successfully added to the cluster. The parameters that will be verified are as follows: When adding a new dnode to the TDengine cluster, some parameters related to the cluster must be the same as the configuration of the existing cluster, otherwise it cannot be successfully added to the cluster. The parameters that will be verified are as follows:
- numOfMnodes: the number of management nodes in the system. Default: 3. - numOfMnodes: the number of management nodes in the system. Default: 3. (Since version 2.0.20.11 and version 2.1.6.0, the default value of "numOfMnodes" has been changed to 1.)
- balance: whether to enable load balancing. 0: No, 1: Yes. Default: 1. - balance: whether to enable load balancing. 0: No, 1: Yes. Default: 1.
- mnodeEqualVnodeNum: an mnode is equal to the number of vnodes consumed. Default: 4. - mnodeEqualVnodeNum: an mnode is equal to the number of vnodes consumed. Default: 4.
- offlineThreshold: the threshold for a dnode to be offline, exceed which the dnode will be removed from the cluster. The unit is seconds, and the default value is 86400*10 (that is, 10 days). - offlineThreshold: the threshold for a dnode to be offline, exceed which the dnode will be removed from the cluster. The unit is seconds, and the default value is 86400*10 (that is, 10 days).

View File

@ -340,7 +340,7 @@ STableMeta* createSuperTableMeta(STableMetaMsg* pChild);
uint32_t tscGetTableMetaSize(STableMeta* pTableMeta); uint32_t tscGetTableMetaSize(STableMeta* pTableMeta);
CChildTableMeta* tscCreateChildMeta(STableMeta* pTableMeta); CChildTableMeta* tscCreateChildMeta(STableMeta* pTableMeta);
uint32_t tscGetTableMetaMaxSize(); uint32_t tscGetTableMetaMaxSize();
int32_t tscCreateTableMetaFromSTableMeta(STableMeta* pChild, const char* name, void* buf); int32_t tscCreateTableMetaFromSTableMeta(STableMeta** pChild, const char* name, size_t *tableMetaCapacity);
STableMeta* tscTableMetaDup(STableMeta* pTableMeta); STableMeta* tscTableMetaDup(STableMeta* pTableMeta);
SVgroupsInfo* tscVgroupsInfoDup(SVgroupsInfo* pVgroupsInfo); SVgroupsInfo* tscVgroupsInfoDup(SVgroupsInfo* pVgroupsInfo);

View File

@ -84,8 +84,6 @@ int tsParseTime(SStrToken *pToken, int64_t *time, char **next, char *error, int1
int64_t useconds = 0; int64_t useconds = 0;
char * pTokenEnd = *next; char * pTokenEnd = *next;
index = 0;
if (pToken->type == TK_NOW) { if (pToken->type == TK_NOW) {
useconds = taosGetTimestamp(timePrec); useconds = taosGetTimestamp(timePrec);
} else if (strncmp(pToken->z, "0", 1) == 0 && pToken->n == 1) { } else if (strncmp(pToken->z, "0", 1) == 0 && pToken->n == 1) {
@ -130,7 +128,8 @@ int tsParseTime(SStrToken *pToken, int64_t *time, char **next, char *error, int1
return tscInvalidOperationMsg(error, "value expected in timestamp", sToken.z); return tscInvalidOperationMsg(error, "value expected in timestamp", sToken.z);
} }
if (parseAbsoluteDuration(valueToken.z, valueToken.n, &interval, timePrec) != TSDB_CODE_SUCCESS) { char unit = 0;
if (parseAbsoluteDuration(valueToken.z, valueToken.n, &interval, &unit, timePrec) != TSDB_CODE_SUCCESS) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }

View File

@ -458,9 +458,9 @@ int32_t loadTableMeta(TAOS* taos, char* tableName, SSmlSTableSchema* schema, SSm
schema->tagHash = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); schema->tagHash = taosHashInit(8, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false);
schema->fieldHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); schema->fieldHash = taosHashInit(64, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false);
uint32_t size = tscGetTableMetaMaxSize(); size_t size = 0;
STableMeta* tableMeta = calloc(1, size); STableMeta* tableMeta = NULL;
taosHashGetClone(tscTableMetaMap, fullTableName, strlen(fullTableName), NULL, tableMeta); taosHashGetCloneExt(tscTableMetaMap, fullTableName, strlen(fullTableName), NULL, (void **)&tableMeta, &size);
tstrncpy(schema->sTableName, tableName, strlen(tableName)+1); tstrncpy(schema->sTableName, tableName, strlen(tableName)+1);
schema->precision = tableMeta->tableInfo.precision; schema->precision = tableMeta->tableInfo.precision;
@ -1417,7 +1417,7 @@ static bool isTimeStamp(char *pVal, uint16_t len, SMLTimeStampType *tsType) {
return false; return false;
} }
static bool convertStrToNumber(TAOS_SML_KV *pVal, char*str) { static bool convertStrToNumber(TAOS_SML_KV *pVal, char*str, SSmlLinesInfo* info) {
errno = 0; errno = 0;
uint8_t type = pVal->type; uint8_t type = pVal->type;
int16_t length = pVal->length; int16_t length = pVal->length;
@ -1436,7 +1436,7 @@ static bool convertStrToNumber(TAOS_SML_KV *pVal, char*str) {
} }
if (errno == ERANGE) { if (errno == ERANGE) {
tscError("Converted number out of range"); tscError("SML:0x%"PRIx64" Convert number(%s) out of range", info->id, str);
return false; return false;
} }
@ -1518,7 +1518,7 @@ static bool convertStrToNumber(TAOS_SML_KV *pVal, char*str) {
} }
//len does not include '\0' from value. //len does not include '\0' from value.
static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value, static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
uint16_t len) { uint16_t len, SSmlLinesInfo* info) {
if (len <= 0) { if (len <= 0) {
return false; return false;
} }
@ -1528,7 +1528,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_TINYINT; pVal->type = TSDB_DATA_TYPE_TINYINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 2] = '\0'; value[len - 2] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1537,7 +1537,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_UTINYINT; pVal->type = TSDB_DATA_TYPE_UTINYINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 2] = '\0'; value[len - 2] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1546,7 +1546,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_SMALLINT; pVal->type = TSDB_DATA_TYPE_SMALLINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1555,7 +1555,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_USMALLINT; pVal->type = TSDB_DATA_TYPE_USMALLINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1564,7 +1564,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_INT; pVal->type = TSDB_DATA_TYPE_INT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1573,7 +1573,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_UINT; pVal->type = TSDB_DATA_TYPE_UINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1582,7 +1582,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_BIGINT; pVal->type = TSDB_DATA_TYPE_BIGINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1591,7 +1591,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_UBIGINT; pVal->type = TSDB_DATA_TYPE_UBIGINT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidInteger(value) || !convertStrToNumber(pVal, value)) { if (!isValidInteger(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1601,7 +1601,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_FLOAT; pVal->type = TSDB_DATA_TYPE_FLOAT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidFloat(value) || !convertStrToNumber(pVal, value)) { if (!isValidFloat(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1610,7 +1610,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
pVal->type = TSDB_DATA_TYPE_DOUBLE; pVal->type = TSDB_DATA_TYPE_DOUBLE;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
value[len - 3] = '\0'; value[len - 3] = '\0';
if (!isValidFloat(value) || !convertStrToNumber(pVal, value)) { if (!isValidFloat(value) || !convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1646,7 +1646,7 @@ static bool convertSmlValueType(TAOS_SML_KV *pVal, char *value,
if (isValidInteger(value) || isValidFloat(value)) { if (isValidInteger(value) || isValidFloat(value)) {
pVal->type = TSDB_DATA_TYPE_FLOAT; pVal->type = TSDB_DATA_TYPE_FLOAT;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
if (!convertStrToNumber(pVal, value)) { if (!convertStrToNumber(pVal, value, info)) {
return false; return false;
} }
return true; return true;
@ -1702,7 +1702,7 @@ static int32_t getTimeStampValue(char *value, uint16_t len,
} }
static int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value, static int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
uint16_t len) { uint16_t len, SSmlLinesInfo* info) {
int32_t ret; int32_t ret;
SMLTimeStampType type; SMLTimeStampType type;
int64_t tsVal; int64_t tsVal;
@ -1715,7 +1715,7 @@ static int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
if (ret) { if (ret) {
return ret; return ret;
} }
tscDebug("Timestamp after conversion:%"PRId64, tsVal); tscDebug("SML:0x%"PRIx64"Timestamp after conversion:%"PRId64, info->id, tsVal);
pVal->type = TSDB_DATA_TYPE_TIMESTAMP; pVal->type = TSDB_DATA_TYPE_TIMESTAMP;
pVal->length = (int16_t)tDataTypes[pVal->type].bytes; pVal->length = (int16_t)tDataTypes[pVal->type].bytes;
@ -1724,7 +1724,7 @@ static int32_t convertSmlTimeStamp(TAOS_SML_KV *pVal, char *value,
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index) { static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index, SSmlLinesInfo* info) {
const char *start, *cur; const char *start, *cur;
int32_t ret = TSDB_CODE_SUCCESS; int32_t ret = TSDB_CODE_SUCCESS;
int len = 0; int len = 0;
@ -1744,7 +1744,7 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index) {
memcpy(value, start, len); memcpy(value, start, len);
} }
ret = convertSmlTimeStamp(*pTS, value, len); ret = convertSmlTimeStamp(*pTS, value, len, info);
if (ret) { if (ret) {
free(value); free(value);
free(*pTS); free(*pTS);
@ -1757,7 +1757,7 @@ static int32_t parseSmlTimeStamp(TAOS_SML_KV **pTS, const char **index) {
return ret; return ret;
} }
static bool checkDuplicateKey(char *key, SHashObj *pHash) { static bool checkDuplicateKey(char *key, SHashObj *pHash, SSmlLinesInfo* info) {
char *val = NULL; char *val = NULL;
char *cur = key; char *cur = key;
char keyLower[TSDB_COL_NAME_LEN]; char keyLower[TSDB_COL_NAME_LEN];
@ -1771,7 +1771,7 @@ static bool checkDuplicateKey(char *key, SHashObj *pHash) {
val = taosHashGet(pHash, keyLower, keyLen); val = taosHashGet(pHash, keyLower, keyLen);
if (val) { if (val) {
tscError("Duplicate key:%s", keyLower); tscError("SML:0x%"PRIx64" Duplicate key detected:%s", info->id, keyLower);
return true; return true;
} }
@ -1781,19 +1781,19 @@ static bool checkDuplicateKey(char *key, SHashObj *pHash) {
return false; return false;
} }
static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash) { static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash, SSmlLinesInfo* info) {
const char *cur = *index; const char *cur = *index;
char key[TSDB_COL_NAME_LEN + 1]; // +1 to avoid key[len] over write char key[TSDB_COL_NAME_LEN + 1]; // +1 to avoid key[len] over write
uint16_t len = 0; uint16_t len = 0;
//key field cannot start with digit //key field cannot start with digit
if (isdigit(*cur)) { if (isdigit(*cur)) {
tscError("Tag key cannnot start with digit\n"); tscError("SML:0x%"PRIx64" Tag key cannnot start with digit", info->id);
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
} }
while (*cur != '\0') { while (*cur != '\0') {
if (len > TSDB_COL_NAME_LEN) { if (len > TSDB_COL_NAME_LEN) {
tscDebug("Key field cannot exceeds 65 characters"); tscError("SML:0x%"PRIx64" Key field cannot exceeds 65 characters", info->id);
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
} }
//unescaped '=' identifies a tag key //unescaped '=' identifies a tag key
@ -1810,20 +1810,20 @@ static int32_t parseSmlKey(TAOS_SML_KV *pKV, const char **index, SHashObj *pHash
} }
key[len] = '\0'; key[len] = '\0';
if (checkDuplicateKey(key, pHash)) { if (checkDuplicateKey(key, pHash, info)) {
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
} }
pKV->key = calloc(len + 1, 1); pKV->key = calloc(len + 1, 1);
memcpy(pKV->key, key, len + 1); memcpy(pKV->key, key, len + 1);
//tscDebug("Key:%s|len:%d", pKV->key, len); //tscDebug("SML:0x%"PRIx64" Key:%s|len:%d", info->id, pKV->key, len);
*index = cur + 1; *index = cur + 1;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index, static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index,
bool *is_last_kv) { bool *is_last_kv, SSmlLinesInfo* info) {
const char *start, *cur; const char *start, *cur;
char *value = NULL; char *value = NULL;
uint16_t len = 0; uint16_t len = 0;
@ -1847,7 +1847,9 @@ static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index,
value = calloc(len + 1, 1); value = calloc(len + 1, 1);
memcpy(value, start, len); memcpy(value, start, len);
value[len] = '\0'; value[len] = '\0';
if (!convertSmlValueType(pKV, value, len)) { if (!convertSmlValueType(pKV, value, len, info)) {
tscError("SML:0x%"PRIx64" Failed to convert sml value string(%s) to any type",
info->id, value);
//free previous alocated key field //free previous alocated key field
free(pKV->key); free(pKV->key);
pKV->key = NULL; pKV->key = NULL;
@ -1861,7 +1863,7 @@ static bool parseSmlValue(TAOS_SML_KV *pKV, const char **index,
} }
static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index, static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index,
uint8_t *has_tags) { uint8_t *has_tags, SSmlLinesInfo* info) {
const char *cur = *index; const char *cur = *index;
uint16_t len = 0; uint16_t len = 0;
@ -1870,7 +1872,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
return TSDB_CODE_TSC_OUT_OF_MEMORY; return TSDB_CODE_TSC_OUT_OF_MEMORY;
} }
if (isdigit(*cur)) { if (isdigit(*cur)) {
tscError("Measurement field cannnot start with digit"); tscError("SML:0x%"PRIx64" Measurement field cannnot start with digit", info->id);
free(pSml->stableName); free(pSml->stableName);
pSml->stableName = NULL; pSml->stableName = NULL;
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
@ -1878,7 +1880,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
while (*cur != '\0') { while (*cur != '\0') {
if (len > TSDB_TABLE_NAME_LEN) { if (len > TSDB_TABLE_NAME_LEN) {
tscError("Measurement field cannot exceeds 193 characters"); tscError("SML:0x%"PRIx64" Measurement field cannot exceeds 193 characters", info->id);
free(pSml->stableName); free(pSml->stableName);
pSml->stableName = NULL; pSml->stableName = NULL;
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
@ -1902,7 +1904,7 @@ static int32_t parseSmlMeasurement(TAOS_SML_DATA_POINT *pSml, const char **index
} }
pSml->stableName[len] = '\0'; pSml->stableName[len] = '\0';
*index = cur + 1; *index = cur + 1;
tscDebug("Stable name in measurement:%s|len:%d", pSml->stableName, len); tscDebug("SML:0x%"PRIx64" Stable name in measurement:%s|len:%d", info->id, pSml->stableName, len);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -1921,7 +1923,8 @@ static int32_t isValidChildTableName(const char *pTbName, int16_t len) {
static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs, static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
const char **index, bool isField, const char **index, bool isField,
TAOS_SML_DATA_POINT* smlData, SHashObj *pHash) { TAOS_SML_DATA_POINT* smlData, SHashObj *pHash,
SSmlLinesInfo* info) {
const char *cur = *index; const char *cur = *index;
int32_t ret = TSDB_CODE_SUCCESS; int32_t ret = TSDB_CODE_SUCCESS;
TAOS_SML_KV *pkv; TAOS_SML_KV *pkv;
@ -1941,14 +1944,14 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
} }
while (*cur != '\0') { while (*cur != '\0') {
ret = parseSmlKey(pkv, &cur, pHash); ret = parseSmlKey(pkv, &cur, pHash, info);
if (ret) { if (ret) {
tscError("Unable to parse key field"); tscError("SML:0x%"PRIx64" Unable to parse key", info->id);
goto error; goto error;
} }
ret = parseSmlValue(pkv, &cur, &is_last_kv); ret = parseSmlValue(pkv, &cur, &is_last_kv, info);
if (ret) { if (ret) {
tscError("Unable to parse value field"); tscError("SML:0x%"PRIx64" Unable to parse value", info->id);
goto error; goto error;
} }
if (!isField && if (!isField &&
@ -1966,7 +1969,6 @@ static int32_t parseSmlKvPairs(TAOS_SML_KV **pKVs, int *num_kvs,
*num_kvs += 1; *num_kvs += 1;
} }
if (is_last_kv) { if (is_last_kv) {
//tscDebug("last key-value field detected");
goto done; goto done;
} }
@ -2024,50 +2026,50 @@ static void moveTimeStampToFirstKv(TAOS_SML_DATA_POINT** smlData, TAOS_SML_KV *t
free(ts); free(ts);
} }
int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData) { int32_t tscParseLine(const char* sql, TAOS_SML_DATA_POINT* smlData, SSmlLinesInfo* info) {
const char* index = sql; const char* index = sql;
int32_t ret = TSDB_CODE_SUCCESS; int32_t ret = TSDB_CODE_SUCCESS;
uint8_t has_tags = 0; uint8_t has_tags = 0;
TAOS_SML_KV *timestamp = NULL; TAOS_SML_KV *timestamp = NULL;
SHashObj *keyHashTable = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false); SHashObj *keyHashTable = taosHashInit(128, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, false);
ret = parseSmlMeasurement(smlData, &index, &has_tags); ret = parseSmlMeasurement(smlData, &index, &has_tags, info);
if (ret) { if (ret) {
tscError("Unable to parse measurement"); tscError("SML:0x%"PRIx64" Unable to parse measurement", info->id);
taosHashCleanup(keyHashTable); taosHashCleanup(keyHashTable);
return ret; return ret;
} }
tscDebug("Parse measurement finished, has_tags:%d", has_tags); tscDebug("SML:0x%"PRIx64" Parse measurement finished, has_tags:%d", info->id, has_tags);
//Parse Tags //Parse Tags
if (has_tags) { if (has_tags) {
ret = parseSmlKvPairs(&smlData->tags, &smlData->tagNum, &index, false, smlData, keyHashTable); ret = parseSmlKvPairs(&smlData->tags, &smlData->tagNum, &index, false, smlData, keyHashTable, info);
if (ret) { if (ret) {
tscError("Unable to parse tag"); tscError("SML:0x%"PRIx64" Unable to parse tag", info->id);
taosHashCleanup(keyHashTable); taosHashCleanup(keyHashTable);
return ret; return ret;
} }
} }
tscDebug("Parse tags finished, num of tags:%d", smlData->tagNum); tscDebug("SML:0x%"PRIx64" Parse tags finished, num of tags:%d", info->id, smlData->tagNum);
//Parse fields //Parse fields
ret = parseSmlKvPairs(&smlData->fields, &smlData->fieldNum, &index, true, smlData, keyHashTable); ret = parseSmlKvPairs(&smlData->fields, &smlData->fieldNum, &index, true, smlData, keyHashTable, info);
if (ret) { if (ret) {
tscError("Unable to parse field"); tscError("SML:0x%"PRIx64" Unable to parse field", info->id);
taosHashCleanup(keyHashTable); taosHashCleanup(keyHashTable);
return ret; return ret;
} }
tscDebug("Parse fields finished, num of fields:%d", smlData->fieldNum); tscDebug("SML:0x%"PRIx64" Parse fields finished, num of fields:%d", info->id, smlData->fieldNum);
taosHashCleanup(keyHashTable); taosHashCleanup(keyHashTable);
//Parse timestamp //Parse timestamp
ret = parseSmlTimeStamp(&timestamp, &index); ret = parseSmlTimeStamp(&timestamp, &index, info);
if (ret) { if (ret) {
tscError("Unable to parse timestamp"); tscError("SML:0x%"PRIx64" Unable to parse timestamp", info->id);
return ret; return ret;
} }
moveTimeStampToFirstKv(&smlData, timestamp); moveTimeStampToFirstKv(&smlData, timestamp);
tscDebug("Parse timestamp finished"); tscDebug("SML:0x%"PRIx64" Parse timestamp finished", info->id);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -2104,7 +2106,7 @@ void destroySmlDataPoint(TAOS_SML_DATA_POINT* point) {
int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* failedLines, SSmlLinesInfo* info) { int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* failedLines, SSmlLinesInfo* info) {
for (int32_t i = 0; i < numLines; ++i) { for (int32_t i = 0; i < numLines; ++i) {
TAOS_SML_DATA_POINT point = {0}; TAOS_SML_DATA_POINT point = {0};
int32_t code = tscParseLine(lines[i], &point); int32_t code = tscParseLine(lines[i], &point, info);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
tscError("SML:0x%"PRIx64" data point line parse failed. line %d : %s", info->id, i, lines[i]); tscError("SML:0x%"PRIx64" data point line parse failed. line %d : %s", info->id, i, lines[i]);
destroySmlDataPoint(&point); destroySmlDataPoint(&point);

View File

@ -255,10 +255,25 @@ int tscBuildQueryStreamDesc(void *pMsg, STscObj *pObj) {
pQdesc->qId = htobe64(pSql->res.qId); pQdesc->qId = htobe64(pSql->res.qId);
pQdesc->sqlObjId = htobe64(pSql->self); pQdesc->sqlObjId = htobe64(pSql->self);
pQdesc->pid = pHeartbeat->pid; pQdesc->pid = pHeartbeat->pid;
if (pSql->cmd.pQueryInfo->stableQuery == true) { pQdesc->stableQuery = pSql->cmd.pQueryInfo->stableQuery;
pQdesc->numOfSub = pSql->subState.numOfSub; pQdesc->numOfSub = pSql->subState.numOfSub;
char *p = pQdesc->subSqlInfo;
int32_t remainLen = sizeof(pQdesc->subSqlInfo);
if (pQdesc->numOfSub == 0) {
snprintf(p, remainLen, "N/A");
} else { } else {
pQdesc->numOfSub = 1; int32_t len;
for (int32_t i = 0; i < pQdesc->numOfSub; ++i) {
len = snprintf(p, remainLen, "[%d]0x%" PRIx64 "(%c) ", i,
pSql->pSubs[i]->self,
pSql->subState.states[i] ? 'C' : 'I');
if (len > remainLen) {
break;
}
remainLen -= len;
p += len;
}
} }
pQdesc->numOfSub = htonl(pQdesc->numOfSub); pQdesc->numOfSub = htonl(pQdesc->numOfSub);

View File

@ -900,6 +900,7 @@ int32_t tscValidateSqlInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SSqlNode* pSqlNode = taosArrayGetP(pInfo->list, i); SSqlNode* pSqlNode = taosArrayGetP(pInfo->list, i);
tscTrace("0x%"PRIx64" start to parse the %dth subclause, total:%"PRIzu, pSql->self, i, size); tscTrace("0x%"PRIx64" start to parse the %dth subclause, total:%"PRIzu, pSql->self, i, size);
// normalizeSqlNode(pSqlNode); // normalize the column name in each function // normalizeSqlNode(pSqlNode); // normalize the column name in each function
if ((code = validateSqlNode(pSql, pSqlNode, pQueryInfo)) != TSDB_CODE_SUCCESS) { if ((code = validateSqlNode(pSql, pSqlNode, pQueryInfo)) != TSDB_CODE_SUCCESS) {
return code; return code;
@ -1288,35 +1289,31 @@ int32_t parseSlidingClause(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SStrToken* pSl
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0); STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, 0);
STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta); STableComInfo tinfo = tscGetTableInfo(pTableMetaInfo->pTableMeta);
SInterval* pInterval = &pQueryInfo->interval;
if (pSliding->n == 0) { if (pSliding->n == 0) {
pQueryInfo->interval.slidingUnit = pQueryInfo->interval.intervalUnit; pInterval->slidingUnit = pInterval->intervalUnit;
pQueryInfo->interval.sliding = pQueryInfo->interval.interval; pInterval->sliding = pInterval->interval;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
if (pQueryInfo->interval.intervalUnit == 'n' || pQueryInfo->interval.intervalUnit == 'y') { if (pInterval->intervalUnit == 'n' || pInterval->intervalUnit == 'y') {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
} }
parseAbsoluteDuration(pSliding->z, pSliding->n, &pQueryInfo->interval.sliding, tinfo.precision); parseAbsoluteDuration(pSliding->z, pSliding->n, &pInterval->sliding, &pInterval->slidingUnit, tinfo.precision);
if (pQueryInfo->interval.sliding < if (pInterval->sliding < convertTimePrecision(tsMinSlidingTime, TSDB_TIME_PRECISION_MILLI, tinfo.precision)) {
convertTimePrecision(tsMinSlidingTime, TSDB_TIME_PRECISION_MILLI, tinfo.precision)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg0); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg0);
} }
if (pQueryInfo->interval.sliding > pQueryInfo->interval.interval) { if (pInterval->sliding > pInterval->interval) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg1);
} }
if ((pQueryInfo->interval.interval != 0) && (pQueryInfo->interval.interval/pQueryInfo->interval.sliding > INTERVAL_SLIDING_FACTOR)) { if ((pInterval->interval != 0) && (pInterval->interval/pInterval->sliding > INTERVAL_SLIDING_FACTOR)) {
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
} }
// if (pQueryInfo->interval.sliding != pQueryInfo->interval.interval && pSql->pStream == NULL) {
// return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg4);
// }
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -2028,7 +2025,6 @@ static SUdfInfo* isValidUdf(SArray* pUdfInfo, const char* name, int32_t len) {
tscError("udfinfo is null"); tscError("udfinfo is null");
return NULL; return NULL;
} }
size_t t = taosArrayGetSize(pUdfInfo); size_t t = taosArrayGetSize(pUdfInfo);
for(int32_t i = 0; i < t; ++i) { for(int32_t i = 0; i < t; ++i) {
SUdfInfo* pUdf = taosArrayGet(pUdfInfo, i); SUdfInfo* pUdf = taosArrayGet(pUdfInfo, i);
@ -5890,6 +5886,11 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tVariantListItem* pItem = taosArrayGet(pVarList, 1); tVariantListItem* pItem = taosArrayGet(pVarList, 1);
SSchema* pTagsSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex); SSchema* pTagsSchema = tscGetTableColumnSchema(pTableMetaInfo->pTableMeta, columnIndex.columnIndex);
if (IS_VAR_DATA_TYPE(pTagsSchema->type) && (pItem->pVar.nLen > pTagsSchema->bytes * TSDB_NCHAR_SIZE)) {
return invalidOperationMsg(pMsg, msg14);
}
pAlterSQL->tagData.data = calloc(1, pTagsSchema->bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE); pAlterSQL->tagData.data = calloc(1, pTagsSchema->bytes * TSDB_NCHAR_SIZE + VARSTR_HEADER_SIZE);
if (tVariantDump(&pItem->pVar, pAlterSQL->tagData.data, pTagsSchema->type, true) != TSDB_CODE_SUCCESS) { if (tVariantDump(&pItem->pVar, pAlterSQL->tagData.data, pTagsSchema->type, true) != TSDB_CODE_SUCCESS) {
@ -6080,10 +6081,12 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SSchema* pSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta); SSchema* pSchema = tscGetTableTagSchema(pTableMetaInfo->pTableMeta);
int16_t numOfTags = tscGetNumOfTags(pTableMetaInfo->pTableMeta); int16_t numOfTags = tscGetNumOfTags(pTableMetaInfo->pTableMeta);
int16_t i; int32_t numOfCols = tscGetNumOfColumns(pTableMetaInfo->pTableMeta);
int32_t tagIndex = columnIndex.columnIndex - numOfCols;
assert(tagIndex>=0);
uint32_t nLen = 0; uint32_t nLen = 0;
for (i = 0; i < numOfTags; ++i) { for (int i = 0; i < numOfTags; ++i) {
nLen += (i != columnIndex.columnIndex) ? pSchema[i].bytes : pItem->bytes; nLen += (i != tagIndex) ? pSchema[i].bytes : pItem->bytes;
} }
if (nLen >= TSDB_MAX_TAGS_LEN) { if (nLen >= TSDB_MAX_TAGS_LEN) {
return invalidOperationMsg(pMsg, msg24); return invalidOperationMsg(pMsg, msg24);
@ -8093,6 +8096,7 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) {
SArray* pVgroupList = NULL; SArray* pVgroupList = NULL;
SArray* plist = NULL; SArray* plist = NULL;
STableMeta* pTableMeta = NULL; STableMeta* pTableMeta = NULL;
size_t tableMetaCapacity = 0;
SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd); SQueryInfo* pQueryInfo = tscGetQueryInfo(pCmd);
pCmd->pTableMetaMap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK); pCmd->pTableMetaMap = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), false, HASH_NO_LOCK);
@ -8119,18 +8123,14 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) {
} }
} }
uint32_t maxSize = tscGetTableMetaMaxSize();
char name[TSDB_TABLE_FNAME_LEN] = {0}; char name[TSDB_TABLE_FNAME_LEN] = {0};
assert(maxSize < 80 * TSDB_MAX_COLUMNS); //if (!pSql->pBuf) {
if (!pSql->pBuf) { // if (NULL == (pSql->pBuf = tcalloc(1, 80 * TSDB_MAX_COLUMNS))) {
if (NULL == (pSql->pBuf = tcalloc(1, 80 * TSDB_MAX_COLUMNS))) { // code = TSDB_CODE_TSC_OUT_OF_MEMORY;
code = TSDB_CODE_TSC_OUT_OF_MEMORY; // goto _end;
goto _end; // }
} //}
}
pTableMeta = calloc(1, maxSize);
plist = taosArrayInit(4, POINTER_BYTES); plist = taosArrayInit(4, POINTER_BYTES);
pVgroupList = taosArrayInit(4, POINTER_BYTES); pVgroupList = taosArrayInit(4, POINTER_BYTES);
@ -8144,16 +8144,16 @@ int32_t loadAllTableMeta(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tNameExtractFullName(pname, name); tNameExtractFullName(pname, name);
size_t len = strlen(name); size_t len = strlen(name);
memset(pTableMeta, 0, maxSize);
taosHashGetClone(tscTableMetaMap, name, len, NULL, pTableMeta);
if (pTableMeta->id.uid > 0) { taosHashGetCloneExt(tscTableMetaMap, name, len, NULL, (void **)&pTableMeta, &tableMetaCapacity);
if (pTableMeta && pTableMeta->id.uid > 0) {
tscDebug("0x%"PRIx64" retrieve table meta %s from local buf", pSql->self, name); tscDebug("0x%"PRIx64" retrieve table meta %s from local buf", pSql->self, name);
// avoid mem leak, may should update pTableMeta // avoid mem leak, may should update pTableMeta
void* pVgroupIdList = NULL; void* pVgroupIdList = NULL;
if (pTableMeta->tableType == TSDB_CHILD_TABLE) { if (pTableMeta->tableType == TSDB_CHILD_TABLE) {
code = tscCreateTableMetaFromSTableMeta(pTableMeta, name, pSql->pBuf); code = tscCreateTableMetaFromSTableMeta((STableMeta **)(&pTableMeta), name, &tableMetaCapacity);
// create the child table meta from super table failed, try load it from mnode // create the child table meta from super table failed, try load it from mnode
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
@ -8309,6 +8309,7 @@ static int32_t doLoadAllTableMeta(SSqlObj* pSql, SQueryInfo* pQueryInfo, SSqlNod
STableMetaVgroupInfo* p = taosHashGet(pCmd->pTableMetaMap, fname, strnlen(fname, TSDB_TABLE_FNAME_LEN)); STableMetaVgroupInfo* p = taosHashGet(pCmd->pTableMetaMap, fname, strnlen(fname, TSDB_TABLE_FNAME_LEN));
pTableMetaInfo->pTableMeta = tscTableMetaDup(p->pTableMeta); pTableMetaInfo->pTableMeta = tscTableMetaDup(p->pTableMeta);
pTableMetaInfo->tableMetaCapacity = tscGetTableMetaSize(pTableMetaInfo->pTableMeta);
assert(pTableMetaInfo->pTableMeta != NULL); assert(pTableMetaInfo->pTableMeta != NULL);
if (p->vgroupIdList != NULL) { if (p->vgroupIdList != NULL) {
@ -8409,6 +8410,7 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS
return TSDB_CODE_TSC_OUT_OF_MEMORY; return TSDB_CODE_TSC_OUT_OF_MEMORY;
} }
pTableMetaInfo1->pTableMeta = extractTempTableMetaFromSubquery(pSub); pTableMetaInfo1->pTableMeta = extractTempTableMetaFromSubquery(pSub);
pTableMetaInfo1->tableMetaCapacity = tscGetTableMetaSize(pTableMetaInfo1->pTableMeta);
if (subInfo->aliasName.n > 0) { if (subInfo->aliasName.n > 0) {
if (subInfo->aliasName.n >= TSDB_TABLE_FNAME_LEN) { if (subInfo->aliasName.n >= TSDB_TABLE_FNAME_LEN) {
@ -8457,6 +8459,7 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
const char* msg6 = "not support stddev/percentile/interp in the outer query yet"; const char* msg6 = "not support stddev/percentile/interp in the outer query yet";
const char* msg7 = "derivative/twa/irate requires timestamp column exists in subquery"; const char* msg7 = "derivative/twa/irate requires timestamp column exists in subquery";
const char* msg8 = "condition missing for join query"; const char* msg8 = "condition missing for join query";
const char* msg9 = "not support 3 level select";
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
@ -8487,6 +8490,13 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
// parse the subquery in the first place // parse the subquery in the first place
int32_t numOfSub = (int32_t)taosArrayGetSize(pSqlNode->from->list); int32_t numOfSub = (int32_t)taosArrayGetSize(pSqlNode->from->list);
for (int32_t i = 0; i < numOfSub; ++i) { for (int32_t i = 0; i < numOfSub; ++i) {
// check if there is 3 level select
SRelElementPair* subInfo = taosArrayGet(pSqlNode->from->list, i);
SSqlNode* p = taosArrayGetP(subInfo->pSubquery, 0);
if (p->from->type == SQL_NODE_FROM_SUBQUERY){
return invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg9);
}
code = doValidateSubquery(pSqlNode, i, pSql, pQueryInfo, tscGetErrorMsgPayload(pCmd)); code = doValidateSubquery(pSqlNode, i, pSql, pQueryInfo, tscGetErrorMsgPayload(pCmd));
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
return code; return code;
@ -8767,8 +8777,8 @@ int32_t validateSqlNode(SSqlObj* pSql, SSqlNode* pSqlNode, SQueryInfo* pQueryInf
#if 0 #if 0
SQueryNode* p = qCreateQueryPlan(pQueryInfo); SQueryNode* p = qCreateQueryPlan(pQueryInfo);
char* s = queryPlanToString(p); char* s = queryPlanToString(p);
printf("%s\n", s);
tfree(s); tfree(s);
qDestroyQueryPlan(p); qDestroyQueryPlan(p);
#endif #endif

View File

@ -401,10 +401,8 @@ static void doProcessMsgFromServer(SSchedMsg* pSchedMsg) {
// single table query error need to be handled here. // single table query error need to be handled here.
if ((cmd == TSDB_SQL_SELECT || cmd == TSDB_SQL_UPDATE_TAGS_VAL) && if ((cmd == TSDB_SQL_SELECT || cmd == TSDB_SQL_UPDATE_TAGS_VAL) &&
(((rpcMsg->code == TSDB_CODE_TDB_INVALID_TABLE_ID || (((rpcMsg->code == TSDB_CODE_TDB_INVALID_TABLE_ID || rpcMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID)) ||
rpcMsg->code == TSDB_CODE_VND_INVALID_VGROUP_ID)) || rpcMsg->code == TSDB_CODE_RPC_NETWORK_UNAVAIL || rpcMsg->code == TSDB_CODE_APP_NOT_READY)) {
rpcMsg->code == TSDB_CODE_RPC_NETWORK_UNAVAIL ||
rpcMsg->code == TSDB_CODE_APP_NOT_READY)) {
// 1. super table subquery // 1. super table subquery
// 2. nest queries are all not updated the tablemeta and retry parse the sql after cleanup local tablemeta/vgroup id buffer // 2. nest queries are all not updated the tablemeta and retry parse the sql after cleanup local tablemeta/vgroup id buffer
@ -2840,43 +2838,22 @@ int32_t getMultiTableMetaFromMnode(SSqlObj *pSql, SArray* pNameList, SArray* pVg
int32_t tscGetTableMetaImpl(SSqlObj* pSql, STableMetaInfo *pTableMetaInfo, bool autocreate, bool onlyLocal) { int32_t tscGetTableMetaImpl(SSqlObj* pSql, STableMetaInfo *pTableMetaInfo, bool autocreate, bool onlyLocal) {
assert(tIsValidName(&pTableMetaInfo->name)); assert(tIsValidName(&pTableMetaInfo->name));
uint32_t size = tscGetTableMetaMaxSize();
if (pTableMetaInfo->pTableMeta == NULL) {
pTableMetaInfo->pTableMeta = calloc(1, size);
pTableMetaInfo->tableMetaSize = size;
} else if (pTableMetaInfo->tableMetaSize < size) {
char *tmp = realloc(pTableMetaInfo->pTableMeta, size);
if (tmp == NULL) {
return TSDB_CODE_TSC_OUT_OF_MEMORY;
}
pTableMetaInfo->pTableMeta = (STableMeta *)tmp;
}
memset(pTableMetaInfo->pTableMeta, 0, size);
pTableMetaInfo->tableMetaSize = size;
pTableMetaInfo->pTableMeta->tableType = -1;
pTableMetaInfo->pTableMeta->tableInfo.numOfColumns = -1;
char name[TSDB_TABLE_FNAME_LEN] = {0}; char name[TSDB_TABLE_FNAME_LEN] = {0};
tNameExtractFullName(&pTableMetaInfo->name, name); tNameExtractFullName(&pTableMetaInfo->name, name);
size_t len = strlen(name); size_t len = strlen(name);
taosHashGetClone(tscTableMetaMap, name, len, NULL, pTableMetaInfo->pTableMeta); if (pTableMetaInfo->tableMetaCapacity != 0) {
if (pTableMetaInfo->pTableMeta != NULL) {
// TODO resize the tableMeta memset(pTableMetaInfo->pTableMeta, 0, pTableMetaInfo->tableMetaCapacity);
assert(size < 80 * TSDB_MAX_COLUMNS);
if (!pSql->pBuf) {
if (NULL == (pSql->pBuf = tcalloc(1, 80 * TSDB_MAX_COLUMNS))) {
return TSDB_CODE_TSC_OUT_OF_MEMORY;
} }
} }
taosHashGetCloneExt(tscTableMetaMap, name, len, NULL, (void **)&(pTableMetaInfo->pTableMeta), &pTableMetaInfo->tableMetaCapacity);
STableMeta* pMeta = pTableMetaInfo->pTableMeta; STableMeta* pMeta = pTableMetaInfo->pTableMeta;
if (pMeta->id.uid > 0) { if (pMeta && pMeta->id.uid > 0) {
// in case of child table, here only get the // in case of child table, here only get the
if (pMeta->tableType == TSDB_CHILD_TABLE) { if (pMeta->tableType == TSDB_CHILD_TABLE) {
int32_t code = tscCreateTableMetaFromSTableMeta(pTableMetaInfo->pTableMeta, name, pSql->pBuf); int32_t code = tscCreateTableMetaFromSTableMeta(&pTableMetaInfo->pTableMeta, name, &pTableMetaInfo->tableMetaCapacity);
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
return getTableMetaFromMnode(pSql, pTableMetaInfo, autocreate); return getTableMetaFromMnode(pSql, pTableMetaInfo, autocreate);
} }

View File

@ -1635,6 +1635,8 @@ void tscFetchDatablockForSubquery(SSqlObj* pSql) {
continue; continue;
} }
SSqlRes* pRes1 = &pSql1->res; SSqlRes* pRes1 = &pSql1->res;
if (pRes1->row >= pRes1->numOfRows) { if (pRes1->row >= pRes1->numOfRows) {
subquerySetState(pSql1, &pSql->subState, i, 0); subquerySetState(pSql1, &pSql->subState, i, 0);

View File

@ -1657,6 +1657,7 @@ int32_t tscCopyDataBlockToPayload(SSqlObj* pSql, STableDataBlocks* pDataBlock) {
pTableMetaInfo->pTableMeta = tscTableMetaDup(pDataBlock->pTableMeta); pTableMetaInfo->pTableMeta = tscTableMetaDup(pDataBlock->pTableMeta);
pTableMetaInfo->tableMetaSize = tscGetTableMetaSize(pDataBlock->pTableMeta); pTableMetaInfo->tableMetaSize = tscGetTableMetaSize(pDataBlock->pTableMeta);
pTableMetaInfo->tableMetaCapacity = (size_t)(pTableMetaInfo->tableMetaSize);
} }
/* /*
@ -2790,7 +2791,8 @@ void tscDequoteAndTrimToken(SStrToken* pToken) {
} }
int32_t tscValidateName(SStrToken* pToken) { int32_t tscValidateName(SStrToken* pToken) {
if (pToken->type != TK_STRING && pToken->type != TK_ID) { if (pToken == NULL || pToken->z == NULL ||
(pToken->type != TK_STRING && pToken->type != TK_ID)) {
return TSDB_CODE_TSC_INVALID_OPERATION; return TSDB_CODE_TSC_INVALID_OPERATION;
} }
@ -3413,6 +3415,8 @@ STableMetaInfo* tscAddTableMetaInfo(SQueryInfo* pQueryInfo, SName* name, STableM
} else { } else {
pTableMetaInfo->tableMetaSize = tscGetTableMetaSize(pTableMeta); pTableMetaInfo->tableMetaSize = tscGetTableMetaSize(pTableMeta);
} }
pTableMetaInfo->tableMetaCapacity = (size_t)(pTableMetaInfo->tableMetaSize);
if (vgroupList != NULL) { if (vgroupList != NULL) {
pTableMetaInfo->vgroupList = tscVgroupInfoClone(vgroupList); pTableMetaInfo->vgroupList = tscVgroupInfoClone(vgroupList);
@ -3645,7 +3649,7 @@ SSqlObj* createSubqueryObj(SSqlObj* pSql, int16_t tableIndex, __async_cb_func_t
if (pQueryInfo->fillType != TSDB_FILL_NONE) { if (pQueryInfo->fillType != TSDB_FILL_NONE) {
//just make memory memory sanitizer happy //just make memory memory sanitizer happy
//refator later //refactor later
pNewQueryInfo->fillVal = calloc(1, pQueryInfo->fieldsInfo.numOfOutput * sizeof(int64_t)); pNewQueryInfo->fillVal = calloc(1, pQueryInfo->fieldsInfo.numOfOutput * sizeof(int64_t));
if (pNewQueryInfo->fillVal == NULL) { if (pNewQueryInfo->fillVal == NULL) {
terrno = TSDB_CODE_TSC_OUT_OF_MEMORY; terrno = TSDB_CODE_TSC_OUT_OF_MEMORY;
@ -4444,24 +4448,36 @@ CChildTableMeta* tscCreateChildMeta(STableMeta* pTableMeta) {
return cMeta; return cMeta;
} }
int32_t tscCreateTableMetaFromSTableMeta(STableMeta* pChild, const char* name, void* buf) { int32_t tscCreateTableMetaFromSTableMeta(STableMeta** ppChild, const char* name, size_t *tableMetaCapacity) {
assert(pChild != NULL && buf != NULL); assert(*ppChild != NULL);
STableMeta* p = buf; STableMeta* p = NULL;
taosHashGetClone(tscTableMetaMap, pChild->sTableName, strnlen(pChild->sTableName, TSDB_TABLE_FNAME_LEN), NULL, p); size_t sz = 0;
STableMeta* pChild = *ppChild;
taosHashGetCloneExt(tscTableMetaMap, pChild->sTableName, strnlen(pChild->sTableName, TSDB_TABLE_FNAME_LEN), NULL, (void **)&p, &sz);
// tableMeta exists, build child table meta according to the super table meta // tableMeta exists, build child table meta according to the super table meta
// the uid need to be checked in addition to the general name of the super table. // the uid need to be checked in addition to the general name of the super table.
if (p->id.uid > 0 && pChild->suid == p->id.uid) { if (p && p->id.uid > 0 && pChild->suid == p->id.uid) {
int32_t totalBytes = (p->tableInfo.numOfColumns + p->tableInfo.numOfTags) * sizeof(SSchema);
int32_t tableMetaSize = sizeof(STableMeta) + totalBytes;
if (*tableMetaCapacity < tableMetaSize) {
pChild = realloc(pChild, tableMetaSize);
*tableMetaCapacity = (size_t)tableMetaSize;
}
pChild->sversion = p->sversion; pChild->sversion = p->sversion;
pChild->tversion = p->tversion; pChild->tversion = p->tversion;
memcpy(&pChild->tableInfo, &p->tableInfo, sizeof(STableComInfo)); memcpy(&pChild->tableInfo, &p->tableInfo, sizeof(STableComInfo));
int32_t total = pChild->tableInfo.numOfColumns + pChild->tableInfo.numOfTags; memcpy(pChild->schema, p->schema, totalBytes);
memcpy(pChild->schema, p->schema, sizeof(SSchema) *total); *ppChild = pChild;
tfree(p);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} else { // super table has been removed, current tableMeta is also expired. remove it here } else { // super table has been removed, current tableMeta is also expired. remove it here
tfree(p);
taosHashRemove(tscTableMetaMap, name, strnlen(name, TSDB_TABLE_FNAME_LEN)); taosHashRemove(tscTableMetaMap, name, strnlen(name, TSDB_TABLE_FNAME_LEN));
return -1; return -1;
} }

View File

@ -325,7 +325,9 @@ typedef struct SDataCol {
#define isAllRowsNull(pCol) ((pCol)->len == 0) #define isAllRowsNull(pCol) ((pCol)->len == 0)
static FORCE_INLINE void dataColReset(SDataCol *pDataCol) { pDataCol->len = 0; } static FORCE_INLINE void dataColReset(SDataCol *pDataCol) { pDataCol->len = 0; }
void dataColInit(SDataCol *pDataCol, STColumn *pCol, void **pBuf, int maxPoints); int tdAllocMemForCol(SDataCol *pCol, int maxPoints);
void dataColInit(SDataCol *pDataCol, STColumn *pCol, int maxPoints);
void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints); void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints);
void dataColSetOffset(SDataCol *pCol, int nEle); void dataColSetOffset(SDataCol *pCol, int nEle);
@ -358,12 +360,10 @@ typedef struct {
int maxRowSize; int maxRowSize;
int maxCols; // max number of columns int maxCols; // max number of columns
int maxPoints; // max number of points int maxPoints; // max number of points
int bufSize;
int numOfRows; int numOfRows;
int numOfCols; // Total number of cols int numOfCols; // Total number of cols
int sversion; // TODO: set sversion int sversion; // TODO: set sversion
void * buf;
SDataCol *cols; SDataCol *cols;
} SDataCols; } SDataCols;

View File

@ -22,6 +22,29 @@
static void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, int limit1, SDataCols *src2, int *iter2, static void tdMergeTwoDataCols(SDataCols *target, SDataCols *src1, int *iter1, int limit1, SDataCols *src2, int *iter2,
int limit2, int tRows, bool forceSetNull); int limit2, int tRows, bool forceSetNull);
//TODO: change caller to use return val
int tdAllocMemForCol(SDataCol *pCol, int maxPoints) {
int spaceNeeded = pCol->bytes * maxPoints;
if(IS_VAR_DATA_TYPE(pCol->type)) {
spaceNeeded += sizeof(VarDataOffsetT) * maxPoints;
}
if(pCol->spaceSize < spaceNeeded) {
void* ptr = realloc(pCol->pData, spaceNeeded);
if(ptr == NULL) {
uDebug("malloc failure, size:%" PRId64 " failed, reason:%s", (int64_t)pCol->spaceSize,
strerror(errno));
return -1;
} else {
pCol->pData = ptr;
pCol->spaceSize = spaceNeeded;
}
}
if(IS_VAR_DATA_TYPE(pCol->type)) {
pCol->dataOff = POINTER_SHIFT(pCol->pData, pCol->bytes * maxPoints);
}
return 0;
}
/** /**
* Duplicate the schema and return a new object * Duplicate the schema and return a new object
*/ */
@ -207,24 +230,13 @@ SMemRow tdMemRowDup(SMemRow row) {
return trow; return trow;
} }
void dataColInit(SDataCol *pDataCol, STColumn *pCol, void **pBuf, int maxPoints) { void dataColInit(SDataCol *pDataCol, STColumn *pCol, int maxPoints) {
pDataCol->type = colType(pCol); pDataCol->type = colType(pCol);
pDataCol->colId = colColId(pCol); pDataCol->colId = colColId(pCol);
pDataCol->bytes = colBytes(pCol); pDataCol->bytes = colBytes(pCol);
pDataCol->offset = colOffset(pCol) + TD_DATA_ROW_HEAD_SIZE; pDataCol->offset = colOffset(pCol) + TD_DATA_ROW_HEAD_SIZE;
pDataCol->len = 0; pDataCol->len = 0;
if (IS_VAR_DATA_TYPE(pDataCol->type)) {
pDataCol->dataOff = (VarDataOffsetT *)(*pBuf);
pDataCol->pData = POINTER_SHIFT(*pBuf, sizeof(VarDataOffsetT) * maxPoints);
pDataCol->spaceSize = pDataCol->bytes * maxPoints;
*pBuf = POINTER_SHIFT(*pBuf, pDataCol->spaceSize + sizeof(VarDataOffsetT) * maxPoints);
} else {
pDataCol->spaceSize = pDataCol->bytes * maxPoints;
pDataCol->dataOff = NULL;
pDataCol->pData = *pBuf;
*pBuf = POINTER_SHIFT(*pBuf, pDataCol->spaceSize);
}
} }
// value from timestamp should be TKEY here instead of TSKEY // value from timestamp should be TKEY here instead of TSKEY
void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints) { void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxPoints) {
@ -239,6 +251,8 @@ void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxP
if (numOfRows > 0) { if (numOfRows > 0) {
// Find the first not null value, fill all previouse values as NULL // Find the first not null value, fill all previouse values as NULL
dataColSetNEleNull(pCol, numOfRows, maxPoints); dataColSetNEleNull(pCol, numOfRows, maxPoints);
} else {
tdAllocMemForCol(pCol, maxPoints);
} }
} }
@ -257,13 +271,14 @@ void dataColAppendVal(SDataCol *pCol, const void *value, int numOfRows, int maxP
} }
bool isNEleNull(SDataCol *pCol, int nEle) { bool isNEleNull(SDataCol *pCol, int nEle) {
if(isAllRowsNull(pCol)) return true;
for (int i = 0; i < nEle; i++) { for (int i = 0; i < nEle; i++) {
if (!isNull(tdGetColDataOfRow(pCol, i), pCol->type)) return false; if (!isNull(tdGetColDataOfRow(pCol, i), pCol->type)) return false;
} }
return true; return true;
} }
FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index) { static FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index) {
if (IS_VAR_DATA_TYPE(pCol->type)) { if (IS_VAR_DATA_TYPE(pCol->type)) {
pCol->dataOff[index] = pCol->len; pCol->dataOff[index] = pCol->len;
char *ptr = POINTER_SHIFT(pCol->pData, pCol->len); char *ptr = POINTER_SHIFT(pCol->pData, pCol->len);
@ -276,6 +291,7 @@ FORCE_INLINE void dataColSetNullAt(SDataCol *pCol, int index) {
} }
void dataColSetNEleNull(SDataCol *pCol, int nEle, int maxPoints) { void dataColSetNEleNull(SDataCol *pCol, int nEle, int maxPoints) {
tdAllocMemForCol(pCol, maxPoints);
if (IS_VAR_DATA_TYPE(pCol->type)) { if (IS_VAR_DATA_TYPE(pCol->type)) {
pCol->len = 0; pCol->len = 0;
@ -319,56 +335,63 @@ SDataCols *tdNewDataCols(int maxRowSize, int maxCols, int maxRows) {
tdFreeDataCols(pCols); tdFreeDataCols(pCols);
return NULL; return NULL;
} }
int i;
for(i = 0; i < maxCols; i++) {
pCols->cols[i].spaceSize = 0;
pCols->cols[i].len = 0;
pCols->cols[i].pData = NULL;
pCols->cols[i].dataOff = NULL;
}
pCols->maxCols = maxCols; pCols->maxCols = maxCols;
} }
pCols->maxRowSize = maxRowSize; pCols->maxRowSize = maxRowSize;
pCols->bufSize = maxRowSize * maxRows;
if (pCols->bufSize > 0) {
pCols->buf = malloc(pCols->bufSize);
if (pCols->buf == NULL) {
uDebug("malloc failure, size:%" PRId64 " failed, reason:%s", (int64_t)sizeof(SDataCol) * maxCols,
strerror(errno));
tdFreeDataCols(pCols);
return NULL;
}
}
return pCols; return pCols;
} }
int tdInitDataCols(SDataCols *pCols, STSchema *pSchema) { int tdInitDataCols(SDataCols *pCols, STSchema *pSchema) {
if (schemaNCols(pSchema) > pCols->maxCols) { int i;
int oldMaxCols = pCols->maxCols;
if (schemaNCols(pSchema) > oldMaxCols) {
pCols->maxCols = schemaNCols(pSchema); pCols->maxCols = schemaNCols(pSchema);
pCols->cols = (SDataCol *)realloc(pCols->cols, sizeof(SDataCol) * pCols->maxCols); pCols->cols = (SDataCol *)realloc(pCols->cols, sizeof(SDataCol) * pCols->maxCols);
if (pCols->cols == NULL) return -1; if (pCols->cols == NULL) return -1;
for(i = oldMaxCols; i < pCols->maxCols; i++) {
pCols->cols[i].pData = NULL;
pCols->cols[i].dataOff = NULL;
pCols->cols[i].spaceSize = 0;
}
} }
if (schemaTLen(pSchema) > pCols->maxRowSize) { if (schemaTLen(pSchema) > pCols->maxRowSize) {
pCols->maxRowSize = schemaTLen(pSchema); pCols->maxRowSize = schemaTLen(pSchema);
pCols->bufSize = schemaTLen(pSchema) * pCols->maxPoints;
pCols->buf = realloc(pCols->buf, pCols->bufSize);
if (pCols->buf == NULL) return -1;
} }
tdResetDataCols(pCols); tdResetDataCols(pCols);
pCols->numOfCols = schemaNCols(pSchema); pCols->numOfCols = schemaNCols(pSchema);
void *ptr = pCols->buf; for (i = 0; i < schemaNCols(pSchema); i++) {
for (int i = 0; i < schemaNCols(pSchema); i++) { dataColInit(pCols->cols + i, schemaColAt(pSchema, i), pCols->maxPoints);
dataColInit(pCols->cols + i, schemaColAt(pSchema, i), &ptr, pCols->maxPoints);
ASSERT((char *)ptr - (char *)(pCols->buf) <= pCols->bufSize);
} }
return 0; return 0;
} }
SDataCols *tdFreeDataCols(SDataCols *pCols) { SDataCols *tdFreeDataCols(SDataCols *pCols) {
int i;
if (pCols) { if (pCols) {
tfree(pCols->buf); if(pCols->cols) {
tfree(pCols->cols); int maxCols = pCols->maxCols;
for(i = 0; i < maxCols; i++) {
SDataCol *pCol = &pCols->cols[i];
tfree(pCol->pData);
}
free(pCols->cols);
pCols->cols = NULL;
}
free(pCols); free(pCols);
} }
return NULL; return NULL;
@ -388,21 +411,14 @@ SDataCols *tdDupDataCols(SDataCols *pDataCols, bool keepData) {
pRet->cols[i].bytes = pDataCols->cols[i].bytes; pRet->cols[i].bytes = pDataCols->cols[i].bytes;
pRet->cols[i].offset = pDataCols->cols[i].offset; pRet->cols[i].offset = pDataCols->cols[i].offset;
pRet->cols[i].spaceSize = pDataCols->cols[i].spaceSize;
pRet->cols[i].pData = (void *)((char *)pRet->buf + ((char *)(pDataCols->cols[i].pData) - (char *)(pDataCols->buf)));
if (IS_VAR_DATA_TYPE(pRet->cols[i].type)) {
ASSERT(pDataCols->cols[i].dataOff != NULL);
pRet->cols[i].dataOff =
(int32_t *)((char *)pRet->buf + ((char *)(pDataCols->cols[i].dataOff) - (char *)(pDataCols->buf)));
}
if (keepData) { if (keepData) {
pRet->cols[i].len = pDataCols->cols[i].len;
if (pDataCols->cols[i].len > 0) { if (pDataCols->cols[i].len > 0) {
tdAllocMemForCol(&pRet->cols[i], pRet->maxPoints);
pRet->cols[i].len = pDataCols->cols[i].len;
memcpy(pRet->cols[i].pData, pDataCols->cols[i].pData, pDataCols->cols[i].len); memcpy(pRet->cols[i].pData, pDataCols->cols[i].pData, pDataCols->cols[i].len);
if (IS_VAR_DATA_TYPE(pRet->cols[i].type)) { if (IS_VAR_DATA_TYPE(pRet->cols[i].type)) {
memcpy(pRet->cols[i].dataOff, pDataCols->cols[i].dataOff, sizeof(VarDataOffsetT) * pDataCols->maxPoints); int dataOffSize = sizeof(VarDataOffsetT) * pDataCols->maxPoints;
memcpy(pRet->cols[i].dataOff, pDataCols->cols[i].dataOff, dataOffSize);
} }
} }
} }
@ -426,20 +442,9 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
int rcol = 0; int rcol = 0;
int dcol = 0; int dcol = 0;
if (dataRowDeleted(row)) {
for (; dcol < pCols->numOfCols; dcol++) {
SDataCol *pDataCol = &(pCols->cols[dcol]);
if (dcol == 0) {
dataColAppendVal(pDataCol, dataRowTuple(row), pCols->numOfRows, pCols->maxPoints);
} else {
dataColSetNullAt(pDataCol, pCols->numOfRows);
}
}
} else {
while (dcol < pCols->numOfCols) { while (dcol < pCols->numOfCols) {
SDataCol *pDataCol = &(pCols->cols[dcol]); SDataCol *pDataCol = &(pCols->cols[dcol]);
if (rcol >= schemaNCols(pSchema)) { if (rcol >= schemaNCols(pSchema)) {
// dataColSetNullAt(pDataCol, pCols->numOfRows);
dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints); dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints);
dcol++; dcol++;
continue; continue;
@ -455,13 +460,11 @@ static void tdAppendDataRowToDataCol(SDataRow row, STSchema *pSchema, SDataCols
rcol++; rcol++;
} else { } else {
if(forceSetNull) { if(forceSetNull) {
//dataColSetNullAt(pDataCol, pCols->numOfRows);
dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints); dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints);
} }
dcol++; dcol++;
} }
} }
}
pCols->numOfRows++; pCols->numOfRows++;
} }
@ -471,22 +474,11 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
int rcol = 0; int rcol = 0;
int dcol = 0; int dcol = 0;
if (kvRowDeleted(row)) {
for (; dcol < pCols->numOfCols; dcol++) {
SDataCol *pDataCol = &(pCols->cols[dcol]);
if (dcol == 0) {
dataColAppendVal(pDataCol, kvRowValues(row), pCols->numOfRows, pCols->maxPoints);
} else {
dataColSetNullAt(pDataCol, pCols->numOfRows);
}
}
} else {
int nRowCols = kvRowNCols(row); int nRowCols = kvRowNCols(row);
while (dcol < pCols->numOfCols) { while (dcol < pCols->numOfCols) {
SDataCol *pDataCol = &(pCols->cols[dcol]); SDataCol *pDataCol = &(pCols->cols[dcol]);
if (rcol >= nRowCols || rcol >= schemaNCols(pSchema)) { if (rcol >= nRowCols || rcol >= schemaNCols(pSchema)) {
// dataColSetNullAt(pDataCol, pCols->numOfRows);
dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints); dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints);
++dcol; ++dcol;
continue; continue;
@ -503,13 +495,11 @@ static void tdAppendKvRowToDataCol(SKVRow row, STSchema *pSchema, SDataCols *pCo
++rcol; ++rcol;
} else { } else {
if (forceSetNull) { if (forceSetNull) {
// dataColSetNullAt(pDataCol, pCols->numOfRows);
dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints); dataColAppendVal(pDataCol, getNullValue(pDataCol->type), pCols->numOfRows, pCols->maxPoints);
} }
++dcol; ++dcol;
} }
} }
}
pCols->numOfRows++; pCols->numOfRows++;
} }

View File

@ -122,6 +122,7 @@
<exclude>**/TSDBJNIConnectorTest.java</exclude> <exclude>**/TSDBJNIConnectorTest.java</exclude>
<exclude>**/TaosInfoMonitorTest.java</exclude> <exclude>**/TaosInfoMonitorTest.java</exclude>
<exclude>**/UnsignedNumberJniTest.java</exclude> <exclude>**/UnsignedNumberJniTest.java</exclude>
<exclude>**/TimeZoneTest.java</exclude>
</excludes> </excludes>
<testFailureIgnore>true</testFailureIgnore> <testFailureIgnore>true</testFailureIgnore>
</configuration> </configuration>

View File

@ -77,8 +77,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
} }
public boolean supportsMixedCaseIdentifiers() throws SQLException { public boolean supportsMixedCaseIdentifiers() throws SQLException {
//像databasetable这些对象的标识符在存储时是否采用大小写混合的模式 return false; //像databasetable这些对象的标识符在存储时是否采用大小写混合的模式
return false;
} }
public boolean storesUpperCaseIdentifiers() throws SQLException { public boolean storesUpperCaseIdentifiers() throws SQLException {
@ -514,7 +513,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col6 = new ColumnMetaData(); ColumnMetaData col6 = new ColumnMetaData();
col6.setColIndex(colIndex); col6.setColIndex(colIndex);
col6.setColName("TYPE_CAT"); col6.setColName("TYPE_CAT");
col6.setColType(Types.NCHAR); col6.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col6; return col6;
} }
@ -522,7 +521,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col7 = new ColumnMetaData(); ColumnMetaData col7 = new ColumnMetaData();
col7.setColIndex(colIndex); col7.setColIndex(colIndex);
col7.setColName("TYPE_SCHEM"); col7.setColName("TYPE_SCHEM");
col7.setColType(Types.NCHAR); col7.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col7; return col7;
} }
@ -530,7 +529,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col8 = new ColumnMetaData(); ColumnMetaData col8 = new ColumnMetaData();
col8.setColIndex(colIndex); col8.setColIndex(colIndex);
col8.setColName("TYPE_NAME"); col8.setColName("TYPE_NAME");
col8.setColType(Types.NCHAR); col8.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col8; return col8;
} }
@ -538,7 +537,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col9 = new ColumnMetaData(); ColumnMetaData col9 = new ColumnMetaData();
col9.setColIndex(colIndex); col9.setColIndex(colIndex);
col9.setColName("SELF_REFERENCING_COL_NAME"); col9.setColName("SELF_REFERENCING_COL_NAME");
col9.setColType(Types.NCHAR); col9.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col9; return col9;
} }
@ -546,7 +545,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col10 = new ColumnMetaData(); ColumnMetaData col10 = new ColumnMetaData();
col10.setColIndex(colIndex); col10.setColIndex(colIndex);
col10.setColName("REF_GENERATION"); col10.setColName("REF_GENERATION");
col10.setColType(Types.NCHAR); col10.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col10; return col10;
} }
@ -592,7 +591,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col4 = new ColumnMetaData(); ColumnMetaData col4 = new ColumnMetaData();
col4.setColIndex(colIndex); col4.setColIndex(colIndex);
col4.setColName("TABLE_TYPE"); col4.setColName("TABLE_TYPE");
col4.setColType(Types.NCHAR); col4.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col4; return col4;
} }
@ -734,7 +733,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col1 = new ColumnMetaData(); ColumnMetaData col1 = new ColumnMetaData();
col1.setColIndex(colIndex); col1.setColIndex(colIndex);
col1.setColName("TABLE_CAT"); col1.setColName("TABLE_CAT");
col1.setColType(Types.NCHAR); col1.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col1; return col1;
} }
@ -742,7 +741,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col2 = new ColumnMetaData(); ColumnMetaData col2 = new ColumnMetaData();
col2.setColIndex(colIndex); col2.setColIndex(colIndex);
col2.setColName("TABLE_SCHEM"); col2.setColName("TABLE_SCHEM");
col2.setColType(Types.NCHAR); col2.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col2; return col2;
} }
@ -751,7 +750,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
col3.setColIndex(colIndex); col3.setColIndex(colIndex);
col3.setColName("TABLE_NAME"); col3.setColName("TABLE_NAME");
col3.setColSize(193); col3.setColSize(193);
col3.setColType(Types.NCHAR); col3.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col3; return col3;
} }
@ -760,7 +759,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
col4.setColIndex(colIndex); col4.setColIndex(colIndex);
col4.setColName("COLUMN_NAME"); col4.setColName("COLUMN_NAME");
col4.setColSize(65); col4.setColSize(65);
col4.setColType(Types.NCHAR); col4.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col4; return col4;
} }
@ -768,7 +767,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col5 = new ColumnMetaData(); ColumnMetaData col5 = new ColumnMetaData();
col5.setColIndex(colIndex); col5.setColIndex(colIndex);
col5.setColName("DATA_TYPE"); col5.setColName("DATA_TYPE");
col5.setColType(Types.INTEGER); col5.setColType(TSDBConstants.TSDB_DATA_TYPE_INT);
return col5; return col5;
} }
@ -776,7 +775,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col7 = new ColumnMetaData(); ColumnMetaData col7 = new ColumnMetaData();
col7.setColIndex(7); col7.setColIndex(7);
col7.setColName("COLUMN_SIZE"); col7.setColName("COLUMN_SIZE");
col7.setColType(Types.INTEGER); col7.setColType(TSDBConstants.TSDB_DATA_TYPE_INT);
return col7; return col7;
} }
@ -791,7 +790,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col9 = new ColumnMetaData(); ColumnMetaData col9 = new ColumnMetaData();
col9.setColIndex(9); col9.setColIndex(9);
col9.setColName("DECIMAL_DIGITS"); col9.setColName("DECIMAL_DIGITS");
col9.setColType(Types.INTEGER); col9.setColType(TSDBConstants.TSDB_DATA_TYPE_INT);
return col9; return col9;
} }
@ -799,7 +798,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col10 = new ColumnMetaData(); ColumnMetaData col10 = new ColumnMetaData();
col10.setColIndex(10); col10.setColIndex(10);
col10.setColName("NUM_PREC_RADIX"); col10.setColName("NUM_PREC_RADIX");
col10.setColType(Types.INTEGER); col10.setColType(TSDBConstants.TSDB_DATA_TYPE_INT);
return col10; return col10;
} }
@ -807,7 +806,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col11 = new ColumnMetaData(); ColumnMetaData col11 = new ColumnMetaData();
col11.setColIndex(11); col11.setColIndex(11);
col11.setColName("NULLABLE"); col11.setColName("NULLABLE");
col11.setColType(Types.INTEGER); col11.setColType(TSDBConstants.TSDB_DATA_TYPE_INT);
return col11; return col11;
} }
@ -815,7 +814,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col12 = new ColumnMetaData(); ColumnMetaData col12 = new ColumnMetaData();
col12.setColIndex(colIndex); col12.setColIndex(colIndex);
col12.setColName("REMARKS"); col12.setColName("REMARKS");
col12.setColType(Types.NCHAR); col12.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col12; return col12;
} }
@ -823,7 +822,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col13 = new ColumnMetaData(); ColumnMetaData col13 = new ColumnMetaData();
col13.setColIndex(13); col13.setColIndex(13);
col13.setColName("COLUMN_DEF"); col13.setColName("COLUMN_DEF");
col13.setColType(Types.NCHAR); col13.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col13; return col13;
} }
@ -831,7 +830,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col14 = new ColumnMetaData(); ColumnMetaData col14 = new ColumnMetaData();
col14.setColIndex(14); col14.setColIndex(14);
col14.setColName("SQL_DATA_TYPE"); col14.setColName("SQL_DATA_TYPE");
col14.setColType(Types.INTEGER); col14.setColType(TSDBConstants.TSDB_DATA_TYPE_INT);
return col14; return col14;
} }
@ -839,7 +838,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col15 = new ColumnMetaData(); ColumnMetaData col15 = new ColumnMetaData();
col15.setColIndex(15); col15.setColIndex(15);
col15.setColName("SQL_DATETIME_SUB"); col15.setColName("SQL_DATETIME_SUB");
col15.setColType(Types.INTEGER); col15.setColType(TSDBConstants.TSDB_DATA_TYPE_INT);
return col15; return col15;
} }
@ -847,7 +846,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col16 = new ColumnMetaData(); ColumnMetaData col16 = new ColumnMetaData();
col16.setColIndex(16); col16.setColIndex(16);
col16.setColName("CHAR_OCTET_LENGTH"); col16.setColName("CHAR_OCTET_LENGTH");
col16.setColType(Types.INTEGER); col16.setColType(TSDBConstants.TSDB_DATA_TYPE_INT);
return col16; return col16;
} }
@ -855,7 +854,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col17 = new ColumnMetaData(); ColumnMetaData col17 = new ColumnMetaData();
col17.setColIndex(17); col17.setColIndex(17);
col17.setColName("ORDINAL_POSITION"); col17.setColName("ORDINAL_POSITION");
col17.setColType(Types.INTEGER); col17.setColType(TSDBConstants.TSDB_DATA_TYPE_INT);
return col17; return col17;
} }
@ -863,7 +862,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col18 = new ColumnMetaData(); ColumnMetaData col18 = new ColumnMetaData();
col18.setColIndex(18); col18.setColIndex(18);
col18.setColName("IS_NULLABLE"); col18.setColName("IS_NULLABLE");
col18.setColType(Types.NCHAR); col18.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col18; return col18;
} }
@ -871,7 +870,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col19 = new ColumnMetaData(); ColumnMetaData col19 = new ColumnMetaData();
col19.setColIndex(19); col19.setColIndex(19);
col19.setColName("SCOPE_CATALOG"); col19.setColName("SCOPE_CATALOG");
col19.setColType(Types.NCHAR); col19.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col19; return col19;
} }
@ -879,7 +878,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col20 = new ColumnMetaData(); ColumnMetaData col20 = new ColumnMetaData();
col20.setColIndex(20); col20.setColIndex(20);
col20.setColName("SCOPE_SCHEMA"); col20.setColName("SCOPE_SCHEMA");
col20.setColType(Types.NCHAR); col20.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col20; return col20;
} }
@ -887,7 +886,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col21 = new ColumnMetaData(); ColumnMetaData col21 = new ColumnMetaData();
col21.setColIndex(21); col21.setColIndex(21);
col21.setColName("SCOPE_TABLE"); col21.setColName("SCOPE_TABLE");
col21.setColType(Types.NCHAR); col21.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col21; return col21;
} }
@ -903,7 +902,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col23 = new ColumnMetaData(); ColumnMetaData col23 = new ColumnMetaData();
col23.setColIndex(23); col23.setColIndex(23);
col23.setColName("IS_AUTOINCREMENT"); col23.setColName("IS_AUTOINCREMENT");
col23.setColType(Types.NCHAR); col23.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col23; return col23;
} }
@ -911,7 +910,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col24 = new ColumnMetaData(); ColumnMetaData col24 = new ColumnMetaData();
col24.setColIndex(24); col24.setColIndex(24);
col24.setColName("IS_GENERATEDCOLUMN"); col24.setColName("IS_GENERATEDCOLUMN");
col24.setColType(Types.NCHAR); col24.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col24; return col24;
} }
@ -1205,7 +1204,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col5 = new ColumnMetaData(); ColumnMetaData col5 = new ColumnMetaData();
col5.setColIndex(colIndex); col5.setColIndex(colIndex);
col5.setColName("KEY_SEQ"); col5.setColName("KEY_SEQ");
col5.setColType(Types.SMALLINT); col5.setColType(TSDBConstants.TSDB_DATA_TYPE_SMALLINT);
return col5; return col5;
} }
@ -1213,7 +1212,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col6 = new ColumnMetaData(); ColumnMetaData col6 = new ColumnMetaData();
col6.setColIndex(colIndex); col6.setColIndex(colIndex);
col6.setColName("PK_NAME"); col6.setColName("PK_NAME");
col6.setColType(Types.NCHAR); col6.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col6; return col6;
} }
@ -1275,7 +1274,7 @@ public abstract class AbstractDatabaseMetaData extends WrapperImpl implements Da
ColumnMetaData col4 = new ColumnMetaData(); ColumnMetaData col4 = new ColumnMetaData();
col4.setColIndex(colIndex); col4.setColIndex(colIndex);
col4.setColName("SUPERTABLE_NAME"); col4.setColName("SUPERTABLE_NAME");
col4.setColType(Types.NCHAR); col4.setColType(TSDBConstants.TSDB_DATA_TYPE_NCHAR);
return col4; return col4;
} }

View File

@ -16,7 +16,7 @@ package com.taosdata.jdbc;
public class ColumnMetaData { public class ColumnMetaData {
private int colType = 0; private int colType = 0; //taosType
private String colName = null; private String colName = null;
private int colSize = -1; private int colSize = -1;
private int colIndex = 0; private int colIndex = 0;

View File

@ -68,71 +68,61 @@ public class DatabaseMetaDataResultSet extends AbstractResultSet {
@Override @Override
public String getString(int columnIndex) throws SQLException { public String getString(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return rowCursor.getString(columnIndex, colType);
return rowCursor.getString(columnIndex, nativeType);
} }
@Override @Override
public boolean getBoolean(int columnIndex) throws SQLException { public boolean getBoolean(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return rowCursor.getBoolean(columnIndex, colType);
return rowCursor.getBoolean(columnIndex, nativeType);
} }
@Override @Override
public byte getByte(int columnIndex) throws SQLException { public byte getByte(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return (byte) rowCursor.getInt(columnIndex, colType);
return (byte) rowCursor.getInt(columnIndex, nativeType);
} }
@Override @Override
public short getShort(int columnIndex) throws SQLException { public short getShort(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return (short) rowCursor.getInt(columnIndex, colType);
return (short) rowCursor.getInt(columnIndex, nativeType);
} }
@Override @Override
public int getInt(int columnIndex) throws SQLException { public int getInt(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return rowCursor.getInt(columnIndex, colType);
return rowCursor.getInt(columnIndex, nativeType);
} }
@Override @Override
public long getLong(int columnIndex) throws SQLException { public long getLong(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return rowCursor.getLong(columnIndex, colType);
return rowCursor.getLong(columnIndex, nativeType);
} }
@Override @Override
public float getFloat(int columnIndex) throws SQLException { public float getFloat(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return rowCursor.getFloat(columnIndex, colType);
return rowCursor.getFloat(columnIndex, nativeType);
} }
@Override @Override
public double getDouble(int columnIndex) throws SQLException { public double getDouble(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return rowCursor.getDouble(columnIndex, colType);
return rowCursor.getDouble(columnIndex, nativeType);
} }
@Override @Override
public byte[] getBytes(int columnIndex) throws SQLException { public byte[] getBytes(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return (rowCursor.getString(columnIndex, colType)).getBytes();
return (rowCursor.getString(columnIndex, nativeType)).getBytes();
} }
@Override @Override
public Timestamp getTimestamp(int columnIndex) throws SQLException { public Timestamp getTimestamp(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); return rowCursor.getTimestamp(columnIndex, colType);
return rowCursor.getTimestamp(columnIndex, nativeType);
} }
@Override @Override
@ -158,8 +148,7 @@ public class DatabaseMetaDataResultSet extends AbstractResultSet {
@Override @Override
public BigDecimal getBigDecimal(int columnIndex) throws SQLException { public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
int colType = columnMetaDataList.get(columnIndex - 1).getColType(); int colType = columnMetaDataList.get(columnIndex - 1).getColType();
int nativeType = TSDBConstants.jdbcType2TaosType(colType); double value = rowCursor.getDouble(columnIndex, colType);
double value = rowCursor.getDouble(columnIndex, nativeType);
return new BigDecimal(value); return new BigDecimal(value);
} }

View File

@ -129,8 +129,9 @@ public abstract class TSDBConstants {
return Types.TIMESTAMP; return Types.TIMESTAMP;
case TSDBConstants.TSDB_DATA_TYPE_NCHAR: case TSDBConstants.TSDB_DATA_TYPE_NCHAR:
return Types.NCHAR; return Types.NCHAR;
default:
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNKNOWN_TAOS_TYPE, "unknown taos type: " + taosType + " in tdengine");
} }
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNKNOWN_TAOS_TYPE);
} }
public static String taosType2JdbcTypeName(int taosType) throws SQLException { public static String taosType2JdbcTypeName(int taosType) throws SQLException {
@ -160,7 +161,7 @@ public abstract class TSDBConstants {
case TSDBConstants.TSDB_DATA_TYPE_NCHAR: case TSDBConstants.TSDB_DATA_TYPE_NCHAR:
return "NCHAR"; return "NCHAR";
default: default:
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNKNOWN_TAOS_TYPE); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNKNOWN_TAOS_TYPE, "unknown taos type: " + taosType + " in tdengine");
} }
} }
@ -187,7 +188,7 @@ public abstract class TSDBConstants {
case Types.NCHAR: case Types.NCHAR:
return TSDBConstants.TSDB_DATA_TYPE_NCHAR; return TSDBConstants.TSDB_DATA_TYPE_NCHAR;
} }
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNKNOWN_SQL_TYPE_IN_TDENGINE); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNKNOWN_SQL_TYPE_IN_TDENGINE, "unknown sql type: " + jdbcType + " in tdengine");
} }
public static String jdbcType2TaosTypeName(int jdbcType) throws SQLException { public static String jdbcType2TaosTypeName(int jdbcType) throws SQLException {
@ -213,7 +214,7 @@ public abstract class TSDBConstants {
case Types.NCHAR: case Types.NCHAR:
return "NCHAR"; return "NCHAR";
default: default:
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNKNOWN_SQL_TYPE_IN_TDENGINE); throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_UNKNOWN_SQL_TYPE_IN_TDENGINE, "unknown sql type: " + jdbcType + " in tdengine");
} }
} }

View File

@ -80,7 +80,8 @@ public class TSDBJNIConnector {
this.taos = this.connectImp(host, port, dbName, user, password); this.taos = this.connectImp(host, port, dbName, user, password);
if (this.taos == TSDBConstants.JNI_NULL_POINTER) { if (this.taos == TSDBConstants.JNI_NULL_POINTER) {
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL); String errMsg = this.getErrMsg(0);
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_JNI_CONNECTION_NULL, errMsg);
} }
// invoke connectImp only here // invoke connectImp only here
taosInfo.conn_open_increment(); taosInfo.conn_open_increment();

View File

@ -34,9 +34,8 @@ public class QueryDataTest {
String createTableSql = "create table " + stbName + "(ts timestamp, name binary(64))"; String createTableSql = "create table " + stbName + "(ts timestamp, name binary(64))";
statement.executeUpdate(createTableSql); statement.executeUpdate(createTableSql);
} catch (SQLException e) { } catch (SQLException e) {
return; e.printStackTrace();
} }
} }

View File

@ -0,0 +1,71 @@
package com.taosdata.jdbc.cases;
import com.taosdata.jdbc.TSDBDriver;
import org.junit.Test;
import java.sql.*;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Properties;
public class TimeZoneTest {
private String url = "jdbc:TAOS://127.0.0.1:6030/?user=root&password=taosdata";
@Test
public void javaTimeZone() {
LocalDateTime localDateTime = LocalDateTime.of(1970, 1, 1, 0, 0, 0);
Instant instant = localDateTime.atZone(ZoneId.of("UTC-8")).toInstant();
System.out.println("UTC-8: " + instant.getEpochSecond() + "," + instant);
instant = localDateTime.atZone(ZoneId.of("UT")).toInstant();
System.out.println("UTC: " + instant.getEpochSecond() + "," + instant);
instant = localDateTime.atZone(ZoneId.of("UTC+8")).toInstant();
System.out.println("UTC+8: " + instant.getEpochSecond() + "," + instant);
}
@Test
public void taosTimeZone() {
// given
Properties props = new Properties();
props.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
// when and then
try (Connection connection = DriverManager.getConnection(url, props)) {
Statement stmt = connection.createStatement();
stmt.execute("drop database if exists timezone_test");
stmt.execute("create database if not exists timezone_test keep 365000");
stmt.execute("use timezone_test");
stmt.execute("create table weather(ts timestamp, temperature float)");
stmt.execute("insert into timezone_test.weather(ts, temperature) values('1970-01-01 00:00:00', 1.0)");
ResultSet rs = stmt.executeQuery("select * from timezone_test.weather");
while (rs.next()) {
Timestamp ts = rs.getTimestamp("ts");
System.out.println("ts: " + ts.getTime() + "," + ts);
}
stmt.execute("insert into timezone_test.weather(ts, temperature, humidity) values('1970-01-02 00:00:00', 1.0, 2.0)");
rs = stmt.executeQuery("select * from timezone_test.weather");
while (rs.next()) {
Timestamp ts = rs.getTimestamp("ts");
System.out.println("ts: " + ts.getTime() + "," + ts);
}
stmt.execute("drop database if exists timezone_test");
stmt.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}

View File

@ -223,6 +223,7 @@ do { \
#define TSDB_IPv4ADDR_LEN 16 #define TSDB_IPv4ADDR_LEN 16
#define TSDB_FILENAME_LEN 128 #define TSDB_FILENAME_LEN 128
#define TSDB_SHOW_SQL_LEN 512 #define TSDB_SHOW_SQL_LEN 512
#define TSDB_SHOW_SUBQUERY_LEN 1000
#define TSDB_SLOW_QUERY_SQL_LEN 512 #define TSDB_SLOW_QUERY_SQL_LEN 512
#define TSDB_STEP_NAME_LEN 32 #define TSDB_STEP_NAME_LEN 32

View File

@ -877,7 +877,9 @@ typedef struct {
uint64_t sqlObjId; uint64_t sqlObjId;
int32_t pid; int32_t pid;
char fqdn[TSDB_FQDN_LEN]; char fqdn[TSDB_FQDN_LEN];
bool stableQuery;
int32_t numOfSub; int32_t numOfSub;
char subSqlInfo[TSDB_SHOW_SUBQUERY_LEN]; //include subqueries' index, Obj IDs and states(C-complete/I-imcomplete)
} SQueryDesc; } SQueryDesc;
typedef struct { typedef struct {

View File

@ -94,7 +94,7 @@ STsdbRepo *tsdbOpenRepo(STsdbCfg *pCfg, STsdbAppH *pAppH);
int tsdbCloseRepo(STsdbRepo *repo, int toCommit); int tsdbCloseRepo(STsdbRepo *repo, int toCommit);
int32_t tsdbConfigRepo(STsdbRepo *repo, STsdbCfg *pCfg); int32_t tsdbConfigRepo(STsdbRepo *repo, STsdbCfg *pCfg);
int tsdbGetState(STsdbRepo *repo); int tsdbGetState(STsdbRepo *repo);
bool tsdbInCompact(STsdbRepo *repo); int8_t tsdbGetCompactState(STsdbRepo *repo);
// --------- TSDB TABLE DEFINITION // --------- TSDB TABLE DEFINITION
typedef struct { typedef struct {
uint64_t uid; // the unique table ID uint64_t uid; // the unique table ID

View File

@ -5093,7 +5093,9 @@ static int getRowDataFromSample(
static int64_t generateStbRowData( static int64_t generateStbRowData(
SSuperTable* stbInfo, SSuperTable* stbInfo,
char* recBuf, int64_t timestamp) char* recBuf,
int64_t remainderBufLen,
int64_t timestamp)
{ {
int64_t dataLen = 0; int64_t dataLen = 0;
char *pstr = recBuf; char *pstr = recBuf;
@ -5121,6 +5123,7 @@ static int64_t generateStbRowData(
rand_string(buf, stbInfo->columns[i].dataLen); rand_string(buf, stbInfo->columns[i].dataLen);
dataLen += snprintf(pstr + dataLen, maxLen - dataLen, "\'%s\',", buf); dataLen += snprintf(pstr + dataLen, maxLen - dataLen, "\'%s\',", buf);
tmfree(buf); tmfree(buf);
} else { } else {
char *tmp; char *tmp;
@ -5177,6 +5180,9 @@ static int64_t generateStbRowData(
tstrncpy(pstr + dataLen, ",", 2); tstrncpy(pstr + dataLen, ",", 2);
dataLen += 1; dataLen += 1;
} }
if (dataLen > (remainderBufLen - (DOUBLE_BUFF_LEN + 1)))
return 0;
} }
dataLen -= 1; dataLen -= 1;
@ -5383,7 +5389,7 @@ static int32_t generateDataTailWithoutStb(
int32_t k = 0; int32_t k = 0;
for (k = 0; k < batch;) { for (k = 0; k < batch;) {
char data[MAX_DATA_SIZE]; char *data = pstr;
memset(data, 0, MAX_DATA_SIZE); memset(data, 0, MAX_DATA_SIZE);
int64_t retLen = 0; int64_t retLen = 0;
@ -5407,7 +5413,7 @@ static int32_t generateDataTailWithoutStb(
if (len > remainderBufLen) if (len > remainderBufLen)
break; break;
pstr += sprintf(pstr, "%s", data); pstr += retLen;
k++; k++;
len += retLen; len += retLen;
remainderBufLen -= retLen; remainderBufLen -= retLen;
@ -5463,14 +5469,14 @@ static int32_t generateStbDataTail(
int32_t k; int32_t k;
for (k = 0; k < batch;) { for (k = 0; k < batch;) {
char data[MAX_DATA_SIZE]; char *data = pstr;
memset(data, 0, MAX_DATA_SIZE);
int64_t lenOfRow = 0; int64_t lenOfRow = 0;
if (tsRand) { if (tsRand) {
if (superTblInfo->disorderRatio > 0) { if (superTblInfo->disorderRatio > 0) {
lenOfRow = generateStbRowData(superTblInfo, data, lenOfRow = generateStbRowData(superTblInfo, data,
remainderBufLen,
startTime + getTSRandTail( startTime + getTSRandTail(
superTblInfo->timeStampStep, k, superTblInfo->timeStampStep, k,
superTblInfo->disorderRatio, superTblInfo->disorderRatio,
@ -5478,6 +5484,7 @@ static int32_t generateStbDataTail(
); );
} else { } else {
lenOfRow = generateStbRowData(superTblInfo, data, lenOfRow = generateStbRowData(superTblInfo, data,
remainderBufLen,
startTime + superTblInfo->timeStampStep * k startTime + superTblInfo->timeStampStep * k
); );
} }
@ -5490,11 +5497,15 @@ static int32_t generateStbDataTail(
pSamplePos); pSamplePos);
} }
if (lenOfRow == 0) {
data[0] = '\0';
break;
}
if ((lenOfRow + 1) > remainderBufLen) { if ((lenOfRow + 1) > remainderBufLen) {
break; break;
} }
pstr += snprintf(pstr , lenOfRow + 1, "%s", data); pstr += lenOfRow;
k++; k++;
len += lenOfRow; len += lenOfRow;
remainderBufLen -= lenOfRow; remainderBufLen -= lenOfRow;
@ -6246,7 +6257,7 @@ static int32_t generateStbProgressiveData(
assert(buffer != NULL); assert(buffer != NULL);
char *pstr = buffer; char *pstr = buffer;
memset(buffer, 0, *pRemainderBufLen); memset(pstr, 0, *pRemainderBufLen);
int64_t headLen = generateStbSQLHead( int64_t headLen = generateStbSQLHead(
superTblInfo, superTblInfo,
@ -6640,7 +6651,7 @@ static void* syncWriteProgressive(threadInfo *pThreadInfo) {
return NULL; return NULL;
} }
int64_t remainderBufLen = maxSqlLen; int64_t remainderBufLen = maxSqlLen - 2000;
char *pstr = pThreadInfo->buffer; char *pstr = pThreadInfo->buffer;
int len = snprintf(pstr, int len = snprintf(pstr,
@ -6822,10 +6833,14 @@ static void callBack(void *param, TAOS_RES *res, int code) {
&& rand_num < pThreadInfo->superTblInfo->disorderRatio) { && rand_num < pThreadInfo->superTblInfo->disorderRatio) {
int64_t d = pThreadInfo->lastTs int64_t d = pThreadInfo->lastTs
- (taosRandom() % pThreadInfo->superTblInfo->disorderRange + 1); - (taosRandom() % pThreadInfo->superTblInfo->disorderRange + 1);
generateStbRowData(pThreadInfo->superTblInfo, data, d); generateStbRowData(pThreadInfo->superTblInfo, data,
MAX_DATA_SIZE,
d);
} else { } else {
generateStbRowData(pThreadInfo->superTblInfo, generateStbRowData(pThreadInfo->superTblInfo,
data, pThreadInfo->lastTs += 1000); data,
MAX_DATA_SIZE,
pThreadInfo->lastTs += 1000);
} }
pstr += sprintf(pstr, "%s", data); pstr += sprintf(pstr, "%s", data);
pThreadInfo->counter++; pThreadInfo->counter++;
@ -7050,6 +7065,7 @@ static void startMultiThreadInsertData(int threads, char* db_name,
for (int i = 0; i < threads; i++) { for (int i = 0; i < threads; i++) {
threadInfo *pThreadInfo = infos + i; threadInfo *pThreadInfo = infos + i;
pThreadInfo->threadID = i; pThreadInfo->threadID = i;
tstrncpy(pThreadInfo->db_name, db_name, TSDB_DB_NAME_LEN); tstrncpy(pThreadInfo->db_name, db_name, TSDB_DB_NAME_LEN);
pThreadInfo->time_precision = timePrec; pThreadInfo->time_precision = timePrec;
pThreadInfo->superTblInfo = superTblInfo; pThreadInfo->superTblInfo = superTblInfo;

View File

@ -307,7 +307,7 @@ static void taosDumpCreateTableClause(STableDef *tableDes, int numOfCols,
FILE *fp, char* dbName); FILE *fp, char* dbName);
static void taosDumpCreateMTableClause(STableDef *tableDes, char *metric, static void taosDumpCreateMTableClause(STableDef *tableDes, char *metric,
int numOfCols, FILE *fp, char* dbName); int numOfCols, FILE *fp, char* dbName);
static int32_t taosDumpTable(char *table, char *metric, static int32_t taosDumpTable(char *tbName, char *metric,
FILE *fp, TAOS* taosCon, char* dbName); FILE *fp, TAOS* taosCon, char* dbName);
static int taosDumpTableData(FILE *fp, char *tbName, static int taosDumpTableData(FILE *fp, char *tbName,
TAOS* taosCon, char* dbName, TAOS* taosCon, char* dbName,
@ -798,11 +798,11 @@ static int taosGetTableRecordInfo(
tstrncpy(pTableRecordInfo->tableRecord.name, tstrncpy(pTableRecordInfo->tableRecord.name,
(char *)row[TSDB_SHOW_TABLES_NAME_INDEX], (char *)row[TSDB_SHOW_TABLES_NAME_INDEX],
min(TSDB_TABLE_NAME_LEN, min(TSDB_TABLE_NAME_LEN,
fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes) + 1); fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes + 1));
tstrncpy(pTableRecordInfo->tableRecord.metric, tstrncpy(pTableRecordInfo->tableRecord.metric,
(char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX],
min(TSDB_TABLE_NAME_LEN, min(TSDB_TABLE_NAME_LEN,
fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes) + 1); fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes + 1));
break; break;
} }
@ -945,7 +945,7 @@ static int32_t taosSaveTableOfMetricToTempFile(
int32_t numOfThread = *totalNumOfThread; int32_t numOfThread = *totalNumOfThread;
int subFd = -1; int subFd = -1;
for (; numOfThread < maxThreads; numOfThread++) { for (; numOfThread <= maxThreads; numOfThread++) {
memset(tmpBuf, 0, MAX_FILE_NAME_LEN); memset(tmpBuf, 0, MAX_FILE_NAME_LEN);
sprintf(tmpBuf, ".tables.tmp.%d", numOfThread); sprintf(tmpBuf, ".tables.tmp.%d", numOfThread);
subFd = open(tmpBuf, O_RDWR | O_CREAT | O_TRUNC, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH); subFd = open(tmpBuf, O_RDWR | O_CREAT | O_TRUNC, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH);
@ -1084,7 +1084,7 @@ _dump_db_point:
} }
tstrncpy(g_dbInfos[count]->name, (char *)row[TSDB_SHOW_DB_NAME_INDEX], tstrncpy(g_dbInfos[count]->name, (char *)row[TSDB_SHOW_DB_NAME_INDEX],
min(TSDB_DB_NAME_LEN, fields[TSDB_SHOW_DB_NAME_INDEX].bytes) + 1); min(TSDB_DB_NAME_LEN, fields[TSDB_SHOW_DB_NAME_INDEX].bytes + 1));
if (g_args.with_property) { if (g_args.with_property) {
g_dbInfos[count]->ntables = *((int32_t *)row[TSDB_SHOW_DB_NTABLES_INDEX]); g_dbInfos[count]->ntables = *((int32_t *)row[TSDB_SHOW_DB_NTABLES_INDEX]);
g_dbInfos[count]->vgroups = *((int32_t *)row[TSDB_SHOW_DB_VGROUPS_INDEX]); g_dbInfos[count]->vgroups = *((int32_t *)row[TSDB_SHOW_DB_VGROUPS_INDEX]);
@ -1093,7 +1093,7 @@ _dump_db_point:
g_dbInfos[count]->days = *((int16_t *)row[TSDB_SHOW_DB_DAYS_INDEX]); g_dbInfos[count]->days = *((int16_t *)row[TSDB_SHOW_DB_DAYS_INDEX]);
tstrncpy(g_dbInfos[count]->keeplist, (char *)row[TSDB_SHOW_DB_KEEP_INDEX], tstrncpy(g_dbInfos[count]->keeplist, (char *)row[TSDB_SHOW_DB_KEEP_INDEX],
min(32, fields[TSDB_SHOW_DB_KEEP_INDEX].bytes) + 1); min(32, fields[TSDB_SHOW_DB_KEEP_INDEX].bytes + 1));
//g_dbInfos[count]->daysToKeep = *((int16_t *)row[TSDB_SHOW_DB_KEEP_INDEX]); //g_dbInfos[count]->daysToKeep = *((int16_t *)row[TSDB_SHOW_DB_KEEP_INDEX]);
//g_dbInfos[count]->daysToKeep1; //g_dbInfos[count]->daysToKeep1;
//g_dbInfos[count]->daysToKeep2; //g_dbInfos[count]->daysToKeep2;
@ -1107,7 +1107,7 @@ _dump_db_point:
g_dbInfos[count]->cachelast = (int8_t)(*((int8_t *)row[TSDB_SHOW_DB_CACHELAST_INDEX])); g_dbInfos[count]->cachelast = (int8_t)(*((int8_t *)row[TSDB_SHOW_DB_CACHELAST_INDEX]));
tstrncpy(g_dbInfos[count]->precision, (char *)row[TSDB_SHOW_DB_PRECISION_INDEX], tstrncpy(g_dbInfos[count]->precision, (char *)row[TSDB_SHOW_DB_PRECISION_INDEX],
min(8, fields[TSDB_SHOW_DB_PRECISION_INDEX].bytes) + 1); min(8, fields[TSDB_SHOW_DB_PRECISION_INDEX].bytes + 1));
//g_dbInfos[count]->precision = *((int8_t *)row[TSDB_SHOW_DB_PRECISION_INDEX]); //g_dbInfos[count]->precision = *((int8_t *)row[TSDB_SHOW_DB_PRECISION_INDEX]);
g_dbInfos[count]->update = *((int8_t *)row[TSDB_SHOW_DB_UPDATE_INDEX]); g_dbInfos[count]->update = *((int8_t *)row[TSDB_SHOW_DB_UPDATE_INDEX]);
} }
@ -1237,7 +1237,7 @@ _exit_failure:
static int taosGetTableDes( static int taosGetTableDes(
char* dbName, char *table, char* dbName, char *table,
STableDef *tableDes, TAOS* taosCon, bool isSuperTable) { STableDef *stableDes, TAOS* taosCon, bool isSuperTable) {
TAOS_ROW row = NULL; TAOS_ROW row = NULL;
TAOS_RES* res = NULL; TAOS_RES* res = NULL;
int count = 0; int count = 0;
@ -1256,18 +1256,18 @@ static int taosGetTableDes(
TAOS_FIELD *fields = taos_fetch_fields(res); TAOS_FIELD *fields = taos_fetch_fields(res);
tstrncpy(tableDes->name, table, TSDB_TABLE_NAME_LEN); tstrncpy(stableDes->name, table, TSDB_TABLE_NAME_LEN);
while ((row = taos_fetch_row(res)) != NULL) { while ((row = taos_fetch_row(res)) != NULL) {
tstrncpy(tableDes->cols[count].field, tstrncpy(stableDes->cols[count].field,
(char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX], (char *)row[TSDB_DESCRIBE_METRIC_FIELD_INDEX],
min(TSDB_COL_NAME_LEN + 1, min(TSDB_COL_NAME_LEN + 1,
fields[TSDB_DESCRIBE_METRIC_FIELD_INDEX].bytes + 1)); fields[TSDB_DESCRIBE_METRIC_FIELD_INDEX].bytes + 1));
tstrncpy(tableDes->cols[count].type, tstrncpy(stableDes->cols[count].type,
(char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX], (char *)row[TSDB_DESCRIBE_METRIC_TYPE_INDEX],
min(16, fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes + 1)); min(16, fields[TSDB_DESCRIBE_METRIC_TYPE_INDEX].bytes + 1));
tableDes->cols[count].length = stableDes->cols[count].length =
*((int *)row[TSDB_DESCRIBE_METRIC_LENGTH_INDEX]); *((int *)row[TSDB_DESCRIBE_METRIC_LENGTH_INDEX]);
tstrncpy(tableDes->cols[count].note, tstrncpy(stableDes->cols[count].note,
(char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX], (char *)row[TSDB_DESCRIBE_METRIC_NOTE_INDEX],
min(COL_NOTE_LEN, min(COL_NOTE_LEN,
fields[TSDB_DESCRIBE_METRIC_NOTE_INDEX].bytes + 1)); fields[TSDB_DESCRIBE_METRIC_NOTE_INDEX].bytes + 1));
@ -1284,11 +1284,11 @@ static int taosGetTableDes(
// if chidl-table have tag, using select tagName from table to get tagValue // if chidl-table have tag, using select tagName from table to get tagValue
for (int i = 0 ; i < count; i++) { for (int i = 0 ; i < count; i++) {
if (strcmp(tableDes->cols[i].note, "TAG") != 0) continue; if (strcmp(stableDes->cols[i].note, "TAG") != 0) continue;
sprintf(sqlstr, "select %s from %s.%s", sprintf(sqlstr, "select %s from %s.%s",
tableDes->cols[i].field, dbName, table); stableDes->cols[i].field, dbName, table);
res = taos_query(taosCon, sqlstr); res = taos_query(taosCon, sqlstr);
code = taos_errno(res); code = taos_errno(res);
@ -1310,7 +1310,7 @@ static int taosGetTableDes(
} }
if (row[0] == NULL) { if (row[0] == NULL) {
sprintf(tableDes->cols[i].note, "%s", "NULL"); sprintf(stableDes->cols[i].note, "%s", "NULL");
taos_free_result(res); taos_free_result(res);
res = NULL; res = NULL;
continue; continue;
@ -1321,47 +1321,47 @@ static int taosGetTableDes(
//int32_t* length = taos_fetch_lengths(tmpResult); //int32_t* length = taos_fetch_lengths(tmpResult);
switch (fields[0].type) { switch (fields[0].type) {
case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_BOOL:
sprintf(tableDes->cols[i].note, "%d", sprintf(stableDes->cols[i].note, "%d",
((((int32_t)(*((char *)row[0]))) == 1) ? 1 : 0)); ((((int32_t)(*((char *)row[0]))) == 1) ? 1 : 0));
break; break;
case TSDB_DATA_TYPE_TINYINT: case TSDB_DATA_TYPE_TINYINT:
sprintf(tableDes->cols[i].note, "%d", *((int8_t *)row[0])); sprintf(stableDes->cols[i].note, "%d", *((int8_t *)row[0]));
break; break;
case TSDB_DATA_TYPE_SMALLINT: case TSDB_DATA_TYPE_SMALLINT:
sprintf(tableDes->cols[i].note, "%d", *((int16_t *)row[0])); sprintf(stableDes->cols[i].note, "%d", *((int16_t *)row[0]));
break; break;
case TSDB_DATA_TYPE_INT: case TSDB_DATA_TYPE_INT:
sprintf(tableDes->cols[i].note, "%d", *((int32_t *)row[0])); sprintf(stableDes->cols[i].note, "%d", *((int32_t *)row[0]));
break; break;
case TSDB_DATA_TYPE_BIGINT: case TSDB_DATA_TYPE_BIGINT:
sprintf(tableDes->cols[i].note, "%" PRId64 "", *((int64_t *)row[0])); sprintf(stableDes->cols[i].note, "%" PRId64 "", *((int64_t *)row[0]));
break; break;
case TSDB_DATA_TYPE_FLOAT: case TSDB_DATA_TYPE_FLOAT:
sprintf(tableDes->cols[i].note, "%f", GET_FLOAT_VAL(row[0])); sprintf(stableDes->cols[i].note, "%f", GET_FLOAT_VAL(row[0]));
break; break;
case TSDB_DATA_TYPE_DOUBLE: case TSDB_DATA_TYPE_DOUBLE:
sprintf(tableDes->cols[i].note, "%f", GET_DOUBLE_VAL(row[0])); sprintf(stableDes->cols[i].note, "%f", GET_DOUBLE_VAL(row[0]));
break; break;
case TSDB_DATA_TYPE_BINARY: case TSDB_DATA_TYPE_BINARY:
{ {
memset(tableDes->cols[i].note, 0, sizeof(tableDes->cols[i].note)); memset(stableDes->cols[i].note, 0, sizeof(stableDes->cols[i].note));
tableDes->cols[i].note[0] = '\''; stableDes->cols[i].note[0] = '\'';
char tbuf[COL_NOTE_LEN]; char tbuf[COL_NOTE_LEN];
converStringToReadable((char *)row[0], length[0], tbuf, COL_NOTE_LEN); converStringToReadable((char *)row[0], length[0], tbuf, COL_NOTE_LEN);
char* pstr = stpcpy(&(tableDes->cols[i].note[1]), tbuf); char* pstr = stpcpy(&(stableDes->cols[i].note[1]), tbuf);
*(pstr++) = '\''; *(pstr++) = '\'';
break; break;
} }
case TSDB_DATA_TYPE_NCHAR: case TSDB_DATA_TYPE_NCHAR:
{ {
memset(tableDes->cols[i].note, 0, sizeof(tableDes->cols[i].note)); memset(stableDes->cols[i].note, 0, sizeof(stableDes->cols[i].note));
char tbuf[COL_NOTE_LEN-2]; // need reserve 2 bytes for ' ' char tbuf[COL_NOTE_LEN-2]; // need reserve 2 bytes for ' '
convertNCharToReadable((char *)row[0], length[0], tbuf, COL_NOTE_LEN); convertNCharToReadable((char *)row[0], length[0], tbuf, COL_NOTE_LEN);
sprintf(tableDes->cols[i].note, "\'%s\'", tbuf); sprintf(stableDes->cols[i].note, "\'%s\'", tbuf);
break; break;
} }
case TSDB_DATA_TYPE_TIMESTAMP: case TSDB_DATA_TYPE_TIMESTAMP:
sprintf(tableDes->cols[i].note, "%" PRId64 "", *(int64_t *)row[0]); sprintf(stableDes->cols[i].note, "%" PRId64 "", *(int64_t *)row[0]);
#if 0 #if 0
if (!g_args.mysqlFlag) { if (!g_args.mysqlFlag) {
sprintf(tableDes->cols[i].note, "%" PRId64 "", *(int64_t *)row[0]); sprintf(tableDes->cols[i].note, "%" PRId64 "", *(int64_t *)row[0]);
@ -1386,7 +1386,7 @@ static int taosGetTableDes(
return count; return count;
} }
static int convertSchemaToAvroSchema(STableDef *tableDes, char **avroSchema) static int convertSchemaToAvroSchema(STableDef *stableDes, char **avroSchema)
{ {
errorPrint("%s() LN%d TODO: covert table schema to avro schema\n", errorPrint("%s() LN%d TODO: covert table schema to avro schema\n",
__func__, __LINE__); __func__, __LINE__);
@ -1394,7 +1394,7 @@ static int convertSchemaToAvroSchema(STableDef *tableDes, char **avroSchema)
} }
static int32_t taosDumpTable( static int32_t taosDumpTable(
char *table, char *metric, char *tbName, char *metric,
FILE *fp, TAOS* taosCon, char* dbName) { FILE *fp, TAOS* taosCon, char* dbName) {
int count = 0; int count = 0;
@ -1415,7 +1415,7 @@ static int32_t taosDumpTable(
memset(tableDes, 0, sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS); memset(tableDes, 0, sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS);
*/ */
count = taosGetTableDes(dbName, table, tableDes, taosCon, false); count = taosGetTableDes(dbName, tbName, tableDes, taosCon, false);
if (count < 0) { if (count < 0) {
free(tableDes); free(tableDes);
@ -1426,7 +1426,7 @@ static int32_t taosDumpTable(
taosDumpCreateMTableClause(tableDes, metric, count, fp, dbName); taosDumpCreateMTableClause(tableDes, metric, count, fp, dbName);
} else { // dump table definition } else { // dump table definition
count = taosGetTableDes(dbName, table, tableDes, taosCon, false); count = taosGetTableDes(dbName, tbName, tableDes, taosCon, false);
if (count < 0) { if (count < 0) {
free(tableDes); free(tableDes);
@ -1446,7 +1446,7 @@ static int32_t taosDumpTable(
int32_t ret = 0; int32_t ret = 0;
if (!g_args.schemaonly) { if (!g_args.schemaonly) {
ret = taosDumpTableData(fp, table, taosCon, dbName, ret = taosDumpTableData(fp, tbName, taosCon, dbName,
jsonAvroSchema); jsonAvroSchema);
} }
@ -1648,26 +1648,27 @@ static void taosStartDumpOutWorkThreads(int32_t numOfThread, char *dbName)
static int32_t taosDumpStable(char *table, FILE *fp, static int32_t taosDumpStable(char *table, FILE *fp,
TAOS* taosCon, char* dbName) { TAOS* taosCon, char* dbName) {
uint64_t sizeOfTableDes = (uint64_t)(sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS); uint64_t sizeOfTableDes =
STableDef *tableDes = (STableDef *)calloc(1, sizeOfTableDes); (uint64_t)(sizeof(STableDef) + sizeof(SColDes) * TSDB_MAX_COLUMNS);
if (NULL == tableDes) { STableDef *stableDes = (STableDef *)calloc(1, sizeOfTableDes);
if (NULL == stableDes) {
errorPrint("%s() LN%d, failed to allocate %"PRIu64" memory\n", errorPrint("%s() LN%d, failed to allocate %"PRIu64" memory\n",
__func__, __LINE__, sizeOfTableDes); __func__, __LINE__, sizeOfTableDes);
exit(-1); exit(-1);
} }
int count = taosGetTableDes(dbName, table, tableDes, taosCon, true); int count = taosGetTableDes(dbName, table, stableDes, taosCon, true);
if (count < 0) { if (count < 0) {
free(tableDes); free(stableDes);
errorPrint("%s() LN%d, failed to get stable[%s] schema\n", errorPrint("%s() LN%d, failed to get stable[%s] schema\n",
__func__, __LINE__, table); __func__, __LINE__, table);
exit(-1); exit(-1);
} }
taosDumpCreateTableClause(tableDes, count, fp, dbName); taosDumpCreateTableClause(stableDes, count, fp, dbName);
free(tableDes); free(stableDes);
return 0; return 0;
} }
@ -1707,7 +1708,7 @@ static int32_t taosDumpCreateSuperTableClause(TAOS* taosCon, char* dbName, FILE
memset(&tableRecord, 0, sizeof(STableRecord)); memset(&tableRecord, 0, sizeof(STableRecord));
tstrncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], tstrncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX],
min(TSDB_TABLE_NAME_LEN, min(TSDB_TABLE_NAME_LEN,
fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes) + 1); fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes + 1));
taosWrite(fd, &tableRecord, sizeof(STableRecord)); taosWrite(fd, &tableRecord, sizeof(STableRecord));
} }
@ -1782,10 +1783,10 @@ static int taosDumpDb(SDbInfo *dbInfo, FILE *fp, TAOS *taosCon) {
memset(&tableRecord, 0, sizeof(STableRecord)); memset(&tableRecord, 0, sizeof(STableRecord));
tstrncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX], tstrncpy(tableRecord.name, (char *)row[TSDB_SHOW_TABLES_NAME_INDEX],
min(TSDB_TABLE_NAME_LEN, min(TSDB_TABLE_NAME_LEN,
fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes) + 1); fields[TSDB_SHOW_TABLES_NAME_INDEX].bytes + 1));
tstrncpy(tableRecord.metric, (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX], tstrncpy(tableRecord.metric, (char *)row[TSDB_SHOW_TABLES_METRIC_INDEX],
min(TSDB_TABLE_NAME_LEN, min(TSDB_TABLE_NAME_LEN,
fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes) + 1); fields[TSDB_SHOW_TABLES_METRIC_INDEX].bytes + 1));
taosWrite(fd, &tableRecord, sizeof(STableRecord)); taosWrite(fd, &tableRecord, sizeof(STableRecord));

View File

@ -32,7 +32,8 @@
#define CONN_KEEP_TIME (tsShellActivityTimer * 3) #define CONN_KEEP_TIME (tsShellActivityTimer * 3)
#define CONN_CHECK_TIME (tsShellActivityTimer * 2) #define CONN_CHECK_TIME (tsShellActivityTimer * 2)
#define QUERY_ID_SIZE 20 #define QUERY_ID_SIZE 20
#define QUERY_OBJ_ID_SIZE 10 #define QUERY_OBJ_ID_SIZE 18
#define SUBQUERY_INFO_SIZE 6
#define QUERY_STREAM_SAVE_SIZE 20 #define QUERY_STREAM_SAVE_SIZE 20
static SCacheObj *tsMnodeConnCache = NULL; static SCacheObj *tsMnodeConnCache = NULL;
@ -380,12 +381,24 @@ static int32_t mnodeGetQueryMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pC
pSchema[cols].bytes = htons(pShow->bytes[cols]); pSchema[cols].bytes = htons(pShow->bytes[cols]);
cols++; cols++;
pShow->bytes[cols] = 1;
pSchema[cols].type = TSDB_DATA_TYPE_BOOL;
strcpy(pSchema[cols].name, "stable_query");
pSchema[cols].bytes = htons(pShow->bytes[cols]);
cols++;
pShow->bytes[cols] = 4; pShow->bytes[cols] = 4;
pSchema[cols].type = TSDB_DATA_TYPE_INT; pSchema[cols].type = TSDB_DATA_TYPE_INT;
strcpy(pSchema[cols].name, "sub_queries"); strcpy(pSchema[cols].name, "sub_queries");
pSchema[cols].bytes = htons(pShow->bytes[cols]); pSchema[cols].bytes = htons(pShow->bytes[cols]);
cols++; cols++;
pShow->bytes[cols] = TSDB_SHOW_SUBQUERY_LEN + VARSTR_HEADER_SIZE;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
strcpy(pSchema[cols].name, "sub_query_info");
pSchema[cols].bytes = htons(pShow->bytes[cols]);
cols++;
pShow->bytes[cols] = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE; pShow->bytes[cols] = TSDB_SHOW_SQL_LEN + VARSTR_HEADER_SIZE;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY; pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
strcpy(pSchema[cols].name, "sql"); strcpy(pSchema[cols].name, "sql");
@ -459,12 +472,8 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
*(int64_t *)pWrite = htobe64(pDesc->useconds); *(int64_t *)pWrite = htobe64(pDesc->useconds);
cols++; cols++;
/*
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; snprintf(str, tListLen(str), "0x%" PRIx64, htobe64(pDesc->sqlObjId));
*(int64_t *)pWrite = htobe64(pDesc->sqlObjId);
cols++;
*/
snprintf(str, tListLen(str), "0x%08" PRIx64, htobe64(pDesc->sqlObjId));
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->bytes[cols]); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, str, pShow->bytes[cols]);
cols++; cols++;
@ -479,10 +488,18 @@ static int32_t mnodeRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, v
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, epBuf, pShow->bytes[cols]); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, epBuf, pShow->bytes[cols]);
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
*(bool *)pWrite = pDesc->stableQuery;
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
*(int32_t *)pWrite = htonl(pDesc->numOfSub); *(int32_t *)pWrite = htonl(pDesc->numOfSub);
cols++; cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->subSqlInfo, pShow->bytes[cols]);
cols++;
pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows;
STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, pShow->bytes[cols]); STR_WITH_MAXSIZE_TO_VARSTR(pWrite, pDesc->sql, pShow->bytes[cols]);
cols++; cols++;

View File

@ -97,7 +97,7 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision);
int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision); int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision);
int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision); int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char unit, int32_t precision);
int32_t parseAbsoluteDuration(char* token, int32_t tokenlen, int64_t* ts, int32_t timePrecision); int32_t parseAbsoluteDuration(char* token, int32_t tokenlen, int64_t* ts, char* unit, int32_t timePrecision);
int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* duration, char* unit, int32_t timePrecision); int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* duration, char* unit, int32_t timePrecision);
int32_t taosParseTime(char* timestr, int64_t* time, int32_t len, int32_t timePrec, int8_t dayligth); int32_t taosParseTime(char* timestr, int64_t* time, int32_t len, int32_t timePrec, int8_t dayligth);

View File

@ -397,7 +397,7 @@ static int32_t getDuration(int64_t val, char unit, int64_t* result, int32_t time
* n - Months (30 days) * n - Months (30 days)
* y - Years (365 days) * y - Years (365 days)
*/ */
int32_t parseAbsoluteDuration(char* token, int32_t tokenlen, int64_t* duration, int32_t timePrecision) { int32_t parseAbsoluteDuration(char* token, int32_t tokenlen, int64_t* duration, char* unit, int32_t timePrecision) {
errno = 0; errno = 0;
char* endPtr = NULL; char* endPtr = NULL;
@ -408,12 +408,12 @@ int32_t parseAbsoluteDuration(char* token, int32_t tokenlen, int64_t* duration,
} }
/* natual month/year are not allowed in absolute duration */ /* natual month/year are not allowed in absolute duration */
char unit = token[tokenlen - 1]; *unit = token[tokenlen - 1];
if (unit == 'n' || unit == 'y') { if (*unit == 'n' || *unit == 'y') {
return -1; return -1;
} }
return getDuration(timestamp, unit, duration, timePrecision); return getDuration(timestamp, *unit, duration, timePrecision);
} }
int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* duration, char* unit, int32_t timePrecision) { int32_t parseNatualDuration(const char* token, int32_t tokenLen, int64_t* duration, char* unit, int32_t timePrecision) {

View File

@ -72,6 +72,7 @@ typedef struct STableMeta {
typedef struct STableMetaInfo { typedef struct STableMetaInfo {
STableMeta *pTableMeta; // table meta, cached in client side and acquired by name STableMeta *pTableMeta; // table meta, cached in client side and acquired by name
uint32_t tableMetaSize; uint32_t tableMetaSize;
size_t tableMetaCapacity;
SVgroupsInfo *vgroupList; SVgroupsInfo *vgroupList;
SArray *pVgroupTables; // SArray<SVgroupTableInfo> SArray *pVgroupTables; // SArray<SVgroupTableInfo>

View File

@ -479,7 +479,7 @@ tagitem(A) ::= PLUS(X) FLOAT(Y). {
//////////////////////// The SELECT statement ///////////////////////////////// //////////////////////// The SELECT statement /////////////////////////////////
%type select {SSqlNode*} %type select {SSqlNode*}
%destructor select {destroySqlNode($$);} %destructor select {destroySqlNode($$);}
select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) interval_opt(K) session_option(H) windowstate_option(D) fill_opt(F) sliding_opt(S) groupby_opt(P) having_opt(N) orderby_opt(Z) slimit_opt(G) limit_opt(L). { select(A) ::= SELECT(T) selcollist(W) from(X) where_opt(Y) interval_opt(K) sliding_opt(S) session_option(H) windowstate_option(D) fill_opt(F)groupby_opt(P) having_opt(N) orderby_opt(Z) slimit_opt(G) limit_opt(L). {
A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &D, &S, F, &L, &G, N); A = tSetQuerySqlNode(&T, W, X, Y, P, Z, &K, &H, &D, &S, F, &L, &G, N);
} }

View File

@ -6661,19 +6661,20 @@ static SSDataBlock* hashDistinct(void* param, bool* newgroup) {
if (isNull(val, type)) { if (isNull(val, type)) {
continue; continue;
} }
char* p = val;
size_t keyLen = 0; size_t keyLen = 0;
if (IS_VAR_DATA_TYPE(pOperator->pExpr->base.colType)) { if (IS_VAR_DATA_TYPE(pOperator->pExpr->base.colType)) {
tstr* var = (tstr*)(val); tstr* var = (tstr*)(val);
p = var->data;
keyLen = varDataLen(var); keyLen = varDataLen(var);
} else { } else {
keyLen = bytes; keyLen = bytes;
} }
int dummy; int dummy;
void* res = taosHashGet(pInfo->pSet, val, keyLen); void* res = taosHashGet(pInfo->pSet, p, keyLen);
if (res == NULL) { if (res == NULL) {
taosHashPut(pInfo->pSet, val, keyLen, &dummy, sizeof(dummy)); taosHashPut(pInfo->pSet, p, keyLen, &dummy, sizeof(dummy));
char* start = pResultColInfoData->pData + bytes * pInfo->pRes->info.rows; char* start = pResultColInfoData->pData + bytes * pInfo->pRes->info.rows;
memcpy(start, val, bytes); memcpy(start, val, bytes);
pRes->info.rows += 1; pRes->info.rows += 1;

View File

@ -32,8 +32,8 @@ typedef struct SJoinCond {
SColumn *colCond[2]; SColumn *colCond[2];
} SJoinCond; } SJoinCond;
static SQueryNode* createQueryNode(int32_t type, const char* name, SQueryNode** prev, static SQueryNode* createQueryNode(int32_t type, const char* name, SQueryNode** prev, int32_t numOfPrev,
int32_t numOfPrev, SExprInfo** pExpr, int32_t numOfOutput, SQueryTableInfo* pTableInfo, SExprInfo** pExpr, int32_t numOfOutput, SQueryTableInfo* pTableInfo,
void* pExtInfo) { void* pExtInfo) {
SQueryNode* pNode = calloc(1, sizeof(SQueryNode)); SQueryNode* pNode = calloc(1, sizeof(SQueryNode));
@ -112,8 +112,8 @@ static SQueryNode* doAddTableColumnNode(SQueryInfo* pQueryInfo, STableMetaInfo*
} }
STimeWindow* window = &pQueryInfo->window; STimeWindow* window = &pQueryInfo->window;
SQueryNode* pNode = createQueryNode(QNODE_TABLESCAN, "TableScan", NULL, 0, NULL, 0, SQueryNode* pNode = createQueryNode(QNODE_TABLESCAN, "TableScan", NULL, 0, NULL, 0, info, window);
info, window);
if (pQueryInfo->projectionQuery) { if (pQueryInfo->projectionQuery) {
int32_t numOfOutput = (int32_t) taosArrayGetSize(pExprs); int32_t numOfOutput = (int32_t) taosArrayGetSize(pExprs);
pNode = createQueryNode(QNODE_PROJECT, "Projection", &pNode, 1, pExprs->pData, numOfOutput, info, NULL); pNode = createQueryNode(QNODE_PROJECT, "Projection", &pNode, 1, pExprs->pData, numOfOutput, info, NULL);
@ -149,23 +149,26 @@ static SQueryNode* doCreateQueryPlanForOneTableImpl(SQueryInfo* pQueryInfo, SQue
SArray* pExprs) { SArray* pExprs) {
// check for aggregation // check for aggregation
if (pQueryInfo->interval.interval > 0) { if (pQueryInfo->interval.interval > 0) {
int32_t numOfOutput = (int32_t) taosArrayGetSize(pExprs); int32_t numOfOutput = (int32_t)taosArrayGetSize(pExprs);
pNode = createQueryNode(QNODE_TIMEWINDOW, "TimeWindowAgg", &pNode, 1, pExprs->pData, numOfOutput, info, pNode = createQueryNode(QNODE_TIMEWINDOW, "TimeWindowAgg", &pNode, 1, pExprs->pData, numOfOutput, info,
&pQueryInfo->interval); &pQueryInfo->interval);
if (pQueryInfo->groupbyExpr.numOfGroupCols != 0) {
pNode = createQueryNode(QNODE_GROUPBY, "Groupby", &pNode, 1, pExprs->pData, numOfOutput, info, &pQueryInfo->groupbyExpr);
}
} else if (pQueryInfo->groupbyColumn) { } else if (pQueryInfo->groupbyColumn) {
int32_t numOfOutput = (int32_t) taosArrayGetSize(pExprs); int32_t numOfOutput = (int32_t)taosArrayGetSize(pExprs);
pNode = createQueryNode(QNODE_GROUPBY, "Groupby", &pNode, 1, pExprs->pData, numOfOutput, info, pNode = createQueryNode(QNODE_GROUPBY, "Groupby", &pNode, 1, pExprs->pData, numOfOutput, info,
&pQueryInfo->groupbyExpr); &pQueryInfo->groupbyExpr);
} else if (pQueryInfo->sessionWindow.gap > 0) { } else if (pQueryInfo->sessionWindow.gap > 0) {
pNode = createQueryNode(QNODE_SESSIONWINDOW, "SessionWindowAgg", &pNode, 1, NULL, 0, info, NULL); pNode = createQueryNode(QNODE_SESSIONWINDOW, "SessionWindowAgg", &pNode, 1, NULL, 0, info, NULL);
} else if (pQueryInfo->simpleAgg) { } else if (pQueryInfo->simpleAgg) {
int32_t numOfOutput = (int32_t) taosArrayGetSize(pExprs); int32_t numOfOutput = (int32_t)taosArrayGetSize(pExprs);
pNode = createQueryNode(QNODE_AGGREGATE, "Aggregate", &pNode, 1, pExprs->pData, numOfOutput, info, NULL); pNode = createQueryNode(QNODE_AGGREGATE, "Aggregate", &pNode, 1, pExprs->pData, numOfOutput, info, NULL);
} }
if (pQueryInfo->havingFieldNum > 0 || pQueryInfo->arithmeticOnAgg) { if (pQueryInfo->havingFieldNum > 0 || pQueryInfo->arithmeticOnAgg) {
int32_t numOfExpr = (int32_t) taosArrayGetSize(pQueryInfo->exprList1); int32_t numOfExpr = (int32_t)taosArrayGetSize(pQueryInfo->exprList1);
pNode = pNode =
createQueryNode(QNODE_PROJECT, "Projection", &pNode, 1, pQueryInfo->exprList1->pData, numOfExpr, info, NULL); createQueryNode(QNODE_PROJECT, "Projection", &pNode, 1, pQueryInfo->exprList1->pData, numOfExpr, info, NULL);
} }
@ -179,7 +182,6 @@ static SQueryNode* doCreateQueryPlanForOneTableImpl(SQueryInfo* pQueryInfo, SQue
pNode = createQueryNode(QNODE_FILL, "Fill", &pNode, 1, NULL, 0, info, pInfo); pNode = createQueryNode(QNODE_FILL, "Fill", &pNode, 1, NULL, 0, info, pInfo);
} }
if (pQueryInfo->limit.limit != -1 || pQueryInfo->limit.offset != 0) { if (pQueryInfo->limit.limit != -1 || pQueryInfo->limit.offset != 0) {
pNode = createQueryNode(QNODE_LIMIT, "Limit", &pNode, 1, NULL, 0, info, &pQueryInfo->limit); pNode = createQueryNode(QNODE_LIMIT, "Limit", &pNode, 1, NULL, 0, info, &pQueryInfo->limit);
} }
@ -330,7 +332,7 @@ static int32_t doPrintPlan(char* buf, SQueryNode* pQueryNode, int32_t level, int
switch(pQueryNode->info.type) { switch(pQueryNode->info.type) {
case QNODE_TABLESCAN: { case QNODE_TABLESCAN: {
STimeWindow* win = (STimeWindow*)pQueryNode->pExtInfo; STimeWindow* win = (STimeWindow*)pQueryNode->pExtInfo;
len1 = sprintf(buf + len, "%s #0x%" PRIx64 ") time_range: %" PRId64 " - %" PRId64 "\n", len1 = sprintf(buf + len, "%s #%" PRIu64 ") time_range: %" PRId64 " - %" PRId64 "\n",
pQueryNode->tableInfo.tableName, pQueryNode->tableInfo.id.uid, win->skey, win->ekey); pQueryNode->tableInfo.tableName, pQueryNode->tableInfo.id.uid, win->skey, win->ekey);
len += len1; len += len1;
break; break;
@ -401,8 +403,8 @@ static int32_t doPrintPlan(char* buf, SQueryNode* pQueryNode, int32_t level, int
len += len1; len += len1;
SInterval* pInterval = pQueryNode->pExtInfo; SInterval* pInterval = pQueryNode->pExtInfo;
len1 = sprintf(buf + len, "interval:%" PRId64 "(%c), sliding:%" PRId64 "(%c), offset:%" PRId64 "\n", len1 = sprintf(buf + len, "interval:%" PRId64 "(%s), sliding:%" PRId64 "(%s), offset:%" PRId64 "\n",
pInterval->interval, pInterval->intervalUnit, pInterval->sliding, pInterval->slidingUnit, pInterval->interval, TSDB_TIME_PRECISION_MILLI_STR, pInterval->sliding, TSDB_TIME_PRECISION_MILLI_STR,
pInterval->offset); pInterval->offset);
len += len1; len += len1;

View File

@ -166,7 +166,8 @@ tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType) {
// use nanosecond by default // use nanosecond by default
// TODO set value after getting database precision // TODO set value after getting database precision
if (pToken) { if (pToken) {
int32_t ret = parseAbsoluteDuration(pToken->z, pToken->n, &pSqlExpr->value.i64, TSDB_TIME_PRECISION_NANO); char unit = 0;
int32_t ret = parseAbsoluteDuration(pToken->z, pToken->n, &pSqlExpr->value.i64, &unit, TSDB_TIME_PRECISION_NANO);
if (ret != TSDB_CODE_SUCCESS) { if (ret != TSDB_CODE_SUCCESS) {
terrno = TSDB_CODE_TSC_SQL_SYNTAX_ERROR; terrno = TSDB_CODE_TSC_SQL_SYNTAX_ERROR;
} }

View File

@ -257,27 +257,27 @@ static const YYACTIONTYPE yy_action[] = {
/* 480 */ 208, 211, 205, 212, 213, 217, 218, 219, 216, 202, /* 480 */ 208, 211, 205, 212, 213, 217, 218, 219, 216, 202,
/* 490 */ 1143, 1082, 1135, 236, 267, 1079, 1078, 237, 338, 151, /* 490 */ 1143, 1082, 1135, 236, 267, 1079, 1078, 237, 338, 151,
/* 500 */ 1035, 1046, 47, 1065, 1043, 149, 1064, 1025, 1028, 1044, /* 500 */ 1035, 1046, 47, 1065, 1043, 149, 1064, 1025, 1028, 1044,
/* 510 */ 274, 1048, 153, 170, 157, 1009, 278, 283, 171, 1007, /* 510 */ 274, 1048, 153, 170, 158, 1009, 278, 285, 171, 1007,
/* 520 */ 172, 233, 166, 280, 161, 757, 160, 173, 162, 922, /* 520 */ 172, 233, 166, 280, 161, 757, 160, 173, 162, 922,
/* 530 */ 163, 299, 300, 301, 304, 305, 287, 292, 45, 290, /* 530 */ 163, 299, 300, 301, 304, 305, 282, 292, 45, 290,
/* 540 */ 75, 200, 288, 813, 272, 41, 72, 49, 316, 164, /* 540 */ 75, 200, 288, 813, 272, 41, 72, 49, 316, 164,
/* 550 */ 916, 323, 1142, 110, 1141, 1138, 286, 179, 330, 1134, /* 550 */ 916, 323, 1142, 110, 1141, 1138, 286, 179, 330, 1134,
/* 560 */ 284, 116, 1133, 1130, 180, 282, 942, 42, 39, 46, /* 560 */ 284, 116, 1133, 1130, 180, 281, 942, 42, 39, 46,
/* 570 */ 201, 904, 279, 126, 48, 902, 128, 129, 900, 899, /* 570 */ 201, 904, 279, 126, 303, 902, 128, 129, 900, 899,
/* 580 */ 259, 191, 897, 896, 895, 894, 893, 892, 891, 194, /* 580 */ 259, 191, 897, 896, 895, 894, 893, 892, 891, 194,
/* 590 */ 196, 888, 886, 884, 882, 198, 879, 199, 303, 81, /* 590 */ 196, 888, 886, 884, 882, 198, 879, 199, 48, 81,
/* 600 */ 86, 348, 281, 1066, 121, 340, 341, 342, 343, 344, /* 600 */ 86, 348, 283, 1066, 121, 340, 341, 342, 343, 344,
/* 610 */ 223, 345, 346, 356, 855, 243, 298, 260, 261, 854, /* 610 */ 223, 345, 346, 356, 855, 243, 298, 260, 261, 854,
/* 620 */ 263, 220, 221, 264, 853, 836, 104, 921, 920, 105, /* 620 */ 263, 220, 221, 264, 853, 836, 104, 921, 920, 105,
/* 630 */ 835, 268, 273, 10, 293, 734, 275, 84, 30, 87, /* 630 */ 835, 268, 273, 10, 293, 734, 275, 84, 30, 898,
/* 640 */ 898, 890, 182, 943, 186, 181, 184, 140, 183, 187, /* 640 */ 890, 183, 182, 943, 187, 181, 184, 185, 2, 140,
/* 650 */ 185, 141, 142, 889, 4, 143, 980, 881, 880, 944, /* 650 */ 186, 141, 142, 889, 4, 143, 980, 881, 87, 944,
/* 660 */ 759, 165, 167, 168, 155, 169, 762, 156, 2, 990, /* 660 */ 759, 165, 167, 168, 169, 880, 155, 157, 768, 156,
/* 670 */ 88, 235, 764, 89, 285, 31, 768, 158, 11, 12, /* 670 */ 235, 762, 88, 89, 990, 764, 287, 31, 11, 32,
/* 680 */ 13, 32, 27, 295, 28, 96, 98, 101, 35, 100, /* 680 */ 12, 13, 27, 295, 28, 96, 98, 101, 35, 100,
/* 690 */ 632, 36, 102, 667, 665, 664, 663, 661, 660, 659, /* 690 */ 632, 36, 102, 667, 665, 664, 663, 661, 660, 659,
/* 700 */ 656, 314, 622, 106, 7, 320, 812, 814, 8, 321, /* 700 */ 656, 314, 622, 106, 7, 320, 812, 321, 8, 109,
/* 710 */ 109, 111, 68, 69, 115, 704, 703, 38, 117, 700, /* 710 */ 814, 111, 68, 69, 115, 704, 703, 38, 117, 700,
/* 720 */ 648, 646, 638, 644, 640, 642, 636, 634, 670, 669, /* 720 */ 648, 646, 638, 644, 640, 642, 636, 634, 670, 669,
/* 730 */ 668, 666, 662, 658, 657, 190, 620, 585, 583, 859, /* 730 */ 668, 666, 662, 658, 657, 190, 620, 585, 583, 859,
/* 740 */ 858, 858, 858, 858, 858, 858, 858, 858, 858, 858, /* 740 */ 858, 858, 858, 858, 858, 858, 858, 858, 858, 858,
@ -338,24 +338,24 @@ static const YYCODETYPE yy_lookahead[] = {
/* 510 */ 246, 199, 199, 250, 199, 246, 269, 199, 199, 199, /* 510 */ 246, 199, 199, 250, 199, 246, 269, 199, 199, 199,
/* 520 */ 199, 269, 254, 269, 259, 124, 260, 199, 258, 199, /* 520 */ 199, 269, 254, 269, 259, 124, 260, 199, 258, 199,
/* 530 */ 257, 199, 199, 199, 199, 199, 269, 130, 199, 134, /* 530 */ 257, 199, 199, 199, 199, 199, 269, 130, 199, 134,
/* 540 */ 136, 199, 129, 117, 200, 199, 138, 135, 199, 256, /* 540 */ 136, 199, 128, 117, 200, 199, 138, 135, 199, 256,
/* 550 */ 199, 199, 199, 199, 199, 199, 128, 199, 199, 199, /* 550 */ 199, 199, 199, 199, 199, 199, 127, 199, 199, 199,
/* 560 */ 127, 199, 199, 199, 199, 126, 199, 199, 199, 199, /* 560 */ 126, 199, 199, 199, 199, 129, 199, 199, 199, 199,
/* 570 */ 199, 199, 125, 199, 140, 199, 199, 199, 199, 199, /* 570 */ 199, 199, 125, 199, 89, 199, 199, 199, 199, 199,
/* 580 */ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, /* 580 */ 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
/* 590 */ 199, 199, 199, 199, 199, 199, 199, 199, 89, 200, /* 590 */ 199, 199, 199, 199, 199, 199, 199, 199, 140, 200,
/* 600 */ 200, 113, 200, 200, 96, 95, 51, 92, 94, 55, /* 600 */ 200, 113, 200, 200, 96, 95, 51, 92, 94, 55,
/* 610 */ 200, 93, 91, 84, 5, 200, 200, 153, 5, 5, /* 610 */ 200, 93, 91, 84, 5, 200, 200, 153, 5, 5,
/* 620 */ 153, 200, 200, 5, 5, 100, 206, 210, 210, 206, /* 620 */ 153, 200, 200, 5, 5, 100, 206, 210, 210, 206,
/* 630 */ 99, 142, 120, 82, 115, 83, 97, 121, 82, 97, /* 630 */ 99, 142, 120, 82, 115, 83, 97, 121, 82, 200,
/* 640 */ 200, 200, 217, 219, 215, 218, 216, 201, 213, 212, /* 640 */ 200, 213, 217, 219, 212, 218, 216, 214, 207, 201,
/* 650 */ 214, 201, 201, 200, 202, 201, 237, 200, 200, 221, /* 650 */ 215, 201, 201, 200, 202, 201, 237, 200, 97, 221,
/* 660 */ 83, 255, 253, 252, 82, 251, 83, 97, 207, 237, /* 660 */ 83, 255, 253, 252, 251, 200, 82, 97, 83, 82,
/* 670 */ 82, 1, 83, 82, 82, 97, 83, 82, 131, 131, /* 670 */ 1, 83, 82, 82, 237, 83, 82, 97, 131, 97,
/* 680 */ 82, 97, 82, 115, 82, 116, 78, 71, 87, 86, /* 680 */ 131, 82, 82, 115, 82, 116, 78, 71, 87, 86,
/* 690 */ 5, 87, 86, 9, 5, 5, 5, 5, 5, 5, /* 690 */ 5, 87, 86, 9, 5, 5, 5, 5, 5, 5,
/* 700 */ 5, 15, 85, 78, 82, 24, 83, 117, 82, 59, /* 700 */ 5, 15, 85, 78, 82, 24, 83, 59, 82, 147,
/* 710 */ 147, 147, 16, 16, 147, 5, 5, 97, 147, 83, /* 710 */ 117, 147, 16, 16, 147, 5, 5, 97, 147, 83,
/* 720 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, /* 720 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
/* 730 */ 5, 5, 5, 5, 5, 97, 85, 61, 60, 0, /* 730 */ 5, 5, 5, 5, 5, 97, 85, 61, 60, 0,
/* 740 */ 276, 276, 276, 276, 276, 276, 276, 276, 276, 276, /* 740 */ 276, 276, 276, 276, 276, 276, 276, 276, 276, 276,
@ -399,9 +399,9 @@ static const unsigned short int yy_shift_ofst[] = {
/* 120 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, /* 120 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
/* 130 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, /* 130 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
/* 140 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, /* 140 */ 143, 143, 143, 143, 143, 143, 143, 143, 143, 143,
/* 150 */ 143, 444, 444, 444, 401, 401, 401, 444, 401, 444, /* 150 */ 143, 444, 444, 444, 401, 401, 401, 401, 444, 444,
/* 160 */ 404, 408, 407, 412, 405, 413, 428, 433, 439, 447, /* 160 */ 404, 408, 407, 412, 405, 414, 429, 434, 436, 447,
/* 170 */ 434, 444, 444, 444, 509, 509, 488, 12, 12, 444, /* 170 */ 458, 444, 444, 444, 485, 485, 488, 12, 12, 444,
/* 180 */ 444, 508, 510, 555, 515, 514, 554, 518, 521, 488, /* 180 */ 444, 508, 510, 555, 515, 514, 554, 518, 521, 488,
/* 190 */ 13, 444, 529, 529, 444, 529, 444, 529, 444, 444, /* 190 */ 13, 444, 529, 529, 444, 529, 444, 529, 444, 444,
/* 200 */ 753, 753, 54, 81, 81, 108, 81, 134, 188, 205, /* 200 */ 753, 753, 54, 81, 81, 108, 81, 134, 188, 205,
@ -411,12 +411,12 @@ static const unsigned short int yy_shift_ofst[] = {
/* 240 */ 345, 347, 348, 343, 350, 357, 431, 375, 426, 366, /* 240 */ 345, 347, 348, 343, 350, 357, 431, 375, 426, 366,
/* 250 */ 118, 308, 314, 459, 460, 324, 327, 361, 331, 373, /* 250 */ 118, 308, 314, 459, 460, 324, 327, 361, 331, 373,
/* 260 */ 609, 464, 613, 614, 467, 618, 619, 525, 531, 489, /* 260 */ 609, 464, 613, 614, 467, 618, 619, 525, 531, 489,
/* 270 */ 512, 519, 551, 516, 552, 556, 539, 542, 577, 582, /* 270 */ 512, 519, 551, 516, 552, 556, 539, 561, 577, 584,
/* 280 */ 583, 570, 588, 589, 591, 670, 592, 593, 595, 578, /* 280 */ 585, 587, 588, 570, 590, 592, 591, 669, 594, 580,
/* 290 */ 547, 584, 548, 598, 519, 600, 568, 602, 569, 608, /* 290 */ 547, 582, 549, 599, 519, 600, 568, 602, 569, 608,
/* 300 */ 601, 603, 616, 685, 604, 606, 684, 689, 690, 691, /* 300 */ 601, 603, 616, 685, 604, 606, 684, 689, 690, 691,
/* 310 */ 692, 693, 694, 695, 617, 686, 625, 622, 623, 590, /* 310 */ 692, 693, 694, 695, 617, 686, 625, 622, 623, 593,
/* 320 */ 626, 681, 650, 696, 563, 564, 620, 620, 620, 620, /* 320 */ 626, 681, 648, 696, 562, 564, 620, 620, 620, 620,
/* 330 */ 697, 567, 571, 620, 620, 620, 710, 711, 636, 620, /* 330 */ 697, 567, 571, 620, 620, 620, 710, 711, 636, 620,
/* 340 */ 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, /* 340 */ 715, 716, 717, 718, 719, 720, 721, 722, 723, 724,
/* 350 */ 725, 726, 727, 728, 729, 638, 651, 730, 731, 676, /* 350 */ 725, 726, 727, 728, 729, 638, 651, 730, 731, 676,
@ -424,7 +424,7 @@ static const unsigned short int yy_shift_ofst[] = {
}; };
#define YY_REDUCE_COUNT (201) #define YY_REDUCE_COUNT (201)
#define YY_REDUCE_MIN (-265) #define YY_REDUCE_MIN (-265)
#define YY_REDUCE_MAX (461) #define YY_REDUCE_MAX (465)
static const short yy_reduce_ofst[] = { static const short yy_reduce_ofst[] = {
/* 0 */ -27, -33, -33, -193, -193, -76, -203, -199, -175, -184, /* 0 */ -27, -33, -33, -193, -193, -76, -203, -199, -175, -184,
/* 10 */ -130, -134, 93, 24, 67, 119, 126, 135, 142, 148, /* 10 */ -130, -134, 93, 24, 67, 119, 126, 135, 142, 148,
@ -441,12 +441,12 @@ static const short yy_reduce_ofst[] = {
/* 120 */ 365, 367, 368, 369, 370, 371, 372, 374, 376, 377, /* 120 */ 365, 367, 368, 369, 370, 371, 372, 374, 376, 377,
/* 130 */ 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, /* 130 */ 378, 379, 380, 381, 382, 383, 384, 385, 386, 387,
/* 140 */ 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, /* 140 */ 388, 389, 390, 391, 392, 393, 394, 395, 396, 397,
/* 150 */ 398, 344, 399, 400, 247, 252, 254, 402, 267, 403, /* 150 */ 398, 344, 399, 400, 247, 252, 254, 267, 402, 403,
/* 160 */ 246, 266, 265, 270, 273, 293, 406, 268, 409, 411, /* 160 */ 246, 266, 265, 270, 273, 293, 406, 268, 409, 411,
/* 170 */ 414, 410, 415, 416, 417, 418, 419, 420, 423, 421, /* 170 */ 413, 410, 415, 416, 417, 418, 419, 420, 423, 421,
/* 180 */ 422, 424, 427, 425, 435, 430, 436, 429, 437, 432, /* 180 */ 422, 424, 427, 425, 428, 430, 433, 435, 432, 437,
/* 190 */ 438, 440, 446, 450, 441, 451, 453, 454, 457, 458, /* 190 */ 438, 439, 448, 450, 440, 451, 453, 454, 457, 465,
/* 200 */ 461, 452, /* 200 */ 441, 452,
}; };
static const YYACTIONTYPE yy_default[] = { static const YYACTIONTYPE yy_default[] = {
/* 0 */ 856, 979, 918, 989, 905, 915, 1126, 1126, 1126, 856, /* 0 */ 856, 979, 918, 989, 905, 915, 1126, 1126, 1126, 856,
@ -464,8 +464,8 @@ static const YYACTIONTYPE yy_default[] = {
/* 120 */ 856, 856, 856, 856, 856, 856, 903, 856, 901, 856, /* 120 */ 856, 856, 856, 856, 856, 856, 903, 856, 901, 856,
/* 130 */ 856, 856, 856, 856, 856, 856, 856, 856, 856, 856, /* 130 */ 856, 856, 856, 856, 856, 856, 856, 856, 856, 856,
/* 140 */ 856, 856, 856, 856, 887, 856, 856, 856, 856, 856, /* 140 */ 856, 856, 856, 856, 887, 856, 856, 856, 856, 856,
/* 150 */ 856, 878, 878, 878, 856, 856, 856, 878, 856, 878, /* 150 */ 856, 878, 878, 878, 856, 856, 856, 856, 878, 878,
/* 160 */ 1076, 1080, 1062, 1074, 1070, 1061, 1057, 1055, 1053, 1052, /* 160 */ 1076, 1080, 1062, 1074, 1070, 1057, 1055, 1053, 1061, 1052,
/* 170 */ 1084, 878, 878, 878, 923, 923, 919, 915, 915, 878, /* 170 */ 1084, 878, 878, 878, 923, 923, 919, 915, 915, 878,
/* 180 */ 878, 941, 939, 937, 929, 935, 931, 933, 927, 906, /* 180 */ 878, 941, 939, 937, 929, 935, 931, 933, 927, 906,
/* 190 */ 856, 878, 913, 913, 878, 913, 878, 913, 878, 878, /* 190 */ 856, 878, 913, 913, 878, 913, 878, 913, 878, 878,
@ -1039,10 +1039,10 @@ static const char *const yyTokenName[] = {
/* 250 */ "from", /* 250 */ "from",
/* 251 */ "where_opt", /* 251 */ "where_opt",
/* 252 */ "interval_opt", /* 252 */ "interval_opt",
/* 253 */ "session_option", /* 253 */ "sliding_opt",
/* 254 */ "windowstate_option", /* 254 */ "session_option",
/* 255 */ "fill_opt", /* 255 */ "windowstate_option",
/* 256 */ "sliding_opt", /* 256 */ "fill_opt",
/* 257 */ "groupby_opt", /* 257 */ "groupby_opt",
/* 258 */ "having_opt", /* 258 */ "having_opt",
/* 259 */ "orderby_opt", /* 259 */ "orderby_opt",
@ -1235,7 +1235,7 @@ static const char *const yyRuleName[] = {
/* 163 */ "tagitem ::= MINUS FLOAT", /* 163 */ "tagitem ::= MINUS FLOAT",
/* 164 */ "tagitem ::= PLUS INTEGER", /* 164 */ "tagitem ::= PLUS INTEGER",
/* 165 */ "tagitem ::= PLUS FLOAT", /* 165 */ "tagitem ::= PLUS FLOAT",
/* 166 */ "select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt", /* 166 */ "select ::= SELECT selcollist from where_opt interval_opt sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt",
/* 167 */ "select ::= LP select RP", /* 167 */ "select ::= LP select RP",
/* 168 */ "union ::= select", /* 168 */ "union ::= select",
/* 169 */ "union ::= union UNION ALL select", /* 169 */ "union ::= union UNION ALL select",
@ -1490,7 +1490,7 @@ tSqlExprListDestroy((yypminor->yy525));
case 243: /* columnlist */ case 243: /* columnlist */
case 244: /* tagitemlist */ case 244: /* tagitemlist */
case 245: /* tagNamelist */ case 245: /* tagNamelist */
case 255: /* fill_opt */ case 256: /* fill_opt */
case 257: /* groupby_opt */ case 257: /* groupby_opt */
case 259: /* orderby_opt */ case 259: /* orderby_opt */
case 270: /* sortlist */ case 270: /* sortlist */
@ -1991,7 +1991,7 @@ static const struct {
{ 248, -2 }, /* (163) tagitem ::= MINUS FLOAT */ { 248, -2 }, /* (163) tagitem ::= MINUS FLOAT */
{ 248, -2 }, /* (164) tagitem ::= PLUS INTEGER */ { 248, -2 }, /* (164) tagitem ::= PLUS INTEGER */
{ 248, -2 }, /* (165) tagitem ::= PLUS FLOAT */ { 248, -2 }, /* (165) tagitem ::= PLUS FLOAT */
{ 246, -14 }, /* (166) select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ { 246, -14 }, /* (166) select ::= SELECT selcollist from where_opt interval_opt sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
{ 246, -3 }, /* (167) select ::= LP select RP */ { 246, -3 }, /* (167) select ::= LP select RP */
{ 262, -1 }, /* (168) union ::= select */ { 262, -1 }, /* (168) union ::= select */
{ 262, -4 }, /* (169) union ::= union UNION ALL select */ { 262, -4 }, /* (169) union ::= union UNION ALL select */
@ -2019,15 +2019,15 @@ static const struct {
{ 252, -4 }, /* (191) interval_opt ::= INTERVAL LP tmvar RP */ { 252, -4 }, /* (191) interval_opt ::= INTERVAL LP tmvar RP */
{ 252, -6 }, /* (192) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */ { 252, -6 }, /* (192) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
{ 252, 0 }, /* (193) interval_opt ::= */ { 252, 0 }, /* (193) interval_opt ::= */
{ 253, 0 }, /* (194) session_option ::= */ { 254, 0 }, /* (194) session_option ::= */
{ 253, -7 }, /* (195) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */ { 254, -7 }, /* (195) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
{ 254, 0 }, /* (196) windowstate_option ::= */ { 255, 0 }, /* (196) windowstate_option ::= */
{ 254, -4 }, /* (197) windowstate_option ::= STATE_WINDOW LP ids RP */ { 255, -4 }, /* (197) windowstate_option ::= STATE_WINDOW LP ids RP */
{ 255, 0 }, /* (198) fill_opt ::= */ { 256, 0 }, /* (198) fill_opt ::= */
{ 255, -6 }, /* (199) fill_opt ::= FILL LP ID COMMA tagitemlist RP */ { 256, -6 }, /* (199) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
{ 255, -4 }, /* (200) fill_opt ::= FILL LP ID RP */ { 256, -4 }, /* (200) fill_opt ::= FILL LP ID RP */
{ 256, -4 }, /* (201) sliding_opt ::= SLIDING LP tmvar RP */ { 253, -4 }, /* (201) sliding_opt ::= SLIDING LP tmvar RP */
{ 256, 0 }, /* (202) sliding_opt ::= */ { 253, 0 }, /* (202) sliding_opt ::= */
{ 259, 0 }, /* (203) orderby_opt ::= */ { 259, 0 }, /* (203) orderby_opt ::= */
{ 259, -3 }, /* (204) orderby_opt ::= ORDER BY sortlist */ { 259, -3 }, /* (204) orderby_opt ::= ORDER BY sortlist */
{ 270, -4 }, /* (205) sortlist ::= sortlist COMMA item sortorder */ { 270, -4 }, /* (205) sortlist ::= sortlist COMMA item sortorder */
@ -2723,9 +2723,9 @@ static void yy_reduce(
} }
yymsp[-1].minor.yy506 = yylhsminor.yy506; yymsp[-1].minor.yy506 = yylhsminor.yy506;
break; break;
case 166: /* select ::= SELECT selcollist from where_opt interval_opt session_option windowstate_option fill_opt sliding_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */ case 166: /* select ::= SELECT selcollist from where_opt interval_opt sliding_opt session_option windowstate_option fill_opt groupby_opt having_opt orderby_opt slimit_opt limit_opt */
{ {
yylhsminor.yy464 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy525, yymsp[-11].minor.yy412, yymsp[-10].minor.yy370, yymsp[-4].minor.yy525, yymsp[-2].minor.yy525, &yymsp[-9].minor.yy520, &yymsp[-8].minor.yy259, &yymsp[-7].minor.yy144, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy525, &yymsp[0].minor.yy126, &yymsp[-1].minor.yy126, yymsp[-3].minor.yy370); yylhsminor.yy464 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy525, yymsp[-11].minor.yy412, yymsp[-10].minor.yy370, yymsp[-4].minor.yy525, yymsp[-2].minor.yy525, &yymsp[-9].minor.yy520, &yymsp[-7].minor.yy259, &yymsp[-6].minor.yy144, &yymsp[-8].minor.yy0, yymsp[-5].minor.yy525, &yymsp[0].minor.yy126, &yymsp[-1].minor.yy126, yymsp[-3].minor.yy370);
} }
yymsp[-13].minor.yy464 = yylhsminor.yy464; yymsp[-13].minor.yy464 = yylhsminor.yy464;
break; break;

View File

@ -29,7 +29,9 @@ typedef void* SMergeBuf;
SDataRow tsdbMergeTwoRows(SMergeBuf *pBuf, SMemRow row1, SMemRow row2, STSchema *pSchema1, STSchema *pSchema2); SDataRow tsdbMergeTwoRows(SMergeBuf *pBuf, SMemRow row1, SMemRow row2, STSchema *pSchema1, STSchema *pSchema2);
static FORCE_INLINE int tsdbMergeBufMakeSureRoom(SMergeBuf *pBuf, STSchema* pSchema1, STSchema* pSchema2) { static FORCE_INLINE int tsdbMergeBufMakeSureRoom(SMergeBuf *pBuf, STSchema* pSchema1, STSchema* pSchema2) {
return tsdbMakeRoom(pBuf, MAX(dataRowMaxBytesFromSchema(pSchema1), dataRowMaxBytesFromSchema(pSchema2))); size_t len1 = dataRowMaxBytesFromSchema(pSchema1);
size_t len2 = dataRowMaxBytesFromSchema(pSchema2);
return tsdbMakeRoom(pBuf, MAX(len1, len2));
} }
static FORCE_INLINE void tsdbFreeMergeBuf(SMergeBuf buf) { static FORCE_INLINE void tsdbFreeMergeBuf(SMergeBuf buf) {

View File

@ -94,8 +94,9 @@ struct STsdbRepo {
pthread_mutex_t mutex; pthread_mutex_t mutex;
bool repoLocked; bool repoLocked;
int32_t code; // Commit code int32_t code; // Commit code
SMergeBuf mergeBuf; //used when update=2 SMergeBuf mergeBuf; //used when update=2
bool inCompact; // is in compact process? int8_t compactState; // compact state: inCompact/noCompact/waitingCompact?
}; };
#define REPO_ID(r) (r)->config.tsdbId #define REPO_ID(r) (r)->config.tsdbId

View File

@ -58,6 +58,7 @@ static int tsdbCompactFSetImpl(SCompactH *pComph);
static int tsdbWriteBlockToRightFile(SCompactH *pComph, STable *pTable, SDataCols *pDataCols, void **ppBuf, static int tsdbWriteBlockToRightFile(SCompactH *pComph, STable *pTable, SDataCols *pDataCols, void **ppBuf,
void **ppCBuf); void **ppCBuf);
enum { TSDB_NO_COMPACT, TSDB_IN_COMPACT, TSDB_WAITING_COMPACT};
int tsdbCompact(STsdbRepo *pRepo) { return tsdbAsyncCompact(pRepo); } int tsdbCompact(STsdbRepo *pRepo) { return tsdbAsyncCompact(pRepo); }
void *tsdbCompactImpl(STsdbRepo *pRepo) { void *tsdbCompactImpl(STsdbRepo *pRepo) {
@ -89,16 +90,21 @@ _err:
} }
static int tsdbAsyncCompact(STsdbRepo *pRepo) { static int tsdbAsyncCompact(STsdbRepo *pRepo) {
if (pRepo->compactState != TSDB_NO_COMPACT) {
tsdbInfo("vgId:%d not compact tsdb again ", REPO_ID(pRepo));
return 0;
}
pRepo->compactState = TSDB_WAITING_COMPACT;
tsem_wait(&(pRepo->readyToCommit)); tsem_wait(&(pRepo->readyToCommit));
return tsdbScheduleCommit(pRepo, COMPACT_REQ); return tsdbScheduleCommit(pRepo, COMPACT_REQ);
} }
static void tsdbStartCompact(STsdbRepo *pRepo) { static void tsdbStartCompact(STsdbRepo *pRepo) {
ASSERT(!pRepo->inCompact); assert(pRepo->compactState != TSDB_IN_COMPACT);
tsdbInfo("vgId:%d start to compact!", REPO_ID(pRepo)); tsdbInfo("vgId:%d start to compact!", REPO_ID(pRepo));
tsdbStartFSTxn(pRepo, 0, 0); tsdbStartFSTxn(pRepo, 0, 0);
pRepo->code = TSDB_CODE_SUCCESS; pRepo->code = TSDB_CODE_SUCCESS;
pRepo->inCompact = true; pRepo->compactState = TSDB_IN_COMPACT;
} }
static void tsdbEndCompact(STsdbRepo *pRepo, int eno) { static void tsdbEndCompact(STsdbRepo *pRepo, int eno) {
@ -107,7 +113,7 @@ static void tsdbEndCompact(STsdbRepo *pRepo, int eno) {
} else { } else {
tsdbEndFSTxn(pRepo); tsdbEndFSTxn(pRepo);
} }
pRepo->inCompact = false; pRepo->compactState = TSDB_NO_COMPACT;
tsdbInfo("vgId:%d compact over, %s", REPO_ID(pRepo), (eno == TSDB_CODE_SUCCESS) ? "succeed" : "failed"); tsdbInfo("vgId:%d compact over, %s", REPO_ID(pRepo), (eno == TSDB_CODE_SUCCESS) ? "succeed" : "failed");
tsem_post(&(pRepo->readyToCommit)); tsem_post(&(pRepo->readyToCommit));
} }

View File

@ -200,7 +200,7 @@ STsdbRepoInfo *tsdbGetStatus(STsdbRepo *pRepo) { return NULL; }
int tsdbGetState(STsdbRepo *repo) { return repo->state; } int tsdbGetState(STsdbRepo *repo) { return repo->state; }
bool tsdbInCompact(STsdbRepo *repo) { return repo->inCompact; } int8_t tsdbGetCompactState(STsdbRepo *repo) { return (int8_t)(repo->compactState); }
void tsdbReportStat(void *repo, int64_t *totalPoints, int64_t *totalStorage, int64_t *compStorage) { void tsdbReportStat(void *repo, int64_t *totalPoints, int64_t *totalStorage, int64_t *compStorage) {
ASSERT(repo != NULL); ASSERT(repo != NULL);
@ -541,7 +541,7 @@ static STsdbRepo *tsdbNewRepo(STsdbCfg *pCfg, STsdbAppH *pAppH) {
pRepo->state = TSDB_STATE_OK; pRepo->state = TSDB_STATE_OK;
pRepo->code = TSDB_CODE_SUCCESS; pRepo->code = TSDB_CODE_SUCCESS;
pRepo->inCompact = false; pRepo->compactState = 0;
pRepo->config = *pCfg; pRepo->config = *pCfg;
if (pAppH) { if (pAppH) {
pRepo->appH = *pAppH; pRepo->appH = *pAppH;

View File

@ -1035,6 +1035,8 @@ static void tsdbRemoveTableFromMeta(STsdbRepo *pRepo, STable *pTable, bool rmFro
} }
} }
} }
pMeta->maxCols = maxCols;
pMeta->maxRowBytes = maxRowBytes;
if (lock) tsdbUnlockRepoMeta(pRepo); if (lock) tsdbUnlockRepoMeta(pRepo);
tsdbDebug("vgId:%d table %s uid %" PRIu64 " is removed from meta", REPO_ID(pRepo), TABLE_CHAR_NAME(pTable), TABLE_UID(pTable)); tsdbDebug("vgId:%d table %s uid %" PRIu64 " is removed from meta", REPO_ID(pRepo), TABLE_CHAR_NAME(pTable), TABLE_UID(pTable));

View File

@ -1234,7 +1234,6 @@ static int32_t doCopyRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t c
static void moveDataToFront(STsdbQueryHandle* pQueryHandle, int32_t numOfRows, int32_t numOfCols); static void moveDataToFront(STsdbQueryHandle* pQueryHandle, int32_t numOfRows, int32_t numOfCols);
static void doCheckGeneratedBlockRange(STsdbQueryHandle* pQueryHandle); static void doCheckGeneratedBlockRange(STsdbQueryHandle* pQueryHandle);
static void copyAllRemainRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo* pCheckInfo, SDataBlockInfo* pBlockInfo, int32_t endPos); static void copyAllRemainRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, STableCheckInfo* pCheckInfo, SDataBlockInfo* pBlockInfo, int32_t endPos);
static TSKEY extractFirstTraverseKey(STableCheckInfo* pCheckInfo, int32_t order, int32_t update);
static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* pBlock, STableCheckInfo* pCheckInfo){ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* pBlock, STableCheckInfo* pCheckInfo){
SQueryFilePos* cur = &pQueryHandle->cur; SQueryFilePos* cur = &pQueryHandle->cur;
@ -1244,7 +1243,6 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
/*bool hasData = */ initTableMemIterator(pQueryHandle, pCheckInfo); /*bool hasData = */ initTableMemIterator(pQueryHandle, pCheckInfo);
assert(cur->pos >= 0 && cur->pos <= binfo.rows); assert(cur->pos >= 0 && cur->pos <= binfo.rows);
key = extractFirstTraverseKey(pCheckInfo, pQueryHandle->order, pCfg->update); key = extractFirstTraverseKey(pCheckInfo, pQueryHandle->order, pCfg->update);
@ -1255,7 +1253,6 @@ static int32_t handleDataMergeIfNeeded(STsdbQueryHandle* pQueryHandle, SBlock* p
tsdbDebug("%p no data in mem, 0x%"PRIx64, pQueryHandle, pQueryHandle->qId); tsdbDebug("%p no data in mem, 0x%"PRIx64, pQueryHandle, pQueryHandle->qId);
} }
if ((ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key <= binfo.window.ekey)) || if ((ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key <= binfo.window.ekey)) ||
(!ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key >= binfo.window.skey))) { (!ASCENDING_TRAVERSE(pQueryHandle->order) && (key != TSKEY_INITIAL_VAL && key >= binfo.window.skey))) {
@ -2708,6 +2705,7 @@ static bool loadBlockOfActiveTable(STsdbQueryHandle* pQueryHandle) {
} }
if (exists) { if (exists) {
tsdbRetrieveDataBlock((TsdbQueryHandleT*) pQueryHandle, NULL);
if (pQueryHandle->currentLoadExternalRows && pQueryHandle->window.skey == pQueryHandle->window.ekey) { if (pQueryHandle->currentLoadExternalRows && pQueryHandle->window.skey == pQueryHandle->window.ekey) {
SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, 0); SColumnInfoData* pColInfo = taosArrayGet(pQueryHandle->pColumns, 0);
assert(*(int64_t*)pColInfo->pData == pQueryHandle->window.skey); assert(*(int64_t*)pColInfo->pData == pQueryHandle->window.skey);

View File

@ -518,6 +518,8 @@ static int tsdbCheckAndDecodeColumnData(SDataCol *pDataCol, void *content, int32
return -1; return -1;
} }
tdAllocMemForCol(pDataCol, maxPoints);
// Decode the data // Decode the data
if (comp) { if (comp) {
// Need to decompress // Need to decompress

View File

@ -127,6 +127,16 @@ void *taosHashGet(SHashObj *pHashObj, const void *key, size_t keyLen);
*/ */
void* taosHashGetClone(SHashObj *pHashObj, const void *key, size_t keyLen, void (*fp)(void *), void* d); void* taosHashGetClone(SHashObj *pHashObj, const void *key, size_t keyLen, void (*fp)(void *), void* d);
/**
* @param pHashObj
* @param key
* @param keyLen
* @param fp
* @param d
* @param sz
* @return
*/
void* taosHashGetCloneExt(SHashObj *pHashObj, const void *key, size_t keyLen, void (*fp)(void *), void** d, size_t *sz);
/** /**
* remove item with the specified key * remove item with the specified key
* @param pHashObj * @param pHashObj

View File

@ -18,6 +18,8 @@
#include "tulog.h" #include "tulog.h"
#include "taosdef.h" #include "taosdef.h"
#define EXT_SIZE 1024
#define HASH_NEED_RESIZE(_h) ((_h)->size >= (_h)->capacity * HASH_DEFAULT_LOAD_FACTOR) #define HASH_NEED_RESIZE(_h) ((_h)->size >= (_h)->capacity * HASH_DEFAULT_LOAD_FACTOR)
#define DO_FREE_HASH_NODE(_n) \ #define DO_FREE_HASH_NODE(_n) \
@ -296,6 +298,68 @@ int32_t taosHashPut(SHashObj *pHashObj, const void *key, size_t keyLen, void *da
void *taosHashGet(SHashObj *pHashObj, const void *key, size_t keyLen) { void *taosHashGet(SHashObj *pHashObj, const void *key, size_t keyLen) {
return taosHashGetClone(pHashObj, key, keyLen, NULL, NULL); return taosHashGetClone(pHashObj, key, keyLen, NULL, NULL);
} }
//TODO(yihaoDeng), merge with taosHashGetClone
void* taosHashGetCloneExt(SHashObj *pHashObj, const void *key, size_t keyLen, void (*fp)(void *), void** d, size_t *sz) {
if (taosHashTableEmpty(pHashObj) || keyLen == 0 || key == NULL) {
return NULL;
}
uint32_t hashVal = (*pHashObj->hashFp)(key, (uint32_t)keyLen);
// only add the read lock to disable the resize process
__rd_lock(&pHashObj->lock, pHashObj->type);
int32_t slot = HASH_INDEX(hashVal, pHashObj->capacity);
SHashEntry *pe = pHashObj->hashList[slot];
// no data, return directly
if (atomic_load_32(&pe->num) == 0) {
__rd_unlock(&pHashObj->lock, pHashObj->type);
return NULL;
}
char *data = NULL;
// lock entry
if (pHashObj->type == HASH_ENTRY_LOCK) {
taosRLockLatch(&pe->latch);
}
if (pe->num > 0) {
assert(pe->next != NULL);
} else {
assert(pe->next == NULL);
}
SHashNode *pNode = doSearchInEntryList(pHashObj, pe, key, keyLen, hashVal);
if (pNode != NULL) {
if (fp != NULL) {
fp(GET_HASH_NODE_DATA(pNode));
}
if (*d == NULL) {
*sz = pNode->dataLen + EXT_SIZE;
*d = calloc(1, *sz);
} else if (*sz < pNode->dataLen){
*sz = pNode->dataLen + EXT_SIZE;
*d = realloc(*d, *sz);
}
memcpy((char *)(*d), GET_HASH_NODE_DATA(pNode), pNode->dataLen);
// just make runtime happy
if ((*sz) - pNode->dataLen > 0) {
memset((char *)(*d) + pNode->dataLen, 0, (*sz) - pNode->dataLen);
}
data = GET_HASH_NODE_DATA(pNode);
}
if (pHashObj->type == HASH_ENTRY_LOCK) {
taosRUnLockLatch(&pe->latch);
}
__rd_unlock(&pHashObj->lock, pHashObj->type);
return data;
}
void* taosHashGetClone(SHashObj *pHashObj, const void *key, size_t keyLen, void (*fp)(void *), void* d) { void* taosHashGetClone(SHashObj *pHashObj, const void *key, size_t keyLen, void (*fp)(void *), void* d) {
if (taosHashTableEmpty(pHashObj) || keyLen == 0 || key == NULL) { if (taosHashTableEmpty(pHashObj) || keyLen == 0 || key == NULL) {

View File

@ -26,6 +26,7 @@ extern "C" {
#include "vnode.h" #include "vnode.h"
extern int32_t vDebugFlag; extern int32_t vDebugFlag;
extern int32_t vNumOfExistedQHandle; // current initialized and existed query handle in current dnode
#define vFatal(...) { if (vDebugFlag & DEBUG_FATAL) { taosPrintLog("VND FATAL ", 255, __VA_ARGS__); }} #define vFatal(...) { if (vDebugFlag & DEBUG_FATAL) { taosPrintLog("VND FATAL ", 255, __VA_ARGS__); }}
#define vError(...) { if (vDebugFlag & DEBUG_ERROR) { taosPrintLog("VND ERROR ", 255, __VA_ARGS__); }} #define vError(...) { if (vDebugFlag & DEBUG_ERROR) { taosPrintLog("VND ERROR ", 255, __VA_ARGS__); }}

View File

@ -162,7 +162,7 @@ static void vnodeBuildVloadMsg(SVnodeObj *pVnode, SStatusMsg *pStatus) {
pLoad->status = pVnode->status; pLoad->status = pVnode->status;
pLoad->role = pVnode->role; pLoad->role = pVnode->role;
pLoad->replica = pVnode->syncCfg.replica; pLoad->replica = pVnode->syncCfg.replica;
pLoad->compact = (pVnode->tsdb != NULL) && tsdbInCompact(pVnode->tsdb) ? 1 : 0; pLoad->compact = (pVnode->tsdb != NULL) ? tsdbGetCompactState(pVnode->tsdb) : 0;
} }
int32_t vnodeGetVnodeList(int32_t vnodeList[], int32_t *numOfVnodes) { int32_t vnodeGetVnodeList(int32_t vnodeList[], int32_t *numOfVnodes) {

View File

@ -21,6 +21,8 @@
#include "query.h" #include "query.h"
#include "vnodeStatus.h" #include "vnodeStatus.h"
int32_t vNumOfExistedQHandle; // current initialized and existed query handle in current dnode
static int32_t (*vnodeProcessReadMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *pVnode, SVReadMsg *pRead); static int32_t (*vnodeProcessReadMsgFp[TSDB_MSG_TYPE_MAX])(SVnodeObj *pVnode, SVReadMsg *pRead);
static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead); static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead);
static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead); static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead);
@ -247,7 +249,8 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if (handle == NULL) { // failed to register qhandle if (handle == NULL) { // failed to register qhandle
pRsp->code = terrno; pRsp->code = terrno;
terrno = 0; terrno = 0;
vError("vgId:%d, QInfo:0x%"PRIx64 "-%p register qhandle failed, return to app, code:%s", pVnode->vgId, qId, (void *)pQInfo,
vError("vgId:%d, QInfo:0x%"PRIx64 "-%p register qhandle failed, return to app, code:%s,", pVnode->vgId, qId, (void *)pQInfo,
tstrerror(pRsp->code)); tstrerror(pRsp->code));
qDestroyQueryInfo(pQInfo); // destroy it directly qDestroyQueryInfo(pQInfo); // destroy it directly
return pRsp->code; return pRsp->code;
@ -260,10 +263,12 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
vnodeNotifyCurrentQhandle(pRead->rpcHandle, qId, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) { vnodeNotifyCurrentQhandle(pRead->rpcHandle, qId, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) {
vError("vgId:%d, QInfo:0x%"PRIx64 "-%p, query discarded since link is broken, %p", pVnode->vgId, qId, *handle, vError("vgId:%d, QInfo:0x%"PRIx64 "-%p, query discarded since link is broken, %p", pVnode->vgId, qId, *handle,
pRead->rpcHandle); pRead->rpcHandle);
pRsp->code = TSDB_CODE_RPC_NETWORK_UNAVAIL; pRsp->code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true);
return pRsp->code; return pRsp->code;
} }
} else { } else {
assert(pQInfo == NULL); assert(pQInfo == NULL);
} }
@ -277,6 +282,9 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
return pRsp->code; return pRsp->code;
} }
} }
int32_t remain = atomic_add_fetch_32(&vNumOfExistedQHandle, 1);
vTrace("vgId:%d, new qhandle created, total qhandle:%d", pVnode->vgId, remain);
} else { } else {
assert(pCont != NULL); assert(pCont != NULL);
void **qhandle = (void **)pRead->qhandle; void **qhandle = (void **)pRead->qhandle;
@ -318,8 +326,14 @@ static int32_t vnodeProcessQueryMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// NOTE: if the qhandle is not put into vread queue or query is completed, free the qhandle. // NOTE: if the qhandle is not put into vread queue or query is completed, free the qhandle.
// If the building of result is not required, simply free it. Otherwise, mandatorily free the qhandle // If the building of result is not required, simply free it. Otherwise, mandatorily free the qhandle
if (freehandle || (!buildRes)) { if (freehandle || (!buildRes)) {
if (freehandle) {
int32_t remain = atomic_sub_fetch_32(&vNumOfExistedQHandle, 1);
vTrace("vgId:%d, QInfo:%p, start to free qhandle, remain qhandle:%d", pVnode->vgId, *qhandle, remain);
}
qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, freehandle); qReleaseQInfo(pVnode->qMgmt, (void **)&qhandle, freehandle);
} }
} }
} }
@ -357,7 +371,10 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// kill current query and free corresponding resources. // kill current query and free corresponding resources.
if (pRetrieve->free == 1) { if (pRetrieve->free == 1) {
vWarn("vgId:%d, QInfo:%"PRIx64 "-%p, retrieve msg received to kill query and free qhandle", pVnode->vgId, pRetrieve->qId, *handle); int32_t remain = atomic_sub_fetch_32(&vNumOfExistedQHandle, 1);
vWarn("vgId:%d, QInfo:%"PRIx64 "-%p, retrieve msg received to kill query and free qhandle, remain qhandle:%d", pVnode->vgId, pRetrieve->qId,
*handle, remain);
qKillQuery(*handle); qKillQuery(*handle);
qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true);
@ -368,7 +385,10 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// register the qhandle to connect to quit query immediate if connection is broken // register the qhandle to connect to quit query immediate if connection is broken
if (vnodeNotifyCurrentQhandle(pRead->rpcHandle, pRetrieve->qId, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) { if (vnodeNotifyCurrentQhandle(pRead->rpcHandle, pRetrieve->qId, *handle, pVnode->vgId) != TSDB_CODE_SUCCESS) {
vError("vgId:%d, QInfo:%"PRIu64 "-%p, retrieve discarded since link is broken, conn:%p", pVnode->vgId, pRetrieve->qhandle, *handle, pRead->rpcHandle); int32_t remain = atomic_sub_fetch_32(&vNumOfExistedQHandle, 1);
vError("vgId:%d, QInfo:%"PRIu64 "-%p, retrieve discarded since link is broken, conn:%p, remain qhandle:%d", pVnode->vgId, pRetrieve->qhandle,
*handle, pRead->rpcHandle, remain);
code = TSDB_CODE_RPC_NETWORK_UNAVAIL; code = TSDB_CODE_RPC_NETWORK_UNAVAIL;
qKillQuery(*handle); qKillQuery(*handle);
qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true);
@ -390,7 +410,6 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
if (!tsRetrieveBlockingModel) { if (!tsRetrieveBlockingModel) {
if (!buildRes) { if (!buildRes) {
assert(pRead->rpcHandle != NULL); assert(pRead->rpcHandle != NULL);
qReleaseQInfo(pVnode->qMgmt, (void **)&handle, false); qReleaseQInfo(pVnode->qMgmt, (void **)&handle, false);
return TSDB_CODE_QRY_NOT_READY; return TSDB_CODE_QRY_NOT_READY;
} }
@ -403,6 +422,8 @@ static int32_t vnodeProcessFetchMsg(SVnodeObj *pVnode, SVReadMsg *pRead) {
// If qhandle is not added into vread queue, the query should be completed already or paused with error. // If qhandle is not added into vread queue, the query should be completed already or paused with error.
// Here free qhandle immediately // Here free qhandle immediately
if (freeHandle) { if (freeHandle) {
int32_t remain = atomic_sub_fetch_32(&vNumOfExistedQHandle, 1);
vTrace("vgId:%d, QInfo:%p, start to free qhandle, remain qhandle:%d", pVnode->vgId, *handle, remain);
qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true); qReleaseQInfo(pVnode->qMgmt, (void **)&handle, true);
} }

View File

@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
branch= branch=
if [ x$1 != x ];then if [ x$1 != x ];then
branch=$1 branch=$1
@ -8,17 +9,19 @@ else
echo "Please enter branch name as a parameter" echo "Please enter branch name as a parameter"
exit 1 exit 1
fi fi
jemalloc=
type=
if [ x$2 != x ];then if [ x$2 != x ];then
jemalloc=jemalloc type=jemalloc
echo "Building TDengine using jemalloc" echo "Building TDengine using jemalloc"
else else
type=glibc
echo "Building TDengine using glibc" echo "Building TDengine using glibc"
fi fi
today=`date +"%Y%m%d"` today=`date +"%Y%m%d"`
WORK_DIR=/home/ubuntu/pxiao WORK_DIR=/root/pxiao
PERFORMANCE_TEST_REPORT=$WORK_DIR/TDengine/tests/performance-test-report-$today.log PERFORMANCE_TEST_REPORT=$WORK_DIR/TDengine/tests/performance-report-$branch-$type-$today.log
# Coloured Echoes # # Coloured Echoes #
function red_echo { echo -e "\033[31m$@\033[0m"; } # function red_echo { echo -e "\033[31m$@\033[0m"; } #
@ -64,52 +67,41 @@ function buildTDengine {
echo "REMOTE: $REMOTE_COMMIT" echo "REMOTE: $REMOTE_COMMIT"
if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then if [ "$LOCAL_COMMIT" == "$REMOTE_COMMIT" ]; then
echo "repo up-to-date" echo "repo up-to-date"
else fi
echo "repo need to pull"
git pull > /dev/null 2>&1
LOCAL_COMMIT=`git rev-parse --short @` git pull > /dev/null 2>&1
if [ $jemalloc = "jemalloc" ];then if [ $type = "jemalloc" ];then
echo "git submodule update --init --recursive" echo "git submodule update --init --recursive"
git submodule update --init --recursive git submodule update --init --recursive
fi fi
LOCAL_COMMIT=`git rev-parse --short @`
cd debug cd debug
rm -rf * rm -rf *
if [ $type = "jemalloc" ];then
if [ $jemalloc = "jemalloc" ];then
echo "cmake .. -DJEMALLOC_ENABLED=true > /dev/null" echo "cmake .. -DJEMALLOC_ENABLED=true > /dev/null"
cmake .. -DJEMALLOC_ENABLED=true > /dev/null cmake .. -DJEMALLOC_ENABLED=true > /dev/null
else else
cmake .. > /dev/null cmake .. > /dev/null
fi fi
make && make install > /dev/null make > /dev/null 2>&1
fi make install > /dev/null 2>&1
echo "Build TDengine on remote server"
ssh perftest "./buildTDengine.sh $branch > /dev/null"
} }
function runQueryPerfTest { function runQueryPerfTest {
[ -f $PERFORMANCE_TEST_REPORT ] && rm $PERFORMANCE_TEST_REPORT [ -f $PERFORMANCE_TEST_REPORT ] && rm $PERFORMANCE_TEST_REPORT
nohup $WORK_DIR/TDengine/debug/build/bin/taosd -c /etc/taosperf/ > /dev/null 2>&1 & nohup $WORK_DIR/TDengine/debug/build/bin/taosd -c /etc/perf/ > /dev/null 2>&1 &
echoInfo "Wait TDengine to start" echoInfo "Wait TDengine to start"
sleep 60 sleep 60
echoInfo "Run Performance Test" echoInfo "Run Performance Test"
cd $WORK_DIR/TDengine/tests/pytest cd $WORK_DIR/TDengine/tests/pytest
python3 query/queryPerformance.py -c $LOCAL_COMMIT | tee -a $PERFORMANCE_TEST_REPORT python3 query/queryPerformance.py -c $LOCAL_COMMIT -b $branch -T $type | tee -a $PERFORMANCE_TEST_REPORT
mkdir -p /var/lib/perf/ python3 insert/insertFromCSVPerformance.py -c $LOCAL_COMMIT -b $branch -T $type | tee -a $PERFORMANCE_TEST_REPORT
mkdir -p /var/log/perf/
rm -rf /var/lib/perf/*
rm -rf /var/log/perf/*
nohup $WORK_DIR/TDengine/debug/build/bin/taosd -c /etc/perf/ > /dev/null 2>&1 &
echoInfo "Wait TDengine to start"
sleep 10
echoInfo "Run Performance Test"
cd $WORK_DIR/TDengine/tests/pytest
python3 insert/insertFromCSVPerformance.py -c $LOCAL_COMMIT | tee -a $PERFORMANCE_TEST_REPORT python3 tools/taosdemoPerformance.py -c $LOCAL_COMMIT -b $branch -T $type | tee -a $PERFORMANCE_TEST_REPORT
python3 tools/taosdemoPerformance.py -c $LOCAL_COMMIT | tee -a $PERFORMANCE_TEST_REPORT
} }
@ -122,8 +114,7 @@ function sendReport {
sed -i 's/\x1b\[[0-9;]*m//g' $PERFORMANCE_TEST_REPORT sed -i 's/\x1b\[[0-9;]*m//g' $PERFORMANCE_TEST_REPORT
BODY_CONTENT=`cat $PERFORMANCE_TEST_REPORT` BODY_CONTENT=`cat $PERFORMANCE_TEST_REPORT`
echo -e "From: <support@taosdata.com>\nto: ${receiver}\nsubject: Query Performace Report ${branch} ${jemalloc} commit ID: ${LOCAL_COMMIT}\n\n${today}:\n${BODY_CONTENT}" | \
echo -e "From: <support@taosdata.com>\nto: ${receiver}\nsubject: Query Performace Report ${branch} ${jemalloc} ${today}, commit ID: ${LOCAL_COMMIT}\n\n${today}:\n${BODY_CONTENT}" | \
(cat - && uuencode $PERFORMANCE_TEST_REPORT performance-test-report-$today.log) | \ (cat - && uuencode $PERFORMANCE_TEST_REPORT performance-test-report-$today.log) | \
/usr/sbin/ssmtp "${receiver}" && echo "Report Sent!" /usr/sbin/ssmtp "${receiver}" && echo "Report Sent!"
} }

View File

@ -148,6 +148,9 @@ python3 ./test.py -f import_merge/importTPORestart.py
python3 ./test.py -f import_merge/importTRestart.py python3 ./test.py -f import_merge/importTRestart.py
python3 ./test.py -f import_merge/importInsertThenImport.py python3 ./test.py -f import_merge/importInsertThenImport.py
python3 ./test.py -f import_merge/importCSV.py python3 ./test.py -f import_merge/importCSV.py
python3 ./test.py -f import_merge/import_update_0.py
python3 ./test.py -f import_merge/import_update_1.py
python3 ./test.py -f import_merge/import_update_2.py
#======================p1-end=============== #======================p1-end===============
#======================p2-start=============== #======================p2-start===============
# tools # tools
@ -254,6 +257,7 @@ python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py
python3 ./test.py -f query/nestquery_last_row.py python3 ./test.py -f query/nestquery_last_row.py
python3 ./test.py -f query/queryCnameDisplay.py python3 ./test.py -f query/queryCnameDisplay.py
python3 ./test.py -f query/operator_cost.py python3 ./test.py -f query/operator_cost.py
python3 ./test.py -f query/long_where_query.py
python3 test.py -f query/nestedQuery/queryWithSpread.py python3 test.py -f query/nestedQuery/queryWithSpread.py
#stream #stream
@ -376,6 +380,7 @@ python3 test.py -f alter/alter_cacheLastRow.py
python3 ./test.py -f query/querySession.py python3 ./test.py -f query/querySession.py
python3 test.py -f alter/alter_create_exception.py python3 test.py -f alter/alter_create_exception.py
python3 ./test.py -f insert/flushwhiledrop.py python3 ./test.py -f insert/flushwhiledrop.py
python3 ./test.py -f insert/schemalessInsert.py
#======================p4-end=============== #======================p4-end===============
python3 test.py -f tools/taosdemoAllTest/pytest.py python3 test.py -f tools/taosdemoAllTest/pytest.py

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -22,11 +22,12 @@ import argparse
import os.path import os.path
class insertFromCSVPerformace: class insertFromCSVPerformace:
def __init__(self, commitID, dbName, stbName, branchName): def __init__(self, commitID, dbName, tbName, branchName, buildType):
self.commitID = commitID self.commitID = commitID
self.dbName = dbName self.dbName = dbName
self.stbName = stbName self.tbName = tbName
self.branchName = branchName self.branchName = branchName
self.type = buildType
self.ts = 1500074556514 self.ts = 1500074556514
self.host = "127.0.0.1" self.host = "127.0.0.1"
self.user = "root" self.user = "root"
@ -37,6 +38,12 @@ class insertFromCSVPerformace:
self.user, self.user,
self.password, self.password,
self.config) self.config)
self.host2 = "192.168.1.179"
self.conn2 = taos.connect(
host = self.host2,
user = self.user,
password = self.password,
config = self.config)
def writeCSV(self): def writeCSV(self):
with open('test3.csv','w', encoding='utf-8', newline='') as csvFile: with open('test3.csv','w', encoding='utf-8', newline='') as csvFile:
@ -52,47 +59,43 @@ class insertFromCSVPerformace:
data = data.drop([0]) data = data.drop([0])
data.to_csv("ordered.csv", header = False, index = False) data.to_csv("ordered.csv", header = False, index = False)
def createTables(self):
cursor = self.conn.cursor()
cursor.execute("create database if not exists %s" % self.dbName)
cursor.execute("use %s" % self.dbName)
cursor.execute("create table if not exists %s(ts timestamp, in_order_time float, out_of_order_time float, commit_id binary(50)) tags(branch binary(50))" % self.stbName)
cursor.execute("create table if not exists %s using %s tags('%s')" % (self.branchName, self.stbName, self.branchName))
cursor.execute("create table if not exists t1(ts timestamp, c1 int, c2 float, c3 int, c4 int)")
cursor.execute("create table if not exists t2(ts timestamp, c1 int, c2 float, c3 int, c4 int)")
cursor.close()
def run(self): def run(self):
cursor = self.conn.cursor() cursor = self.conn.cursor()
cursor.execute("create database if not exists %s" % self.dbName)
cursor.execute("use %s" % self.dbName) cursor.execute("use %s" % self.dbName)
print("==================== CSV insert performance ====================") print("==================== CSV insert performance ====================")
totalTime = 0 totalTime = 0
for i in range(10): for i in range(10):
cursor.execute("drop table if exists t1")
cursor.execute("create table if not exists t1(ts timestamp, c1 int, c2 float, c3 int, c4 int)") cursor.execute("create table if not exists t1(ts timestamp, c1 int, c2 float, c3 int, c4 int)")
startTime = time.time() startTime = time.time()
cursor.execute("insert into t1 file 'outoforder.csv'") cursor.execute("insert into t1 file 'outoforder.csv'")
totalTime += time.time() - startTime totalTime += time.time() - startTime
cursor.execute("drop table if exists t1")
out_of_order_time = (float) (totalTime / 10) out_of_order_time = (float) (totalTime / 10)
print("Out of Order - Insert time: %f" % out_of_order_time) print("Out of Order - Insert time: %f" % out_of_order_time)
totalTime = 0 totalTime = 0
for i in range(10): for i in range(10):
cursor.execute("drop table if exists t2")
cursor.execute("create table if not exists t2(ts timestamp, c1 int, c2 float, c3 int, c4 int)") cursor.execute("create table if not exists t2(ts timestamp, c1 int, c2 float, c3 int, c4 int)")
startTime = time.time() startTime = time.time()
cursor.execute("insert into t2 file 'ordered.csv'") cursor.execute("insert into t2 file 'ordered.csv'")
totalTime += time.time() - startTime totalTime += time.time() - startTime
cursor.execute("drop table if exists t2")
in_order_time = (float) (totalTime / 10) in_order_time = (float) (totalTime / 10)
print("In order - Insert time: %f" % in_order_time) print("In order - Insert time: %f" % in_order_time)
cursor.execute("insert into %s values(now, %f, %f, '%s')" % (self.branchName, in_order_time, out_of_order_time, self.commitID)) cursor.close()
cursor2 = self.conn2.cursor()
cursor2.execute("create database if not exists %s" % self.dbName)
cursor2.execute("use %s" % self.dbName)
cursor2.execute("create table if not exists %s(ts timestamp, in_order_time float, out_of_order_time float, commit_id binary(50), branch binary(50), type binary(20))" % self.tbName)
cursor2.execute("insert into %s values(now, %f, %f, '%s', '%s', '%s')" % (self.tbName, in_order_time, out_of_order_time, self.commitID, self.branchName, self.type))
cursor2.close()
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument( parser.add_argument(
@ -111,7 +114,7 @@ if __name__ == '__main__':
help='Database name to be created (default: perf)') help='Database name to be created (default: perf)')
parser.add_argument( parser.add_argument(
'-t', '-t',
'--stable-name', '--table-name',
action='store', action='store',
default='csv_insert', default='csv_insert',
type=str, type=str,
@ -123,9 +126,14 @@ if __name__ == '__main__':
default='develop', default='develop',
type=str, type=str,
help='branch name (default: develop)') help='branch name (default: develop)')
parser.add_argument(
'-T',
'--build-type',
action='store',
default='glibc',
type=str,
help='build type (default: glibc)')
args = parser.parse_args() args = parser.parse_args()
perftest = insertFromCSVPerformace(args.commit_id, args.database_name, args.stable_name, args.branch_name) perftest = insertFromCSVPerformace(args.commit_id, args.database_name, args.table_name, args.branch_name, args.build_type)
perftest.createTables()
perftest.run() perftest.run()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,305 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import random
import string
import os
import time
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
from util.dnodes import tdDnodes
class TDTestCase:
updatecfgDict={'maxSQLLength':1048576}
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1538548685000
self.num = 100
def get_random_string(self, length):
letters = string.ascii_lowercase
result_str = ''.join(random.choice(letters) for i in range(length))
return result_str
def run(self):
tdSql.prepare()
# test case for https://jira.taosdata.com:18080/browse/TD-5213
print("==============step1, regular table==============")
startTime = time.time()
sql = "create table regular_table_1(ts timestamp, "
for i in range(4094):
sql += "col00000111112222233333444445555566666777778888899999000000l%d int, " % (i + 1)
sql += "col4095 binary(22))"
tdLog.info(len(sql))
tdSql.execute(sql)
tdLog.info("========== test1.1 : test regular table in ( ) ==========")
sql = '''insert into regular_table_1(ts,col00000111112222233333444445555566666777778888899999000000l1) values(now,1);'''
tdSql.execute(sql)
sql = ''' select * from regular_table_1 where col00000111112222233333444445555566666777778888899999000000l1 in (1); '''
tdSql.query(sql)
tdSql.checkData(0, 1, 1)
for i in range(self.num):
sql = "insert into regular_table_1 values(%d, "
for j in range(4094):
str = "'%s', " % random.randint(0,1000)
sql += str
sql += "'%s')" % self.get_random_string(22)
tdSql.execute(sql % (self.ts + i))
time.sleep(1)
tdSql.query("select count(*) from regular_table_1")
tdSql.checkData(0, 0, self.num+1)
tdSql.query("select * from regular_table_1")
tdSql.checkRows(self.num+1)
tdSql.checkCols(4096)
#maxSQLLength 1048576
sql = "select * from regular_table_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for i in range(2,128840):
sql += "%d , " % (i + 1)
sql += "1 ,12345) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkData(0, 1, 1)
tdSql.checkCols(4096)
#maxSQLLength 1048577--error
sql = "select * from regular_table_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for i in range(2,128840):
sql += "%d , " % (i + 1)
sql += "1 ,123456) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
tdLog.info("========== test1.2 : test regular table in (' ') ==========")
sql = '''insert into regular_table_1(ts,col4095) values(now,1);'''
tdSql.execute(sql)
sql = ''' select * from regular_table_1 where col4095 in ('1',"1"); '''
tdSql.query(sql)
tdSql.checkData(0, 4095, 1)
#maxSQLLength 1048576
sql = " select * from regular_table_1 where col4095 in ("
for i in range(96328):
sql += " '%d' , " % (i + 1)
sql += " '1' ) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkData(0, 4095, 1)
tdSql.checkCols(4096)
#maxSQLLength 1048577--error
sql = " select * from regular_table_1 where col4095 in ("
for i in range(96328):
sql += " '%d' , " % (i + 1)
sql += " '123' ) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
endTime = time.time()
print("total time %ds" % (endTime - startTime))
print("==============step2, super table ==============")
startTime = time.time()
sql = "create stable stable_1(ts timestamp, "
for i in range(4090):
sql += "col00000111112222233333444445555566666777778888899999000000l%d int, " % (i + 1)
sql += "col4091 binary(22))"
sql += " tags (loc nchar(10),tag_1 int,tag_2 int,tag_3 int) "
tdLog.info(len(sql))
tdSql.execute(sql)
sql = '''create table table_1 using stable_1
tags('table_1' , '1' , '2' , '3' );'''
tdSql.execute(sql)
tdLog.info("========== test2.1 : test super table in ( ) ==========")
sql = '''insert into table_1(ts,col00000111112222233333444445555566666777778888899999000000l1) values(now,1);'''
tdSql.execute(sql)
sql = ''' select * from stable_1 where col00000111112222233333444445555566666777778888899999000000l1 in (1); '''
tdSql.query(sql)
tdSql.checkData(0, 1, 1)
sql = ''' select * from table_1 where col00000111112222233333444445555566666777778888899999000000l1 in (1); '''
tdSql.query(sql)
tdSql.checkData(0, 1, 1)
for i in range(self.num):
sql = "insert into table_1 values(%d, "
for j in range(4090):
str = "'%s', " % random.randint(0,1000)
sql += str
sql += "'%s')" % self.get_random_string(22)
tdSql.execute(sql % (self.ts + i))
time.sleep(1)
tdSql.query("select count(*) from table_1")
tdSql.checkData(0, 0, self.num+1)
tdSql.query("select * from table_1")
tdSql.checkRows(self.num+1)
tdSql.checkCols(4092)
tdSql.query("select count(*) from stable_1")
tdSql.checkData(0, 0, self.num+1)
tdSql.query("select * from stable_1")
tdSql.checkRows(self.num+1)
tdSql.checkCols(4096)
#maxSQLLength 1048576
sql = "select * from table_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for i in range(128840):
sql += "%d , " % (i + 1)
sql += "1 ,12345) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkData(0, 1, 1)
tdSql.checkCols(4092)
sql = "select * from stable_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for i in range(128840):
sql += "%d , " % (i + 1)
sql += "1 ,1234) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkData(0, 1, 1)
tdSql.checkCols(4096)
#TD-5640
sql = "select * from stable_1 where tag_1 in ("
for i in range(128847):
sql += "%d , " % (i + 1)
sql += "1)order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkData(0, 1, 1)
tdSql.checkCols(4096)
#maxSQLLength 1048577--error
sql = "select * from table_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for i in range(128840):
sql += "%d , " % (i + 1)
sql += "1 ,123456) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
sql = "select * from stable_1 where col00000111112222233333444445555566666777778888899999000000l1 in ("
for i in range(128840):
sql += "%d , " % (i + 1)
sql += "1 ,12345) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
sql = "select * from stable_1 where tag_1 in ("
for i in range(128847):
sql += "%d , " % (i + 1)
sql += "1) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
tdLog.info("========== tests2.2 : test super table in (' ') ==========")
sql = '''insert into table_1(ts,col4091) values(now,1);'''
tdSql.execute(sql)
sql = ''' select * from table_1 where col4091 in ('1',"1"); '''
tdSql.query(sql)
tdSql.checkData(0, 4091, 1)
#maxSQLLength 1048576
sql = " select * from table_1 where col4091 in ("
for i in range(96328):
sql += " '%d' , " % (i + 1)
sql += " '1','123456' ) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkData(0, 4091, 1)
tdSql.checkCols(4092)
sql = " select * from stable_1 where col4091 in ("
for i in range(96328):
sql += " '%d' , " % (i + 1)
sql += " '1','12345' ) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkData(0, 4091, 1)
tdSql.checkCols(4096)
#TD-5650
sql = " select * from stable_1 where loc in ("
for i in range(96328):
sql += " '%d' , " % (i + 1)
sql += " '123','table_1' ) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.query(sql)
tdSql.checkData(0, 4092, 'table_1')
tdSql.checkCols(4096)
#maxSQLLength 1048577--error
sql = " select * from table_1 where col4091 in ("
for i in range(96328):
sql += " '%d' , " % (i + 1)
sql += " '1','1234567' ) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
sql = " select * from stable_1 where col4091 in ("
for i in range(96328):
sql += " '%d' , " % (i + 1)
sql += " '1','123456' ) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
sql = " select * from stable_1 where loc in ("
for i in range(96328):
sql += " '%d' , " % (i + 1)
sql += " '1','1234567890' ) order by ts desc;"
#tdLog.info(sql)
tdLog.info(len(sql))
tdSql.error(sql)
endTime = time.time()
print("total time %ds" % (endTime - startTime))
os.system("rm -rf query/long_where_query.py.sql")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())

View File

@ -1,536 +0,0 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import taos
from util.log import tdLog
from util.cases import tdCases
from util.sql import tdSql
import random
import time
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1600000000000
self.num = 10
def run(self):
tdSql.prepare()
# test case for https://jira.taosdata.com:18080/browse/TD-5074
startTime = time.time()
tdSql.execute('''create stable stable_1
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint,
q_bool bool , q_binary binary(20) , q_nchar nchar(20) ,
q_float float , q_double double , q_ts timestamp)
tags(loc nchar(20) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint,
t_bool bool , t_binary binary(20) , t_nchar nchar(20) ,
t_float float , t_double double , t_ts timestamp);''')
tdSql.execute('''create stable stable_2
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint,
q_bool bool , q_binary binary(20) , q_nchar nchar(20) ,
q_float float , q_double double , q_ts timestamp)
tags(loc nchar(20) , t_int int , t_bigint bigint , t_smallint smallint , t_tinyint tinyint,
t_bool bool , t_binary binary(20) , t_nchar nchar(20) ,
t_float float , t_double double , t_ts timestamp);''')
tdSql.execute('''create table table_0 using stable_1
tags('table_0' , '0' , '0' , '0' , '0' , 0 , '0' , '0' , '0' , '0' ,'0')''')
tdSql.execute('''create table table_1 using stable_1
tags('table_1' , '2147483647' , '9223372036854775807' , '32767' , '127' , 1 ,
'binary1' , 'nchar1' , '1' , '11' , \'1999-09-09 09:09:09.090\')''')
tdSql.execute('''create table table_2 using stable_1
tags('table_2' , '-2147483647' , '-9223372036854775807' , '-32767' , '-127' , false ,
'binary2' , 'nchar2nchar2' , '-2.2' , '-22.22' , \'2099-09-09 09:09:09.090\')''')
tdSql.execute('''create table table_3 using stable_1
tags('table_3' , '3' , '3' , '3' , '3' , true , 'binary3' , 'nchar3' , '33.33' , '3333.3333' , '0')''')
tdSql.execute('''create table table_4 using stable_1
tags('table_4' , '4' , '4' , '4' , '4' , false , 'binary4' , 'nchar4' , '-444.444' , '-444444.444444' , '0')''')
tdSql.execute('''create table table_5 using stable_1
tags('table_5' , '5' , '5' , '5' , '5' , true , 'binary5' , 'nchar5' , '5555.5555' , '55555555.55555555' , '0')''')
tdSql.execute('''create table table_21 using stable_2
tags('table_5' , '5' , '5' , '5' , '5' , true , 'binary5' , 'nchar5' , '5555.5555' , '55555555.55555555' , '0')''')
#regular table
tdSql.execute('''create table regular_table_1
(ts timestamp , q_int int , q_bigint bigint , q_smallint smallint , q_tinyint tinyint,
q_bool bool , q_binary binary(20) , q_nchar nchar(20) ,
q_float float , q_double double , q_ts timestamp) ;''')
for i in range(self.num):
tdSql.execute('''insert into table_0 values(%d, %d, %d, %d, %d, 0, 'binary.%s', 'nchar.%s', %f, %f, %d)'''
% (self.ts + i, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into table_1 values(%d, %d, %d, %d, %d, 1, 'binary1.%s', 'nchar1.%s', %f, %f, %d)'''
% (self.ts + i, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i,
i, i, random.random(), random.random(), 1262304000001 + i))
tdSql.execute('''insert into table_2 values(%d, %d, %d, %d, %d, true, 'binary2.%s', 'nchar2nchar2.%s', %f, %f, %d)'''
% (self.ts + i, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i,
i, i, random.uniform(-1,0), random.uniform(-1,0), 1577836800001 + i))
tdSql.execute('''insert into table_3 values(%d, %d, %d, %d, %d, false, 'binary3.%s', 'nchar3.%s', %f, %f, %d)'''
% (self.ts + i, random.randint(-2147483647, 2147483647),
random.randint(-9223372036854775807, 9223372036854775807), random.randint(-32767, 32767),
random.randint(-127, 127), random.randint(-100, 100), random.randint(-10000, 10000),
random.uniform(-100000,100000), random.uniform(-1000000000,1000000000), self.ts + i))
tdSql.execute('''insert into table_4 values(%d, %d, %d, %d, %d, true, 'binary4.%s', 'nchar4.%s', %f, %f, %d)'''
% (self.ts + i, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into table_5 values(%d, %d, %d, %d, %d, false, 'binary5.%s', 'nchar5.%s', %f, %f, %d)'''
% (self.ts + i, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into table_21 values(%d, %d, %d, %d, %d, false, 'binary5.%s', 'nchar5.%s', %f, %f, %d)'''
% (self.ts + i, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, 0, 'binary.%s', 'nchar.%s', %f, %f, %d)'''
% (self.ts + i, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, 1, 'binary1.%s', 'nchar1.%s', %f, %f, %d)'''
% (self.ts + 100 + i, 2147483647-i, 9223372036854775807-i, 32767-i, 127-i,
i, i, random.random(), random.random(), 1262304000001 + i))
tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, true, 'binary2.%s', 'nchar2nchar2.%s', %f, %f, %d)'''
% (self.ts + 200 + i, -2147483647+i, -9223372036854775807+i, -32767+i, -127+i,
i, i, random.uniform(-1,0), random.uniform(-1,0), 1577836800001 + i))
tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, false, 'binary3.%s', 'nchar3.%s', %f, %f, %d)'''
% (self.ts + 300 + i, random.randint(-2147483647, 2147483647),
random.randint(-9223372036854775807, 9223372036854775807), random.randint(-32767, 32767),
random.randint(-127, 127), random.randint(-100, 100), random.randint(-10000, 10000),
random.uniform(-100000,100000), random.uniform(-1000000000,1000000000), self.ts + i))
tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, true, 'binary4.%s', 'nchar4.%s', %f, %f, %d)'''
% (self.ts + 400 + i, i, i, i, i, i, i, i, i, self.ts + i))
tdSql.execute('''insert into regular_table_1 values(%d, %d, %d, %d, %d, false, 'binary5.%s', 'nchar5.%s', %f, %f, %d)'''
% (self.ts + 500 + i, i, i, i, i, i, i, i, i, self.ts + i))
tdLog.info("========== operator=1(OP_TableScan) ==========")
tdLog.info("========== operator=7(OP_Project) ==========")
sql = '''select * from stable_1'''
tdSql.query(sql)
tdSql.checkRows(6*self.num)
sql = '''select * from regular_table_1'''
tdSql.query(sql)
tdSql.checkRows(6*self.num)
tdLog.info("========== operator=14(OP_MultiTableAggregate ) ==========")
sql = '''select last_row(*) from stable_1;'''
tdSql.query(sql)
tdSql.checkData(0,1,self.num-1)
tdLog.info("========== operator=6(OP_Aggregate) ==========")
sql = '''select last_row(*) from regular_table_1;'''
tdSql.query(sql)
tdSql.checkData(0,1,self.num-1)
tdLog.info("========== operator=9(OP_Limit) ==========")
sql = '''select * from stable_1 where loc = 'table_0' limit 5;'''
tdSql.query(sql)
tdSql.checkRows(5)
sql = '''select last_row(*) from (select * from stable_1 where loc = 'table_0');'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select * from regular_table_1 ;'''
tdSql.query(sql)
tdSql.checkRows(6*self.num)
sql = '''select last_row(*) from (select * from regular_table_1);'''
tdSql.query(sql)
tdSql.checkRows(1)
tdSql.checkData(0,1,self.num-1)
sql = '''select last_row(*) from
((select * from table_0) union all
(select * from table_1) union all
(select * from table_2));'''
tdSql.error(sql)
tdLog.info("========== operator=16(OP_DummyInput) ==========")
sql = '''select last_row(*) from
((select last_row(*) from table_0) union all
(select last_row(*) from table_1) union all
(select last_row(*) from table_2));'''
tdSql.error(sql)
sql = '''select last_row(*) from
((select * from table_0 limit 5 offset 5) union all
(select * from table_1 limit 5 offset 5) union all
(select * from regular_table_1 limit 5 offset 5));'''
tdSql.error(sql)
tdLog.info("========== operator=10(OP_SLimit) ==========")
sql = '''select count(*) from stable_1 group by loc slimit 3 soffset 2 ;'''
tdSql.query(sql)
tdSql.checkRows(3)
sql = '''select last_row(*) from
((select * from table_0) union all
(select * from table_1) union all
(select * from table_2));'''
tdSql.error(sql)
tdLog.info("========== operator=20(OP_Distinct) ==========")
tdLog.info("========== operator=4(OP_TagScan) ==========")
sql = '''select distinct(t_bool) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(2)
sql = '''select distinct(loc) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(6)
sql = '''select distinct(t_int) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(6)
sql = '''select distinct(t_bigint) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(6)
sql = '''select distinct(t_smallint) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(6)
sql = '''select distinct(t_tinyint) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(6)
sql = '''select distinct(t_nchar) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(6)
sql = '''select distinct(t_float) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(6)
sql = '''select distinct(t_double) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(6)
sql = '''select distinct(t_ts) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(3)
sql = '''select distinct(tbname) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(6)
tdLog.info("========== operator=2(OP_DataBlocksOptScan) ==========")
sql = '''select last(q_int),first(q_int) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_bigint),first(q_bigint) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_smallint),first(q_smallint) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_tinyint),first(q_tinyint) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_bool),first(q_bool) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_binary),first(q_binary) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_nchar),first(q_nchar) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_float),first(q_float) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_double),first(q_double) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_ts),first(q_ts) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_int),last(q_bigint), last(q_smallint),last(q_tinyint),last(q_bool),last(q_binary),last(q_nchar),
last(q_float),last(q_double),last(q_ts),first(q_int),first(q_bigint),first(q_smallint),first(q_tinyint),
first(q_bool),first(q_binary),first(q_nchar),first(q_float),first(q_float),first(q_double),first(q_ts) from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_int),last(q_bigint), last(q_smallint),last(q_tinyint),last(q_bool),last(q_binary),last(q_nchar),
last(q_float),last(q_double),last(q_ts),first(q_int),first(q_bigint),first(q_smallint),first(q_tinyint),first(q_bool),
first(q_binary),first(q_nchar),first(q_float),first(q_float),first(q_double),first(q_ts) from regular_table_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
tdLog.info("========== operator=8(OP_Groupby) ==========")
sql = '''select stddev(q_int) from table_0 group by q_int;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
sql = '''select stddev(q_int),stddev(q_bigint),stddev(q_smallint),stddev(q_tinyint),stddev(q_float),stddev(q_double) from stable_1 group by q_int;'''
tdSql.query(sql)
sql = '''select stddev(q_int),stddev(q_bigint),stddev(q_smallint),stddev(q_tinyint),stddev(q_float),stddev(q_double) from table_1 group by q_bigint;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
sql = '''select stddev(q_int),stddev(q_bigint),stddev(q_smallint),stddev(q_tinyint),stddev(q_float),stddev(q_double) from regular_table_1 group by q_smallint;'''
tdSql.query(sql)
tdLog.info("========== operator=11(OP_TimeWindow) ==========")
sql = '''select last(q_int) from table_0 interval(1m);'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_int),last(q_bigint), last(q_smallint),last(q_tinyint),
first(q_int),first(q_bigint),first(q_smallint),first(q_tinyint) from table_1 interval(1m);'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_int),last(q_bigint), last(q_smallint),last(q_tinyint),
first(q_int),first(q_bigint),first(q_smallint),first(q_tinyint) from stable_1 interval(1m);'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select last(q_int),last(q_bigint), last(q_smallint),last(q_tinyint),
first(q_int),first(q_bigint),first(q_smallint),first(q_tinyint) from regular_table_1 interval(1m);'''
tdSql.query(sql)
tdSql.checkRows(1)
tdLog.info("========== operator=12(OP_SessionWindow) ==========")
sql = '''select count(*) from table_1 session(ts,1s);'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select count(*) from regular_table_1 session(ts,1s);'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select count(*),sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from table_1 session(ts,1s);'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select count(*),sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from regular_table_1 session(ts,1s);'''
tdSql.query(sql)
tdSql.checkRows(1)
tdLog.info("========== operator=13(OP_Fill) ==========")
sql = '''select sum(q_int) from table_0
where ts >='1970-10-01 00:00:00' and ts <=now interval(1n) fill(NULL);'''
tdSql.query(sql)
tdSql.checkData(0,1,'None')
sql = '''select sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from stable_1 where ts >='1970-10-01 00:00:00' and ts <=now interval(1n) fill(NULL);'''
tdSql.query(sql)
tdSql.checkData(0,1,'None')
sql = '''select sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from regular_table_1 where ts >='1970-10-01 00:00:00' and ts <=now interval(1n) fill(NULL);'''
tdSql.query(sql)
tdSql.checkData(0,1,'None')
sql = '''select sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from table_0 where ts >='1970-10-01 00:00:00' and ts <=now interval(1n) fill(NULL);'''
tdSql.query(sql)
tdSql.checkData(0,1,'None')
#TD-5190
sql = '''select sum(q_tinyint),stddev(q_float) from stable_1
where ts >='1970-10-01 00:00:00' and ts <=now interval(1n) fill(NULL);'''
tdSql.query(sql)
tdSql.checkData(0,1,'None')
tdLog.info("========== operator=15(OP_MultiTableTimeInterval) ==========")
sql = '''select avg(q_int) from stable_1 where ts<now interval(10m);'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from table_1 where ts<now interval(10m);'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from stable_1 where ts<now interval(10m);'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from regular_table_1 where ts<now interval(10m);'''
tdSql.query(sql)
tdSql.checkRows(1)
tdLog.info("========== operator=3(OP_TableSeqScan) ==========")
tdLog.info("========== operator=6(OP_Aggregate) ==========")
sql = '''select * from table_1,table_2
where table_1.ts = table_2.ts;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
#TD-5206
sql = '''select * from stable_1,stable_2
where stable_1.t_nchar = stable_2.t_nchar and stable_1.ts = stable_2.ts;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
#TD-5139
sql = '''select * from table_1,regular_table_1
where table_1.ts = regular_table_1.ts;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
tdLog.info("========== operator=5(OP_TableBlockInfoScan) ==========")
sql = '''select _block_dist() from stable_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select _block_dist() from table_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
sql = '''select _block_dist() from regular_table_1;'''
tdSql.query(sql)
tdSql.checkRows(1)
tdLog.info("========== operator=17(OP_MultiwayMergeSort) ==========")
tdLog.info("========== operator=18(OP_GlobalAggregate) ==========")
tdLog.info("========== operator=19(OP_Filter) ==========")
sql = '''select loc,sum(q_int) from stable_1
group by loc having sum(q_int)>=0;'''
tdSql.query(sql)
tdSql.checkData(0,0,'table_0')
sql = '''select loc, sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from stable_1 group by loc having sum(q_int)>=0;'''
tdSql.query(sql)
tdSql.checkData(0,0,'table_0')
sql = '''select loc, sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from stable_1 group by loc having avg(q_int)>=0;'''
tdSql.query(sql)
tdSql.checkData(0,0,'table_0')
sql = '''select loc, sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from stable_1 group by loc having min(q_int)>=0;'''
tdSql.query(sql)
tdSql.checkData(0,0,'table_0')
sql = '''select loc, sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from stable_1 group by loc having max(q_int)>=0;'''
tdSql.query(sql)
tdSql.checkData(0,0,'table_0')
sql = '''select loc, sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from stable_1 group by loc having first(q_int)>=0;'''
tdSql.query(sql)
tdSql.checkData(0,0,'table_0')
sql = '''select loc, sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from stable_1 group by loc having last(q_int)>=0;'''
tdSql.query(sql)
tdSql.checkData(0,0,'table_0')
tdLog.info("========== operator=21(OP_Join) ==========")
sql = '''select t1.q_int,t2.q_int from
(select ts,q_int from table_1) t1 , (select ts,q_int from table_2) t2
where t2.ts = t1.ts;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
sql = '''select t1.*,t2.* from
(select * from table_1) t1 , (select * from table_2) t2
where t2.ts = t1.ts;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
sql = '''select t1.*,t2.* from
(select * from regular_table_1) t1 , (select * from table_0) t2
where t2.ts = t1.ts;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
sql = '''select t1.*,t2.* from
(select * from stable_1) t1 , (select * from table_2) t2
where t2.ts = t1.ts;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
sql = '''select t1.*,t2.* from
(select * from regular_table_1) t1 , (select * from stable_1) t2
where t2.ts = t1.ts;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
sql = '''select t1.*,t2.*,t3.* from
(select * from regular_table_1) t1 , (select * from stable_1) t2, (select * from table_0) t3
where t2.ts = t1.ts and t3.ts = t1.ts and t2.ts = t3.ts;'''
tdSql.query(sql)
tdSql.checkRows(self.num)
tdLog.info("========== operator=22(OP_StateWindow) ==========")
sql = '''select avg(q_int),sum(q_smallint) from table_1 state_window(q_int);'''
tdSql.query(sql)
tdSql.checkRows(self.num)
sql = '''select sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from table_1 state_window(q_bigint);'''
tdSql.query(sql)
tdSql.checkRows(self.num)
sql = '''select sum(q_int), avg(q_int), min(q_int), max(q_int), first(q_int), last(q_int),
sum(q_bigint), avg(q_bigint), min(q_bigint), max(q_bigint), first(q_bigint), last(q_bigint),
sum(q_smallint), avg(q_smallint), min(q_smallint), max(q_smallint), first(q_smallint), last(q_smallint),
sum(q_tinyint), avg(q_tinyint), min(q_tinyint), max(q_tinyint), first(q_tinyint), last(q_tinyint),
sum(q_float), avg(q_float), min(q_float), max(q_float), first(q_float), last(q_float),
sum(q_double), avg(q_double), min(q_double), max(q_double), first(q_double), last(q_double)
from regular_table_1 state_window(q_smallint);'''
tdSql.query(sql)
tdSql.checkRows(6*self.num)
endTime = time.time()
print("total time %ds" % (endTime - startTime))
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())

View File

@ -207,9 +207,9 @@ class TDTestCase:
sql = '''select distinct(t_ts) from stable_1;''' sql = '''select distinct(t_ts) from stable_1;'''
tdSql.query(sql) tdSql.query(sql)
tdSql.checkRows(3) tdSql.checkRows(3)
# sql = '''select distinct(tbname) from stable_1;''' sql = '''select distinct(tbname) from stable_1;'''
# tdSql.query(sql) tdSql.query(sql)
# tdSql.checkRows(6) tdSql.checkRows(6)
tdLog.info("========== operator=2(OP_DataBlocksOptScan) ==========") tdLog.info("========== operator=2(OP_DataBlocksOptScan) ==========")
sql = '''select last(q_int),first(q_int) from stable_1;''' sql = '''select last(q_int),first(q_int) from stable_1;'''

View File

@ -20,12 +20,14 @@ import argparse
class taosdemoQueryPerformace: class taosdemoQueryPerformace:
def __init__(self, clearCache, commitID, dbName, stbName, tbPerfix): def __init__(self, clearCache, commitID, dbName, stbName, tbPerfix, branch, type):
self.clearCache = clearCache self.clearCache = clearCache
self.commitID = commitID self.commitID = commitID
self.dbName = dbName self.dbName = dbName
self.stbName = stbName self.stbName = stbName
self.tbPerfix = tbPerfix self.tbPerfix = tbPerfix
self.branch = branch
self.type = type
self.host = "127.0.0.1" self.host = "127.0.0.1"
self.user = "root" self.user = "root"
self.password = "taosdata" self.password = "taosdata"
@ -35,50 +37,56 @@ class taosdemoQueryPerformace:
self.user, self.user,
self.password, self.password,
self.config) self.config)
self.host2 = "192.168.1.179"
self.conn2 = taos.connect(
host = self.host2,
user = self.user,
password = self.password,
config = self.config)
def createPerfTables(self): def createPerfTables(self):
cursor = self.conn.cursor() cursor2 = self.conn2.cursor()
cursor.execute("create database if not exists %s" % self.dbName) cursor2.execute("create database if not exists %s" % self.dbName)
cursor.execute("use %s" % self.dbName) cursor2.execute("use %s" % self.dbName)
cursor.execute("create table if not exists %s(ts timestamp, query_time float, commit_id binary(50)) tags(query_id int, query_sql binary(300))" % self.stbName) cursor2.execute("create table if not exists %s(ts timestamp, query_time float, commit_id binary(50), branch binary(50), type binary(20)) tags(query_id int, query_sql binary(300))" % self.stbName)
sql = "select count(*) from test.meters" sql = "select count(*) from test.meters"
tableid = 1 tableid = 1
cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select avg(f1), max(f2), min(f3) from test.meters" sql = "select avg(f1), max(f2), min(f3) from test.meters"
tableid = 2 tableid = 2
cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select count(*) from test.meters where loc='beijing'" sql = "select count(*) from test.meters where loc='beijing'"
tableid = 3 tableid = 3
cursor.execute("create table if not exists %s%d using %s tags(%d, \"%s\")" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor2.execute("create table if not exists %s%d using %s tags(%d, \"%s\")" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select avg(f1), max(f2), min(f3) from test.meters where areaid=10" sql = "select avg(f1), max(f2), min(f3) from test.meters where areaid=10"
tableid = 4 tableid = 4
cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select avg(f1), max(f2), min(f3) from test.t10 interval(10s)" sql = "select avg(f1), max(f2), min(f3) from test.t10 interval(10s)"
tableid = 5 tableid = 5
cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select last_row(*) from meters" sql = "select last_row(*) from meters"
tableid = 6 tableid = 6
cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select * from meters" sql = "select * from meters"
tableid = 7 tableid = 7
cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select avg(f1), max(f2), min(f3) from meters where ts <= '2017-07-15 10:40:01.000' and ts <= '2017-07-15 14:00:40.000'" sql = "select avg(f1), max(f2), min(f3) from meters where ts <= '2017-07-15 10:40:01.000' and ts <= '2017-07-15 14:00:40.000'"
tableid = 8 tableid = 8
cursor.execute("create table if not exists %s%d using %s tags(%d, \"%s\")" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor2.execute("create table if not exists %s%d using %s tags(%d, \"%s\")" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
sql = "select last(*) from meters" sql = "select last(*) from meters"
tableid = 9 tableid = 9
cursor.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql)) cursor2.execute("create table if not exists %s%d using %s tags(%d, '%s')" % (self.tbPerfix, tableid, self.stbName, tableid, sql))
cursor.close() cursor2.close()
def query(self): def query(self):
cursor = self.conn.cursor() cursor = self.conn.cursor()
@ -106,8 +114,8 @@ class taosdemoQueryPerformace:
cursor2.close() cursor2.close()
print("query time for: %s %f seconds" % (sql, totalTime / 100)) print("query time for: %s %f seconds" % (sql, totalTime / 100))
cursor3 = self.conn.cursor() cursor3 = self.conn2.cursor()
cursor3.execute("insert into %s.%s values(now, %f, '%s')" % (self.dbName, table_name, totalTime / 100, self.commitID)) cursor3.execute("insert into %s.%s values(now, %f, '%s', '%s', '%s')" % (self.dbName, table_name, totalTime / 100, self.commitID, self.branch, self.type))
cursor3.close() cursor3.close()
cursor.close() cursor.close()
@ -148,8 +156,22 @@ if __name__ == '__main__':
default='q', default='q',
type=str, type=str,
help='table name perfix (default: q)') help='table name perfix (default: q)')
parser.add_argument(
'-b',
'--git-branch',
action='store',
default='master',
type=str,
help='git branch (default: master)')
parser.add_argument(
'-T',
'--build-type',
action='store',
default='glibc',
type=str,
help='build type (default: glibc)')
args = parser.parse_args() args = parser.parse_args()
perftest = taosdemoQueryPerformace(args.remove_cache, args.commit_id, args.database_name, args.stable_name, args.table_perfix) perftest = taosdemoQueryPerformace(args.remove_cache, args.commit_id, args.database_name, args.stable_name, args.table_perfix, args.git_branch, args.build_type)
perftest.createPerfTables() perftest.createPerfTables()
perftest.query() perftest.query()

View File

@ -0,0 +1,125 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import sys
import os
from util.log import *
from util.cases import *
from util.sql import *
from util.dnodes import *
class TDTestCase:
def init(self, conn, logSql):
tdLog.debug("start to execute %s" % __file__)
tdSql.init(conn.cursor(), logSql)
self.ts = 1625068800000000000 # this is timestamp "2021-07-01 00:00:00"
self.numberOfTables = 10
self.numberOfRecords = 100
def checkCommunity(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
return False
else:
return True
def getBuildPath(self):
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
projPath = selfPath[:selfPath.find("community")]
else:
projPath = selfPath[:selfPath.find("tests")]
for root, dirs, files in os.walk(projPath):
if ("taosdump" in files):
rootRealPath = os.path.dirname(os.path.realpath(root))
if ("packaging" not in rootRealPath):
buildPath = root[:len(root) - len("/build/bin")]
break
return buildPath
def run(self):
buildPath = self.getBuildPath()
if (buildPath == ""):
tdLog.exit("taosdump not found!")
else:
tdLog.info("taosdump found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
# basic test for alter tags
tdSql.execute("create database tagdb ")
tdSql.execute(" use tagdb")
tdSql.execute("create table st (ts timestamp , a int) tags (tg1 binary(20), tg2 binary(20), tg3 binary(20))")
tdSql.execute("insert into t using st (tg3, tg2, tg1) tags ('tg3', 'tg2', 'tg1') values (now, 1)")
tdSql.execute("alter table t set tag tg1='newtg1'")
res = tdSql.getResult("select tg1,tg2,tg3 from t")
if res == [('newtg1', 'tg2', 'tg3')]:
tdLog.info(" alter tag check has pass!")
else:
tdLog.info(" alter tag failed , please check !")
tdSql.error("alter stable st modify tag tg2 binary(2)")
tdSql.execute("alter stable st modify tag tg2 binary(30) ")
tdSql.execute("alter table t set tag tg2 = 'abcdefghijklmnopqrstuvwxyz1234'")
res = tdSql.getResult("select tg1,tg2,tg3 from t")
if res == [('newtg1', 'abcdefghijklmnopqrstuvwxyz1234', 'tg3')]:
tdLog.info(" alter tag check has pass!")
else:
tdLog.info(" alter tag failed , please check !")
# test boundary about tags
tdSql.execute("create stable stb1 (ts timestamp , a int) tags (tg1 binary(16374))")
tdSql.error("create stable stb1 (ts timestamp , a int) tags (tg1 binary(16375))")
bound_sql = "create stable stb2 (ts timestamp , a int) tags (tg1 binary(10),"
for i in range(127):
bound_sql+="tag"+str(i)+" binary(10),"
sql1 = bound_sql[:-1]+")"
tdSql.execute(sql1)
sql2 = bound_sql[:-1]+"tag127 binary(10))"
tdSql.error(sql2)
tdSql.execute("create stable stb3 (ts timestamp , a int) tags (tg1 nchar(4093))")
tdSql.error("create stable stb3 (ts timestamp , a int) tags (tg1 nchar(4094))")
tdSql.execute("create stable stb4 (ts timestamp , a int) tags (tg1 nchar(4093),tag2 binary(8))")
tdSql.error("create stable stb4 (ts timestamp , a int) tags (tg1 nchar(4093),tag2 binary(9))")
tdSql.execute("create stable stb5 (ts timestamp , a int) tags (tg1 nchar(4093),tag2 binary(4),tag3 binary(2))")
tdSql.error("create stable stb5 (ts timestamp , a int) tags (tg1 nchar(4093),tag2 binary(4),tag3 binary(3))")
tdSql.execute("create table stt (ts timestamp , a binary(100)) tags (tg1 binary(20), tg2 binary(20), tg3 binary(20))")
tdSql.execute("insert into tt using stt (tg3, tg2, tg1) tags ('tg3', 'tg2', 'tg1') values (now, 1)")
tags = "t"*16337
sql3 = "alter table tt set tag tg1=" +"'"+tags+"'"
tdSql.error(sql3)
tdSql.execute("alter stable stt modify tag tg1 binary(16337)")
tdSql.execute(sql3)
res = tdSql.getResult("select tg1,tg2,tg3 from tt")
if res == [(tags, 'tg2', 'tg3')]:
tdLog.info(" alter tag check has pass!")
else:
tdLog.info(" alter tag failed , please check !")
os.system("rm -rf ./tag_lite/TestModifyTag.py.sql")
def stop(self):
tdSql.close()
tdLog.success("%s successfully executed" % __file__)
tdCases.addWindows(__file__, TDTestCase())
tdCases.addLinux(__file__, TDTestCase())

View File

@ -79,7 +79,7 @@ class TDTestCase:
# merge result files # merge result files
sleep(10) sleep(5)
os.system("cat subscribe_res0.txt* > all_subscribe_res0.txt") os.system("cat subscribe_res0.txt* > all_subscribe_res0.txt")
os.system("cat subscribe_res1.txt* > all_subscribe_res1.txt") os.system("cat subscribe_res1.txt* > all_subscribe_res1.txt")
os.system("cat subscribe_res2.txt* > all_subscribe_res2.txt") os.system("cat subscribe_res2.txt* > all_subscribe_res2.txt")
@ -99,7 +99,7 @@ class TDTestCase:
# insert extral data # insert extral data
tdSql.execute("use subnsdb") tdSql.execute("use subnsdb")
tdSql.execute("insert into tb0_0 values(now,100.1000,'subtest1',now-1s)") tdSql.execute("insert into tb0_0 values(now,100.1000,'subtest1',now-1s)")
sleep(1) sleep(15)
os.system("cat subscribe_res0.txt* > all_subscribe_res0.txt") os.system("cat subscribe_res0.txt* > all_subscribe_res0.txt")
subTimes0 = self.subTimes("all_subscribe_res0.txt") subTimes0 = self.subTimes("all_subscribe_res0.txt")

View File

@ -20,9 +20,11 @@ from util.log import tdLog
from util.sql import tdSql from util.sql import tdSql
class taosdemoPerformace: class taosdemoPerformace:
def __init__(self, commitID, dbName): def __init__(self, commitID, dbName, branch, type):
self.commitID = commitID self.commitID = commitID
self.dbName = dbName self.dbName = dbName
self.branch = branch
self.type = type
self.host = "127.0.0.1" self.host = "127.0.0.1"
self.user = "root" self.user = "root"
self.password = "taosdata" self.password = "taosdata"
@ -33,6 +35,12 @@ class taosdemoPerformace:
self.password, self.password,
self.config) self.config)
self.insertDB = "insertDB" self.insertDB = "insertDB"
self.host2 = "192.168.1.179"
self.conn2 = taos.connect(
host = self.host2,
user = self.user,
password = self.password,
config = self.config)
def generateJson(self): def generateJson(self):
db = { db = {
@ -122,12 +130,9 @@ class taosdemoPerformace:
return buildPath return buildPath
def insertData(self): def insertData(self):
buildPath = self.getBuildPath() buildPath = self.getBuildPath()
if (buildPath == ""): if (buildPath == ""):
tdLog.exit("taosdemo not found!") tdLog.exit("taosdemo not found!")
else:
tdLog.info("taosdemo found in %s" % buildPath)
binPath = buildPath + "/build/bin/" binPath = buildPath + "/build/bin/"
os.system( os.system(
@ -153,11 +158,11 @@ class taosdemoPerformace:
os.system("[ -f taosdemoperf.txt ] && rm taosdemoperf.txt") os.system("[ -f taosdemoperf.txt ] && rm taosdemoperf.txt")
def createTablesAndStoreData(self): def createTablesAndStoreData(self):
cursor = self.conn.cursor() cursor = self.conn2.cursor()
cursor.execute("create database if not exists %s" % self.dbName) cursor.execute("create database if not exists %s" % self.dbName)
cursor.execute("use %s" % self.dbName) cursor.execute("use %s" % self.dbName)
cursor.execute("create table if not exists taosdemo_perf (ts timestamp, create_table_time float, insert_records_time float, records_per_second float, commit_id binary(50), avg_delay float, max_delay float, min_delay float)") cursor.execute("create table if not exists taosdemo_perf (ts timestamp, create_table_time float, insert_records_time float, records_per_second float, commit_id binary(50), avg_delay float, max_delay float, min_delay float, branch binary(50), type binary(20))")
print("==================== taosdemo performance ====================") print("==================== taosdemo performance ====================")
print("create tables time: %f" % float(self.createTableTime)) print("create tables time: %f" % float(self.createTableTime))
print("insert records time: %f" % float(self.insertRecordsTime)) print("insert records time: %f" % float(self.insertRecordsTime))
@ -165,19 +170,14 @@ class taosdemoPerformace:
print("avg delay: %f" % float(self.avgDelay)) print("avg delay: %f" % float(self.avgDelay))
print("max delay: %f" % float(self.maxDelay)) print("max delay: %f" % float(self.maxDelay))
print("min delay: %f" % float(self.minDelay)) print("min delay: %f" % float(self.minDelay))
cursor.execute( cursor.execute("insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f, '%s', '%s')" %
"insert into taosdemo_perf values(now, %f, %f, %f, '%s', %f, %f, %f)" % (float(self.createTableTime), float(self.insertRecordsTime), float(self.recordsPerSecond),
(float( self.commitID, float(self.avgDelay), float(self.maxDelay), float(self.minDelay), self.branch, self.type))
self.createTableTime), float(
self.insertRecordsTime), float(
self.recordsPerSecond), self.commitID, float(
self.avgDelay), float(
self.maxDelay), float(
self.minDelay)))
cursor.execute("drop database if exists %s" % self.insertDB)
cursor.close() cursor.close()
cursor1 = self.conn.cursor()
cursor1.execute("drop database if exists %s" % self.insertDB)
cursor1.close()
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
@ -194,9 +194,22 @@ if __name__ == '__main__':
default='perf', default='perf',
type=str, type=str,
help='Database name to be created (default: perf)') help='Database name to be created (default: perf)')
parser.add_argument(
'-b',
'--git-branch',
action='store',
default='master',
type=str,
help='git branch (default: master)')
parser.add_argument(
'-T',
'--build-type',
action='store',
default='glibc',
type=str,
help='build type (default: glibc)')
args = parser.parse_args() args = parser.parse_args()
perftest = taosdemoPerformace(args.commit_id, args.database_name) perftest = taosdemoPerformace(args.commit_id, args.database_name, args.git_branch, args.build_type)
perftest.insertData() perftest.insertData()
perftest.createTablesAndStoreData() perftest.createTablesAndStoreData()

View File

@ -65,7 +65,7 @@ class TDSql:
self.queryResult = None self.queryResult = None
tdLog.info("sql:%s, expect error occured" % (sql)) tdLog.info("sql:%s, expect error occured" % (sql))
def query(self, sql): def query(self, sql, row_tag=None):
self.sql = sql self.sql = sql
try: try:
self.cursor.execute(sql) self.cursor.execute(sql)
@ -77,21 +77,27 @@ class TDSql:
args = (caller.filename, caller.lineno, sql, repr(e)) args = (caller.filename, caller.lineno, sql, repr(e))
tdLog.notice("%s(%d) failed: sql:%s, %s" % args) tdLog.notice("%s(%d) failed: sql:%s, %s" % args)
raise Exception(repr(e)) raise Exception(repr(e))
if row_tag:
return self.queryResult
return self.queryRows return self.queryRows
def getColNameList(self, sql): def getColNameList(self, sql, col_tag=None):
self.sql = sql self.sql = sql
try: try:
col_name_list = [] col_name_list = []
col_type_list = []
self.cursor.execute(sql) self.cursor.execute(sql)
self.queryCols = self.cursor.description self.queryCols = self.cursor.description
for query_col in self.queryCols: for query_col in self.queryCols:
col_name_list.append(query_col[0]) col_name_list.append(query_col[0])
col_type_list.append(query_col[1])
except Exception as e: except Exception as e:
caller = inspect.getframeinfo(inspect.stack()[1][0]) caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, sql, repr(e)) args = (caller.filename, caller.lineno, sql, repr(e))
tdLog.notice("%s(%d) failed: sql:%s, %s" % args) tdLog.notice("%s(%d) failed: sql:%s, %s" % args)
raise Exception(repr(e)) raise Exception(repr(e))
if col_tag:
return col_name_list, col_type_list
return col_name_list return col_name_list
def waitedQuery(self, sql, expectRows, timeout): def waitedQuery(self, sql, expectRows, timeout):
@ -245,6 +251,22 @@ class TDSql:
args = (caller.filename, caller.lineno, self.sql, col_name_list, expect_col_name_list) args = (caller.filename, caller.lineno, self.sql, col_name_list, expect_col_name_list)
tdLog.exit("%s(%d) failed: sql:%s, col_name_list:%s != expect_col_name_list:%s" % args) tdLog.exit("%s(%d) failed: sql:%s, col_name_list:%s != expect_col_name_list:%s" % args)
def checkEqual(self, elm, expect_elm):
if elm == expect_elm:
tdLog.info("sql:%s, elm:%s == expect_elm:%s" % (self.sql, elm, expect_elm))
else:
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, self.sql, elm, expect_elm)
tdLog.exit("%s(%d) failed: sql:%s, elm:%s != expect_elm:%s" % args)
def checkNotEqual(self, elm, expect_elm):
if elm != expect_elm:
tdLog.info("sql:%s, elm:%s != expect_elm:%s" % (self.sql, elm, expect_elm))
else:
caller = inspect.getframeinfo(inspect.stack()[1][0])
args = (caller.filename, caller.lineno, self.sql, elm, expect_elm)
tdLog.exit("%s(%d) failed: sql:%s, elm:%s == expect_elm:%s" % args)
def taosdStatus(self, state): def taosdStatus(self, state):
tdLog.sleep(5) tdLog.sleep(5)
pstate = 0 pstate = 0

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0, 0 ) sql insert into $tb values (1626739200000 + $ms , 0, 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1, 1 ) sql insert into $tb values (1626739200000 + $ms , 1, 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -116,103 +116,104 @@ if $rows != 100 then
endi endi
print =============== step4 print =============== step4
sql select * from $mt where ts > now + 4m and tbcol = 1 # sql select * from $mt where ts > 1626739440001 and tbcol = 1
sql select * from $mt where ts > 1626739440001 and tbcol = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 1 sql select * from $mt where ts > 1626739440001 and tbcol <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol = 0 sql select * from $mt where ts < 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol <> 0 sql select * from $mt where ts < 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m sql select * from $mt where ts >= 1626739440001 and tbcol <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step5 print =============== step5
sql select * from $mt where ts > now + 4m and tbcol2 = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m sql select * from $mt where ts >= 1626739440001 and tbcol2 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step6 print =============== step6
sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol <> 0 sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol <> 0 sql select * from $mt where ts >= 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -246,7 +247,7 @@ if $data00 != 100 then
endi endi
print =============== step9 print =============== step9
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts <= 1626739440001
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 50 then if $data00 != 50 then
return -1 return -1
@ -272,7 +273,7 @@ if $data00 != 100 then
endi endi
print =============== step11 print =============== step11
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts <= 1626739440001 and tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0, 0, 0 ) sql insert into $tb values (1626739200000 + $ms , 0, 0, 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1, 1, 1 ) sql insert into $tb values (1626739200000 + $ms , 1, 1, 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -53,19 +53,19 @@ if $rows != $totalNum then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m sql select * from $mt where ts <= 1626739440001
if $rows != 50 then if $rows != 50 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m sql select * from $mt where ts > 1626739440001
if $rows != 150 then if $rows != 150 then
return -1 return -1
endi endi
sql select * from $mt where ts = now + 4m sql select * from $mt where ts = 1626739440001
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001
if $rows != 10 then if $rows != 10 then
return -1 return -1
endi endi
@ -141,239 +141,239 @@ if $rows != 100 then
endi endi
print =============== step6 print =============== step6
sql select * from $mt where ts > now + 4m and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m sql select * from $mt where ts >= 1626739440001 and tbcol1 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step7 print =============== step7
sql select * from $mt where ts > now + 4m and tbcol2 = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m sql select * from $mt where ts >= 1626739440001 and tbcol2 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step8 print =============== step8
sql select * from $mt where ts > now + 4m and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m sql select * from $mt where ts >= 1626739440001 and tbcol3 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step9 print =============== step9
sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step10 print =============== step10
sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step11 print =============== step11
sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol2 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol2 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 sql select * from $mt where ts >= 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step12 print =============== step12
sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts >= 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts >= 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -405,25 +405,25 @@ if $data00 != 100 then
endi endi
print =============== step15 print =============== step15
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts <= 1626739440001
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 50 then if $data00 != 50 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
@ -468,25 +468,25 @@ if $data00 != 100 then
endi endi
print =============== step18 print =============== step18
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0, 0, 0, 0 ) sql insert into $tb values (1626739200000 + $ms , 0, 0, 0, 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1, 1, 1, 1 ) sql insert into $tb values (1626739200000 + $ms , 1, 1, 1, 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -53,19 +53,19 @@ if $rows != $totalNum then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m sql select * from $mt where ts < 1626739440001
if $rows != 50 then if $rows != 50 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m sql select * from $mt where ts > 1626739440001
if $rows != 150 then if $rows != 150 then
return -1 return -1
endi endi
sql select * from $mt where ts = now + 4m sql select * from $mt where ts = 1626739440001
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m sql select * from $mt where ts > 1626739440001 and ts < 1626739500001
if $rows != 10 then if $rows != 10 then
return -1 return -1
endi endi
@ -159,375 +159,375 @@ if $rows != 100 then
endi endi
print =============== step7 print =============== step7
sql select * from $mt where ts > now + 4m and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step8 print =============== step8
sql select * from $mt where ts > now + 4m and tbcol2 = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 sql select * from $mt where ts < 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step9 print =============== step9
sql select * from $mt where ts > now + 4m and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step10 print =============== step10
sql select * from $mt where ts > now + 4m and tbcol4 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step11 print =============== step11
sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step12 print =============== step12
sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step13 print =============== step13
sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol2 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol2 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step14 print =============== step14
sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol4 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol4 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step15 print =============== step15
sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step16 print =============== step16
sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step17 print =============== step17
sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -565,31 +565,31 @@ if $data00 != 100 then
endi endi
print =============== step20 print =============== step20
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 50 then if $data00 != 50 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
@ -646,31 +646,31 @@ if $data00 != 100 then
endi endi
print =============== step23 print =============== step23
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0, 0, 0, 0, 0 ) sql insert into $tb values (1626739200000 + $ms , 0, 0, 0, 0, 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1, 1, 1, 1, 1 ) sql insert into $tb values (1626739200000 + $ms , 1, 1, 1, 1, 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -53,19 +53,19 @@ if $rows != $totalNum then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m sql select * from $mt where ts < 1626739440001
if $rows != 50 then if $rows != 50 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m sql select * from $mt where ts > 1626739440001
if $rows != 150 then if $rows != 150 then
return -1 return -1
endi endi
sql select * from $mt where ts = now + 4m sql select * from $mt where ts = 1626739440001
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m sql select * from $mt where ts > 1626739440001 and ts < 1626739500001
if $rows != 10 then if $rows != 10 then
return -1 return -1
endi endi
@ -177,443 +177,443 @@ if $rows != 100 then
endi endi
print =============== step8 print =============== step8
sql select * from $mt where ts > now + 4m and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step9 print =============== step9
sql select * from $mt where ts > now + 4m and tbcol2 = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 sql select * from $mt where ts < 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step10 print =============== step10
sql select * from $mt where ts > now + 4m and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step11 print =============== step11
sql select * from $mt where ts > now + 4m and tbcol4 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step12 print =============== step12
sql select * from $mt where ts > now + 4m and tbcol5 = 1 sql select * from $mt where ts > 1626739440001 and tbcol5 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 = 0 sql select * from $mt where ts < 1626739440001 and tbcol5 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step13 print =============== step13
sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step14 print =============== step14
sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol2 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol2 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step15 print =============== step15
sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol4 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol4 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step16 print =============== step16
sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol4 = 1 sql select * from $mt where ts > 1626739440001 and tbcol5 = 1 and tbcol4 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol4 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1 and tbcol4 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol4 = 0 sql select * from $mt where ts < 1626739440001 and tbcol5 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol4 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol4 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol4 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step17 print =============== step17
sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step18 print =============== step18
sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step19 print =============== step19
sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step20 print =============== step20
sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -657,37 +657,37 @@ if $data00 != 100 then
endi endi
print =============== step23 print =============== step23
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 50 then if $data00 != 50 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
@ -756,37 +756,37 @@ if $data00 != 100 then
endi endi
print =============== step26 print =============== step26
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0, 0, 0, 0, 0, 0 ) sql insert into $tb values (1626739200000 + $ms , 0, 0, 0, 0, 0, 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1, 1, 1, 1, 1, 1 ) sql insert into $tb values (1626739200000 + $ms , 1, 1, 1, 1, 1, 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -53,19 +53,19 @@ if $rows != $totalNum then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m sql select * from $mt where ts < 1626739440001
if $rows != 50 then if $rows != 50 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m sql select * from $mt where ts > 1626739440001
if $rows != 150 then if $rows != 150 then
return -1 return -1
endi endi
sql select * from $mt where ts = now + 4m sql select * from $mt where ts = 1626739440001
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m sql select * from $mt where ts > 1626739440001 and ts < 1626739500001
if $rows != 10 then if $rows != 10 then
return -1 return -1
endi endi
@ -195,545 +195,545 @@ if $rows != 100 then
endi endi
print =============== step9 print =============== step9
sql select * from $mt where ts > now + 4m and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step10 print =============== step10
sql select * from $mt where ts > now + 4m and tbcol2 = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 sql select * from $mt where ts < 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step11 print =============== step11
sql select * from $mt where ts > now + 4m and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step12 print =============== step12
sql select * from $mt where ts > now + 4m and tbcol4 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step13 print =============== step13
sql select * from $mt where ts > now + 4m and tbcol5 = 1 sql select * from $mt where ts > 1626739440001 and tbcol5 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 = 0 sql select * from $mt where ts < 1626739440001 and tbcol5 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step14 print =============== step14
sql select * from $mt where ts > now + 4m and tbcol6 = 1 sql select * from $mt where ts > 1626739440001 and tbcol6 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol6 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol6 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol6 = 0 sql select * from $mt where ts < 1626739440001 and tbcol6 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol6 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol6 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol6 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol6 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol6 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol6 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol6 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol6 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol6 <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol6 <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step15 print =============== step15
sql select * from $mt where ts > now + 4m and tbcol2 = 1 and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol2 = 1 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 1 and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 1 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 = 0 and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol2 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 = 0 and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol2 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol2 <> 0 and ts < now + 5m and ts < now + 5m and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol2 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step16 print =============== step16
sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol2 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol2 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol2 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol2 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol2 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol2 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol2 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol2 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step17 print =============== step17
sql select * from $mt where ts > now + 4m and tbcol3 = 1 and tbcol4 = 1 sql select * from $mt where ts > 1626739440001 and tbcol3 = 1 and tbcol4 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 1 and tbcol4 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 1 and tbcol4 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 = 0 and tbcol4 = 0 sql select * from $mt where ts < 1626739440001 and tbcol3 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol3 <> 0 and tbcol4 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 = 0 and tbcol4 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol3 <> 0 and tbcol4 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol3 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol3 <> 0 and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol3 <> 0 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol3 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol3 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step18 print =============== step18
sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol4 = 1 sql select * from $mt where ts > 1626739440001 and tbcol5 = 1 and tbcol4 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol4 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1 and tbcol4 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol4 = 0 sql select * from $mt where ts < 1626739440001 and tbcol5 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol4 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol4 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0 and tbcol4 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol4 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0 and tbcol4 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol4 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol4 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step19 print =============== step19
sql select * from $mt where ts > now + 4m and tbcol5 = 1 and tbcol6 = 1 sql select * from $mt where ts > 1626739440001 and tbcol5 = 1 and tbcol6 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 1 and tbcol6 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol5 <> 1 and tbcol6 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 = 0 and tbcol6 = 0 sql select * from $mt where ts < 1626739440001 and tbcol5 = 0 and tbcol6 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol5 <> 0 and tbcol6 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol5 <> 0 and tbcol6 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 = 0 and tbcol6 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 = 0 and tbcol6 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol5 <> 0 and tbcol6 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol5 <> 0 and tbcol6 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol5 <> 0 and tbcol6 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol5 <> 0 and tbcol6 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol5 <> 0 and ts < now + 5m and ts < now + 5m and tbcol6 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol5 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol6 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step20 print =============== step20
sql select * from $mt where ts > now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 1 and tbcol2 <> 1 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol1 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol1 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol1 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step21 print =============== step21
sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step22 print =============== step22
sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step23 print =============== step23
sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
print =============== step24 print =============== step24
sql select * from $mt where ts > now + 4m and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 and tbcol6 = 1 sql select * from $mt where ts > 1626739440001 and tbcol4 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol1 = 1 and tbcol5 = 1 and tbcol6 = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 and tbcol6 <> 1 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 1 and tbcol2 <> 1 and tbcol3 <> 1 and tbcol1 <> 1 and tbcol5 <> 1 and tbcol6 <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 sql select * from $mt where ts < 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 sql select * from $mt where ts < 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 = 0 and tbcol2 = 0 and tbcol3 = 0 and tbcol1 = 0 and tbcol5 = 0 and tbcol6 = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol4 <> 0 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol4 <> 0 and ts < now + 5m and ts < now + 5m and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0 sql select * from $mt where ts > 1626739440001 and tbcol4 <> 0 and ts < 1626739500001 and ts < 1626739500001 and tbcol2 <> 0 and tbcol3 <> 0 and tbcol1 <> 0 and tbcol5 <> 0 and tbcol6 <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -783,43 +783,43 @@ if $data00 != 100 then
endi endi
print =============== step27 print =============== step27
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 50 then if $data00 != 50 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
@ -900,43 +900,43 @@ if $data00 != 100 then
endi endi
print =============== step30 print =============== step30
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1
endi endi
sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < now + 4m and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 group by tgcol2 sql select count(tbcol1), avg(tbcol1), sum(tbcol1), min(tbcol1), max(tbcol1), first(tbcol1), last(tbcol1) from $mt where ts < 1626739440001 and tbcol1 = 1 and tbcol2 = 1 and tbcol3 = 1 and tbcol4 = 1 and tbcol5 = 1 and tbcol6 = 1 group by tgcol2
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0 ) sql insert into $tb values (1626739200000 + $ms , 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1 ) sql insert into $tb values (1626739200000 + $ms , 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -82,35 +82,35 @@ if $rows != 100 then
endi endi
print =============== step3 print =============== step3
sql select * from $mt where ts > now + 4m and tbcol = 1 sql select * from $mt where ts > 1626739440001 and tbcol = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 1 sql select * from $mt where ts > 1626739440001 and tbcol <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol = 0 sql select * from $mt where ts < 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol <> 0 sql select * from $mt where ts < 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -139,7 +139,7 @@ if $data00 != 100 then
endi endi
print =============== step7 print =============== step7
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , '0' ) sql insert into $tb values (1626739200000 + $ms , '0' )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , '1' ) sql insert into $tb values (1626739200000 + $ms , '1' )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -55,14 +55,14 @@ if $rows != 100 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol = '1' sql select * from $mt where ts > 1626739440001 and tbcol = '1'
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' print select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1'
sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' group by tgcol sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' group by tgcol
sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = '1' group by tgcol sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = '1' group by tgcol
sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' interval(1d) group by tgcol sql_error select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where tbcol = '1' interval(1d) group by tgcol
#can't filter binary fields #can't filter binary fields

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0 ) sql insert into $tb values (1626739200000 + $ms , 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1 ) sql insert into $tb values (1626739200000 + $ms , 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -82,35 +82,35 @@ if $rows != 100 then
endi endi
print =============== step3 print =============== step3
sql select * from $mt where ts > now + 4m and tbcol = true sql select * from $mt where ts > 1626739440001 and tbcol = true
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> true sql select * from $mt where ts > 1626739440001 and tbcol <> true
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol = false sql select * from $mt where ts < 1626739440001 and tbcol = false
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol <> false sql select * from $mt where ts < 1626739440001 and tbcol <> false
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol = false sql select * from $mt where ts <= 1626739440001 and tbcol = false
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol <> false sql select * from $mt where ts <= 1626739440001 and tbcol <> false
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> false sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> false
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> false and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol <> false and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -137,7 +137,7 @@ if $data00 != 100 then
endi endi
print =============== step7 print =============== step7
sql select count(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = true group by tgcol sql select count(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = true group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0 ) sql insert into $tb values (1626739200000 + $ms , 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1 ) sql insert into $tb values (1626739200000 + $ms , 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -82,35 +82,35 @@ if $rows != 100 then
endi endi
print =============== step3 print =============== step3
sql select * from $mt where ts > now + 4m and tbcol = 1 sql select * from $mt where ts > 1626739440001 and tbcol = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 1 sql select * from $mt where ts > 1626739440001 and tbcol <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol = 0 sql select * from $mt where ts < 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol <> 0 sql select * from $mt where ts < 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -137,7 +137,7 @@ if $data00 != 100 then
endi endi
print =============== step7 print =============== step7
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0 ) sql insert into $tb values (1626739200000 + $ms , 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1 ) sql insert into $tb values (1626739200000 + $ms , 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -82,35 +82,35 @@ if $rows != 100 then
endi endi
print =============== step3 print =============== step3
sql select * from $mt where ts > now + 4m and tbcol = 1 sql select * from $mt where ts > 1626739440001 and tbcol = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 1 sql select * from $mt where ts > 1626739440001 and tbcol <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol = 0 sql select * from $mt where ts < 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol <> 0 sql select * from $mt where ts < 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -137,7 +137,7 @@ if $data00 != 100 then
endi endi
print =============== step7 print =============== step7
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0 ) sql insert into $tb values (1626739200000 + $ms , 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1 ) sql insert into $tb values (1626739200000 + $ms , 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -82,35 +82,35 @@ if $rows != 100 then
endi endi
print =============== step3 print =============== step3
sql select * from $mt where ts > now + 4m and tbcol = 1 sql select * from $mt where ts > 1626739440001 and tbcol = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 1 sql select * from $mt where ts > 1626739440001 and tbcol <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol = 0 sql select * from $mt where ts < 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol <> 0 sql select * from $mt where ts < 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -137,7 +137,7 @@ if $data00 != 100 then
endi endi
print =============== step7 print =============== step7
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -25,7 +25,7 @@ sql create table $tb (ts timestamp, tbcol int)
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , $x ) sql insert into $tb values (1626739200000 + $ms , $x )
$x = $x + 1 $x = $x + 1
endw endw
@ -111,18 +111,18 @@ if $rows != 0 then
endi endi
print =============== step3 print =============== step3
sql select * from $tb where ts < now + 4m sql select * from $tb where ts < 1626739440001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $tb where tbcol = 10 and ts < now + 4m sql select * from $tb where tbcol = 10 and ts < 1626739440001
print select * from $tb where tbcol = 10 and ts < now + 4m print select * from $tb where tbcol = 10 and ts < 1626739440001
if $rows != 0 then if $rows != 0 then
return -1 return -1
endi endi
sql select * from $tb where tbcol = 4 and ts < now + 4m order by ts desc sql select * from $tb where tbcol = 4 and ts < 1626739440001 order by ts desc
if $rows != 1 then if $rows != 1 then
return -1 return -1
endi endi
@ -130,7 +130,7 @@ if $data01 != 4 then
return -1 return -1
endi endi
sql select * from $tb where tbcol < 10 and ts < now + 4m order by ts desc sql select * from $tb where tbcol < 10 and ts < 1626739440001 order by ts desc
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -138,7 +138,7 @@ if $data01 != 4 then
return -1 return -1
endi endi
sql select * from $tb where tbcol < 10 and ts > now + 4m and ts < now + 5m order by ts desc sql select * from $tb where tbcol < 10 and ts > 1626739440001 and ts < 1626739500001 order by ts desc
print $rows $data00 $data01 print $rows $data00 $data01
if $rows != 1 then if $rows != 1 then
return -1 return -1
@ -183,27 +183,27 @@ sql select count(*) from $tb where tbcol < 10 and tbcol > 5 order by ts asc -x s
step4: step4:
print =============== step5 print =============== step5
sql select count(*) from $tb where ts < now + 4m sql select count(*) from $tb where ts < 1626739440001
if $data00 != 5 then if $data00 != 5 then
return -1 return -1
endi endi
#sql select count(*) from $tb where tbcol = 10 and ts < now + 4m #sql select count(*) from $tb where tbcol = 10 and ts < 1626739440001
#if $data00 != 0 then #if $data00 != 0 then
# return -1 # return -1
#endi #endi
sql select count(*) from $tb where tbcol = 4 and ts < now + 4m sql select count(*) from $tb where tbcol = 4 and ts < 1626739440001
if $data00 != 1 then if $data00 != 1 then
return -1 return -1
endi endi
sql select count(*) from $tb where tbcol < 10 and ts < now + 4m sql select count(*) from $tb where tbcol < 10 and ts < 1626739440001
if $data00 != 5 then if $data00 != 5 then
return -1 return -1
endi endi
sql select count(*) from $tb where tbcol < 10 and ts > now + 4m and ts < now + 5m sql select count(*) from $tb where tbcol < 10 and ts > 1626739440001 and ts < 1626739500001
if $data00 != 1 then if $data00 != 1 then
return -1 return -1
endi endi

View File

@ -30,7 +30,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0 ) sql insert into $tb values (1626739200000 + $ms , 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -41,7 +41,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1 ) sql insert into $tb values (1626739200000 + $ms , 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -82,35 +82,35 @@ if $rows != 100 then
endi endi
print =============== step3 print =============== step3
sql select * from $mt where ts > now + 4m and tbcol = 1 sql select * from $mt where ts > 1626739440001 and tbcol = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 1 sql select * from $mt where ts > 1626739440001 and tbcol <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol = 0 sql select * from $mt where ts < 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol <> 0 sql select * from $mt where ts < 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -137,7 +137,7 @@ if $data00 != 100 then
endi endi
print =============== step7 print =============== step7
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -31,7 +31,7 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0 ) sql insert into $tb values (1626739200000 + $ms , 0 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -42,7 +42,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1 ) sql insert into $tb values (1626739200000 + $ms , 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -83,35 +83,35 @@ if $rows != 100 then
endi endi
print =============== step3 print =============== step3
sql select * from $mt where ts > now + 4m and tbcol = 1 sql select * from $mt where ts > 1626739440001 and tbcol = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 1 sql select * from $mt where ts > 1626739440001 and tbcol <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol = 0 sql select * from $mt where ts < 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol <> 0 sql select * from $mt where ts < 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -138,7 +138,7 @@ if $data00 != 100 then
endi endi
print =============== step7 print =============== step7
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -31,11 +31,11 @@ while $i < 5
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 0 ) sql insert into $tb values (1626739200000 + $ms , 0 )
$x = $x + 1 $x = $x + 1
sql_error insert into $tb values (now + $ms , -10) sql_error insert into $tb values (1626739200000 + $ms , -10)
sql_error insert into $tb values (now + $ms , -1000) sql_error insert into $tb values (1626739200000 + $ms , -1000)
sql_error insert into $tb values (now + $ms , -10000000) sql_error insert into $tb values (1626739200000 + $ms , -10000000)
endw endw
$i = $i + 1 $i = $i + 1
endw endw
@ -45,7 +45,7 @@ while $i < 10
$x = 0 $x = 0
while $x < $rowNum while $x < $rowNum
$ms = $x . m $ms = $x . m
sql insert into $tb values (now + $ms , 1 ) sql insert into $tb values (1626739200000 + $ms , 1 )
$x = $x + 1 $x = $x + 1
endw endw
$i = $i + 1 $i = $i + 1
@ -86,35 +86,35 @@ if $rows != 100 then
endi endi
print =============== step3 print =============== step3
sql select * from $mt where ts > now + 4m and tbcol = 1 sql select * from $mt where ts > 1626739440001 and tbcol = 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 1 sql select * from $mt where ts > 1626739440001 and tbcol <> 1
if $rows != 75 then if $rows != 75 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol = 0 sql select * from $mt where ts < 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts < now + 4m and tbcol <> 0 sql select * from $mt where ts < 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol = 0 sql select * from $mt where ts <= 1626739440001 and tbcol = 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts <= now + 4m and tbcol <> 0 sql select * from $mt where ts <= 1626739440001 and tbcol <> 0
if $rows != 25 then if $rows != 25 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and ts < now + 5m and tbcol <> 0 sql select * from $mt where ts > 1626739440001 and ts < 1626739500001 and tbcol <> 0
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
sql select * from $mt where ts > now + 4m and tbcol <> 0 and ts < now + 5m sql select * from $mt where ts > 1626739440001 and tbcol <> 0 and ts < 1626739500001
if $rows != 5 then if $rows != 5 then
return -1 return -1
endi endi
@ -143,7 +143,7 @@ if $data00 != 100 then
endi endi
print =============== step7 print =============== step7
sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < now + 4m and tbcol = 1 group by tgcol sql select count(tbcol), avg(tbcol), sum(tbcol), min(tbcol), max(tbcol), first(tbcol), last(tbcol) from $mt where ts < 1626739440001 and tbcol = 1 group by tgcol
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 print $data00 $data01 $data02 $data03 $data04 $data05 $data06
if $data00 != 25 then if $data00 != 25 then
return -1 return -1

View File

@ -35,6 +35,9 @@ sql alter table tb1 set tag name = ""
sql alter table tb1 set tag name = "shenzhen" sql alter table tb1 set tag name = "shenzhen"
sql alter table tb1 set tag len = 379 sql alter table tb1 set tag len = 379
# case TD-5594
sql create stable st5520(ts timestamp, f int) tags(t0 bool, t1 nchar(4093), t2 nchar(1))
sql_error alter stable st5520 modify tag t2 nchar(2);
# test end # test end
sql drop database $db sql drop database $db

Some files were not shown because too many files have changed in this diff Show More