diff --git a/alert/release.sh b/alert/release.sh
index 35eb4d677f..20317e4166 100755
--- a/alert/release.sh
+++ b/alert/release.sh
@@ -7,8 +7,9 @@ set -e
cpuType=amd64 # [armv6l | arm64 | amd64 | 386]
osType=linux # [linux | darwin | windows]
version=""
+verType=stable # [stable, beta]
declare -A archMap=(["armv6l"]="arm" ["arm64"]="arm64" ["amd64"]="x64" ["386"]="x86")
-while getopts "h:c:o:n:" arg
+while getopts "h:c:o:n:V:" arg
do
case $arg in
c)
@@ -23,6 +24,10 @@ do
#echo "version=$OPTARG"
version=$(echo $OPTARG)
;;
+ V)
+ #echo "verType=$OPTARG"
+ verType=$(echo $OPTARG)
+ ;;
h)
echo "Usage: `basename $0` -c [armv6l | arm64 | amd64 | 386] -o [linux | darwin | windows]"
exit 0
@@ -55,6 +60,22 @@ cp alert alert.cfg install_driver.sh ./TDengine-alert/.
cp ../../../debug/build/lib/libtaos.so.${version} ./TDengine-alert/driver/.
chmod 777 ./TDengine-alert/install_driver.sh
-tar -I 'gzip -9' -cf ${startdir}/TDengine-alert-${version}-${osType^}-${archMap[${cpuType}]}.tar.gz TDengine-alert/
+tar -I 'gzip -9' -cf ${scriptdir}/TDengine-alert-${version}-${osType^}-${archMap[${cpuType}]}.tar.gz TDengine-alert/
rm -rf ./TDengine-alert
+
+
+# mv package to comminuty/release/
+pkg_name=TDengine-alert-${version}-${osType^}-${archMap[${cpuType}]}
+
+if [ "$verType" == "beta" ]; then
+ pkg_name=TDengine-alert-${version}-${verType}-${osType^}-${archMap[${cpuType}]}
+elif [ "$verType" == "stable" ]; then
+ pkg_name=${pkg_name}
+else
+ echo "unknow verType, nor stabel or beta"
+ exit 1
+fi
+
+cd ${scriptdir}/../release/
+mv ${scriptdir}/TDengine-alert-${version}-${osType^}-${archMap[${cpuType}]}.tar.gz ${pkg_name}.tar.gz
diff --git a/cmake/version.inc b/cmake/version.inc
index eb0237c301..7c646c67b6 100755
--- a/cmake/version.inc
+++ b/cmake/version.inc
@@ -4,7 +4,7 @@ PROJECT(TDengine)
IF (DEFINED VERNUMBER)
SET(TD_VER_NUMBER ${VERNUMBER})
ELSE ()
- SET(TD_VER_NUMBER "2.1.3.0")
+ SET(TD_VER_NUMBER "2.1.4.1")
ENDIF ()
IF (DEFINED VERCOMPATIBLE)
diff --git a/documentation20/cn/11.administrator/docs.md b/documentation20/cn/11.administrator/docs.md
index 753f91f589..19e4b761ba 100644
--- a/documentation20/cn/11.administrator/docs.md
+++ b/documentation20/cn/11.administrator/docs.md
@@ -123,8 +123,8 @@ taosd -C
- minRows:文件块中记录的最小条数。单位为条,默认值:100。
- maxRows:文件块中记录的最大条数。单位为条,默认值:4096。
- comp:文件压缩标志位。0:关闭;1:一阶段压缩;2:两阶段压缩。默认值:2。(可通过 alter database 修改)
-- wal:WAL级别。1:写wal,但不执行fsync;2:写wal, 而且执行fsync。默认值:1。(在 taos.cfg 中参数名需要写作 walLevel)(可通过 alter database 修改)
-- fsync:当wal设置为2时,执行fsync的周期。设置为0,表示每次写入,立即执行fsync。单位为毫秒,默认值:3000。(可通过 alter database 修改)
+- wal:WAL级别。1:写wal,但不执行fsync;2:写wal, 而且执行fsync。默认值:1。(在 taos.cfg 中参数名需要写作 walLevel)
+- fsync:当wal设置为2时,执行fsync的周期。设置为0,表示每次写入,立即执行fsync。单位为毫秒,默认值:3000。
- cache:内存块的大小。单位为兆字节(MB),默认值:16。
- blocks:每个VNODE(TSDB)中有多少cache大小的内存块。因此一个VNODE的用的内存大小粗略为(cache * blocks)。单位为块,默认值:4。(可通过 alter database 修改)
- replica:副本个数。取值范围:1-3,单位为个,默认值:1。(可通过 alter database 修改)
diff --git a/documentation20/cn/12.taos-sql/docs.md b/documentation20/cn/12.taos-sql/docs.md
index d5cc8675a4..73fa5b34e5 100644
--- a/documentation20/cn/12.taos-sql/docs.md
+++ b/documentation20/cn/12.taos-sql/docs.md
@@ -129,16 +129,6 @@ TDengine 缺省的时间戳是毫秒精度,但通过在 CREATE DATABASE 时传
CACHELAST 参数控制是否在内存中缓存子表的最近数据。缺省值为 0,取值范围 [0, 1, 2, 3]。其中 0 表示不缓存,1 表示缓存子表最近一行数据,2 表示缓存子表每一列的最近的非 NULL 值,3 表示同时打开缓存最近行和列功能。(从 2.0.11.0 版本开始支持参数值 [0, 1],从 2.1.2.0 版本开始支持参数值 [0, 1, 2, 3]。)
说明:缓存最近行,将显著改善 LAST_ROW 函数的性能表现;缓存每列的最近非 NULL 值,将显著改善无特殊影响(WHERE、ORDER BY、GROUP BY、INTERVAL)下的 LAST 函数的性能表现。
- ```mysql
- ALTER DATABASE db_name WAL 1;
- ```
- WAL 参数控制 WAL 日志的落盘方式。缺省值为 1,取值范围为 [1, 2]。1 表示写 WAL,但不执行 fsync;2 表示写 WAL,而且执行 fsync。
-
- ```mysql
- ALTER DATABASE db_name FSYNC 3000;
- ```
- FSYNC 参数控制执行 fsync 操作的周期。缺省值为 3000,单位是毫秒,取值范围为 [0, 180000]。如果设置为 0,表示每次写入,立即执行 fsync。该设置项主要用于调节 WAL 参数设为 2 时的系统行为。
-
**Tips**: 以上所有参数修改后都可以用show databases来确认是否修改成功。另外,从 2.1.3.0 版本开始,修改这些参数后无需重启服务器即可生效。
- **显示系统所有数据库**
@@ -372,77 +362,82 @@ TDengine 缺省的时间戳是毫秒精度,但通过在 CREATE DATABASE 时传
## 数据写入
-- **插入一条记录**
- ```mysql
- INSERT INTO tb_name VALUES (field_value, ...);
- ```
- 向表tb_name中插入一条记录。
+### 写入语法:
-- **插入一条记录,数据对应到指定的列**
- ```mysql
- INSERT INTO tb_name (field1_name, ...) VALUES (field1_value1, ...);
- ```
- 向表tb_name中插入一条记录,数据对应到指定的列。SQL语句中没有出现的列,数据库将自动填充为NULL。主键(时间戳)不能为NULL。
+```mysql
+INSERT INTO
+ tb_name
+ [USING stb_name [(tag1_name, ...)] TAGS (tag1_value, ...)]
+ [(field1_name, ...)]
+ VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path
+ [tb2_name
+ [USING stb_name [(tag1_name, ...)] TAGS (tag1_value, ...)]
+ [(field1_name, ...)]
+ VALUES (field1_value, ...) [(field1_value2, ...) ...] | FILE csv_file_path
+ ...];
+```
-- **插入多条记录**
- ```mysql
- INSERT INTO tb_name VALUES (field1_value1, ...) (field1_value2, ...) ...;
- ```
- 向表tb_name中插入多条记录。
- **注意**:在使用“插入多条记录”方式写入数据时,不能把第一列的时间戳取值都设为now,否则会导致语句中的多条记录使用相同的时间戳,于是就可能出现相互覆盖以致这些数据行无法全部被正确保存。
+### 详细描述及示例:
-- **按指定的列插入多条记录**
+- **插入一条或多条记录**
+ 指定已经创建好的数据子表的表名,并通过 VALUES 关键字提供一行或多行数据,即可向数据库写入这些数据。例如,执行如下语句可以写入一行记录:
```mysql
- INSERT INTO tb_name (field1_name, ...) VALUES (field1_value1, ...) (field1_value2, ...) ...;
+ INSERT INTO d1001 VALUES (NOW, 10.2, 219, 0.32);
```
- 向表tb_name中按指定的列插入多条记录。
+ 或者,可以通过如下语句写入两行记录:
+ ```mysql
+ INSERT INTO d1001 VALUES ('2021-07-13 14:06:32.272', 10.2, 219, 0.32) (1626164208000, 10.15, 217, 0.33);
+ ```
+ **注意:**
+ 1)在第二个例子中,两行记录的首列时间戳使用了不同格式的写法。其中字符串格式的时间戳写法不受所在 DATABASE 的时间精度设置影响;而长整形格式的时间戳写法会受到所在 DATABASE 的时间精度设置影响——例子中的时间戳在毫秒精度下可以写作 1626164208000,而如果是在微秒精度设置下就需要写为 1626164208000000。
+ 2)在使用“插入多条记录”方式写入数据时,不能把第一列的时间戳取值都设为 NOW,否则会导致语句中的多条记录使用相同的时间戳,于是就可能出现相互覆盖以致这些数据行无法全部被正确保存。其原因在于,NOW 函数在执行中会被解析为所在 SQL 语句的实际执行时间,出现在同一语句中的多个 NOW 标记也就会被替换为完全相同的时间戳取值。
+ 3)允许插入的最老记录的时间戳,是相对于当前服务器时间,减去配置的 keep 值(数据保留的天数);允许插入的最新记录的时间戳,是相对于当前服务器时间,加上配置的 days 值(数据文件存储数据的时间跨度,单位为天)。keep 和 days 都是可以在创建数据库时指定的,缺省值分别是 3650 天和 10 天。
-- **向多个表插入多条记录**
+- **插入记录,数据对应到指定的列**
+ 向数据子表中插入记录时,无论插入一行还是多行,都可以让数据对应到指定的列。对于 SQL 语句中没有出现的列,数据库将自动填充为 NULL。主键(时间戳)不能为 NULL。例如:
```mysql
- INSERT INTO tb1_name VALUES (field1_value1, ...) (field1_value2, ...) ...
- tb2_name VALUES (field1_value1, ...) (field1_value2, ...) ...;
+ INSERT INTO d1001 (ts, current, phase) VALUES ('2021-07-13 14:06:33.196', 10.27, 0.31);
```
- 同时向表tb1_name和tb2_name中分别插入多条记录。
+ **说明:**如果不指定列,也即使用全列模式——那么在 VALUES 部分提供的数据,必须为数据表的每个列都显式地提供数据。全列模式写入速度会远快于指定列,因此建议尽可能采用全列写入方式,此时空列可以填入 NULL。
-- **同时向多个表按列插入多条记录**
+- **向多个表插入记录**
+ 可以在一条语句中,分别向多个表插入一条或多条记录,并且也可以在插入过程中指定列。例如:
```mysql
- INSERT INTO tb1_name (tb1_field1_name, ...) VALUES (field1_value1, ...) (field1_value2, ...) ...
- tb2_name (tb2_field1_name, ...) VALUES (field1_value1, ...) (field1_value2, ...) ...;
+ INSERT INTO d1001 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)
+ d1002 (ts, current, phase) VALUES ('2021-07-13 14:06:34.255', 10.27, 0.31);
```
- 同时向表tb1_name和tb2_name中按列分别插入多条记录。
- 注意:
- 1) 如果时间戳为now,系统将自动使用客户端当前时间作为该记录的时间戳;
- 2) 允许插入的最老记录的时间戳,是相对于当前服务器时间,减去配置的keep值(数据保留的天数),允许插入的最新记录的时间戳,是相对于当前服务器时间,加上配置的days值(数据文件存储数据的时间跨度,单位为天)。keep和days都是可以在创建数据库时指定的,缺省值分别是3650天和10天。
+- **插入记录时自动建表**
+ 如果用户在写数据时并不确定某个表是否存在,此时可以在写入数据时使用自动建表语法来创建不存在的表,若该表已存在则不会建立新表。自动建表时,要求必须以超级表为模板,并写明数据表的 TAGS 取值。例如:
+ ```mysql
+ INSERT INTO d21001 USING meters TAGS ('Beijing.Chaoyang', 2) VALUES ('2021-07-13 14:06:32.272', 10.2, 219, 0.32);
+ ```
+ 也可以在自动建表时,只是指定部分 TAGS 列的取值,未被指定的 TAGS 列将置为 NULL。例如:
+ ```mysql
+ INSERT INTO d21001 USING meters (groupdId) TAGS (2) VALUES ('2021-07-13 14:06:33.196', 10.15, 217, 0.33);
+ ```
+ 自动建表语法也支持在一条语句中向多个表插入记录。例如:
+ ```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)
+ d21002 USING meters (groupdId) 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);
+ ```
+ **说明:**在 2.0.20.5 版本之前,在使用自动建表语法并指定列时,子表的列名必须紧跟在子表名称后面,而不能如例子里那样放在 TAGS 和 VALUES 之间。从 2.0.20.5 版本开始,两种写法都可以,但不能在一条 SQL 语句中混用,否则会报语法错误。
-- **插入记录时自动建表**
- ```mysql
- INSERT INTO tb_name USING stb_name TAGS (tag_value1, ...) VALUES (field_value1, ...);
+- **插入来自文件的数据记录**
+ 除了使用 VALUES 关键字插入一行或多行数据外,也可以把要写入的数据放在 CSV 文件中(英文逗号分隔、英文单引号括住每个值)供 SQL 指令读取。其中 CSV 文件无需表头。例如,如果 /tmp/csvfile.csv 文件的内容为:
```
- 如果用户在写数据时并不确定某个表是否存在,此时可以在写入数据时使用自动建表语法来创建不存在的表,若该表已存在则不会建立新表。自动建表时,要求必须以超级表为模板,并写明数据表的 TAGS 取值。
-
-- **插入记录时自动建表,并指定具体的 TAGS 列**
- ```mysql
- INSERT INTO tb_name USING stb_name (tag_name1, ...) TAGS (tag_value1, ...) VALUES (field_value1, ...);
+ '2021-07-13 14:07:34.630', '10.2', '219', '0.32'
+ '2021-07-13 14:07:35.779', '10.15', '217', '0.33'
```
- 在自动建表时,可以只是指定部分 TAGS 列的取值,未被指定的 TAGS 列将取为空值。
-
-- **同时向多个表按列插入多条记录,自动建表**
+ 那么通过如下指令可以把这个文件中的数据写入子表中:
```mysql
- INSERT INTO tb1_name (tb1_field1_name, ...) [USING stb1_name TAGS (tag_value1, ...)] VALUES (field1_value1, ...) (field1_value2, ...) ...
- tb2_name (tb2_field1_name, ...) [USING stb2_name TAGS (tag_value2, ...)] VALUES (field1_value1, ...) (field1_value2, ...) ...;
+ INSERT INTO d1001 FILE '/tmp/csvfile.csv';
```
- 以自动建表的方式,同时向表tb1_name和tb2_name中按列分别插入多条记录。
- 说明:`(tb1_field1_name, ...)`的部分可以省略掉,这样就是使用全列模式写入——也即在 VALUES 部分提供的数据,必须为数据表的每个列都显式地提供数据。全列写入速度会远快于指定列,因此建议尽可能采用全列写入方式,此时空列可以填入NULL。
- 从 2.0.20.5 版本开始,子表的列名可以不跟在子表名称后面,而是可以放在 TAGS 和 VALUES 之间,例如像下面这样写:
- ```mysql
- INSERT INTO tb1_name [USING stb1_name TAGS (tag_value1, ...)] (tb1_field1_name, ...) VALUES (field1_value1, ...) (field1_value2, ...) ...;
- ```
- 注意:虽然两种写法都可以,但并不能在一条 SQL 语句中混用,否则会报语法错误。
**历史记录写入**:可使用IMPORT或者INSERT命令,IMPORT的语法,功能与INSERT完全一样。
-说明:针对 insert 类型的 SQL 语句,我们采用的流式解析策略,在发现后面的错误之前,前面正确的部分SQL仍会执行。下面的sql中,insert语句是无效的,但是d1001仍会被创建。
+**说明:**针对 insert 类型的 SQL 语句,我们采用的流式解析策略,在发现后面的错误之前,前面正确的部分 SQL 仍会执行。下面的 SQL 中,INSERT 语句是无效的,但是 d1001 仍会被创建。
```mysql
taos> CREATE TABLE meters(ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS(location BINARY(30), groupId INT);
@@ -1342,6 +1337,7 @@ SELECT function_list FROM stb_name
- 在聚合查询中,function_list 位置允许使用聚合和选择函数,并要求每个函数仅输出单个结果(例如:COUNT、AVG、SUM、STDDEV、LEASTSQUARES、PERCENTILE、MIN、MAX、FIRST、LAST),而不能使用具有多行输出结果的函数(例如:TOP、BOTTOM、DIFF 以及四则运算)。
- 查询过滤、聚合等操作按照每个切分窗口为独立的单位执行。聚合查询目前支持三种窗口的划分方式:
1. 时间窗口:聚合时间段的窗口宽度由关键词 INTERVAL 指定,最短时间间隔 10 毫秒(10a);并且支持偏移 offset(偏移必须小于间隔),也即时间窗口划分与“UTC 时刻 0”相比的偏移量。SLIDING 语句用于指定聚合时间段的前向增量,也即每次窗口向前滑动的时长。当 SLIDING 与 INTERVAL 取值相等的时候,滑动窗口即为翻转窗口。
+ * 从 2.1.5.0 版本开始,INTERVAL 语句允许的最短时间间隔调整为 1 微秒(1u),当然如果所查询的 DATABASE 的时间精度设置为毫秒级,那么允许的最短时间间隔为 1 毫秒(1a)。
2. 状态窗口:使用整数(布尔值)或字符串来标识产生记录时设备的状态量,产生的记录如果具有相同的状态量取值则归属于同一个状态窗口,数值改变后该窗口关闭。状态量所对应的列作为 STATE_WINDOW 语句的参数来指定。
3. 会话窗口:时间戳所在的列由 SESSION 语句的 ts_col 参数指定,会话窗口根据相邻两条记录的时间戳差值来确定是否属于同一个会话——如果时间戳差异在 tol_val 以内,则认为记录仍属于同一个窗口;如果时间变化超过 tol_val,则自动开启下一个窗口。
- WHERE 语句可以指定查询的起止时间和其他过滤条件。
diff --git a/packaging/cfg/taos.cfg b/packaging/cfg/taos.cfg
index 9ad06cd1bd..bbe6eae419 100644
--- a/packaging/cfg/taos.cfg
+++ b/packaging/cfg/taos.cfg
@@ -149,6 +149,8 @@ keepColumnName 1
# system time zone
# timezone Asia/Shanghai (CST, +0800)
+# system time zone (for windows 10)
+# timezone UTC-8
# system locale
# locale en_US.UTF-8
diff --git a/packaging/deb/makedeb.sh b/packaging/deb/makedeb.sh
index e6ddb6d742..a169bf2ba0 100755
--- a/packaging/deb/makedeb.sh
+++ b/packaging/deb/makedeb.sh
@@ -123,7 +123,7 @@ else
fi
if [ "$verType" == "beta" ]; then
- debname=${debname}-${verType}".deb"
+ debname="TDengine-server-"${tdengine_ver}-${verType}-${osType}-${cpuType}".deb"
elif [ "$verType" == "stable" ]; then
debname=${debname}".deb"
else
@@ -131,6 +131,8 @@ else
exit 1
fi
+
+
# make deb package
dpkg -b ${pkg_dir} $debname
echo "make deb package success!"
diff --git a/packaging/docker/dockerManifest.sh b/packaging/docker/dockerManifest.sh
index c846e8345d..0b30dd702c 100755
--- a/packaging/docker/dockerManifest.sh
+++ b/packaging/docker/dockerManifest.sh
@@ -5,22 +5,28 @@ set -e
# dockerbuild.sh
# -n [version number]
# -p [xxxx]
+# -V [stable | beta]
# set parameters by default value
-verNumber=""
+version=""
passWord=""
+verType=""
-while getopts "hn:p:" arg
+while getopts "hn:p:V:" arg
do
case $arg in
n)
- #echo "verNumber=$OPTARG"
- verNumber=$(echo $OPTARG)
+ #echo "version=$OPTARG"
+ version=$(echo $OPTARG)
;;
p)
#echo "passWord=$OPTARG"
passWord=$(echo $OPTARG)
;;
+ V)
+ #echo "verType=$OPTARG"
+ verType=$(echo $OPTARG)
+ ;;
h)
echo "Usage: `basename $0` -n [version number] "
echo " -p [password for docker hub] "
@@ -33,13 +39,34 @@ do
esac
done
-echo "verNumber=${verNumber}"
+echo "version=${version}"
-#docker manifest create -a tdengine/tdengine:${verNumber} tdengine/tdengine-amd64:${verNumber} tdengine/tdengine-aarch64:${verNumber} tdengine/tdengine-aarch32:${verNumber}
-docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
+#docker manifest rm tdengine/tdengine
+#docker manifest rm tdengine/tdengine:${version}
+if [ "$verType" == "beta" ]; then
+ docker manifest create -a tdengine/tdengine-beta:${version} tdengine/tdengine-amd64-beta:${version} tdengine/tdengine-aarch64-beta:${version} tdengine/tdengine-aarch32-beta:${version}
+ docker manifest create -a tdengine/tdengine-beta:latest tdengine/tdengine-amd64-beta:latest tdengine/tdengine-aarch64-beta:latest tdengine/tdengine-aarch32-beta:latest
+ docker login -u tdengine -p ${passWord} #replace the docker registry username and password
+ docker manifest push tdengine/tdengine-beta:latest
+ docker manifest push tdengine/tdengine-beta:${version}
-docker login -u tdengine -p ${passWord} #replace the docker registry username and password
+elif [ "$verType" == "stable" ]; then
+ docker manifest create -a tdengine/tdengine:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
+ docker manifest create -a tdengine/tdengine:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
+ docker login -u tdengine -p ${passWord} #replace the docker registry username and password
+ docker manifest push tdengine/tdengine:latest
+ docker manifest push tdengine/tdengine:${version}
-docker manifest push tdengine/tdengine:latest
+else
+ echo "unknow verType, nor stabel or beta"
+ exit 1
+fi
-# how set latest version ???
+# docker manifest create -a tdengine/${dockername}:${version} tdengine/tdengine-amd64:${version} tdengine/tdengine-aarch64:${version} tdengine/tdengine-aarch32:${version}
+# docker manifest create -a tdengine/${dockername}:latest tdengine/tdengine-amd64:latest tdengine/tdengine-aarch64:latest tdengine/tdengine-aarch32:latest
+
+# docker login -u tdengine -p ${passWord} #replace the docker registry username and password
+
+# docker manifest push tdengine/tdengine:latest
+
+# # how set latest version ???
diff --git a/packaging/docker/dockerbuild.sh b/packaging/docker/dockerbuild.sh
index b7991465b0..861f00f854 100755
--- a/packaging/docker/dockerbuild.sh
+++ b/packaging/docker/dockerbuild.sh
@@ -1,20 +1,24 @@
#!/bin/bash
+#
+
set -e
#set -x
# dockerbuild.sh
# -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...]
-# -f [pkg file]
# -n [version number]
# -p [password for docker hub]
+# -V [stable | beta]
+# -f [pkg file]
# set parameters by default value
-cpuType=amd64
-verNumber=""
+cpuType=""
+version=""
passWord=""
pkgFile=""
+verType="stable"
-while getopts "hc:n:p:f:" arg
+while getopts "hc:n:p:f:V:" arg
do
case $arg in
c)
@@ -22,8 +26,8 @@ do
cpuType=$(echo $OPTARG)
;;
n)
- #echo "verNumber=$OPTARG"
- verNumber=$(echo $OPTARG)
+ #echo "version=$OPTARG"
+ version=$(echo $OPTARG)
;;
p)
#echo "passWord=$OPTARG"
@@ -33,11 +37,17 @@ do
#echo "pkgFile=$OPTARG"
pkgFile=$(echo $OPTARG)
;;
+ V)
+ #echo "verType=$OPTARG"
+ verType=$(echo $OPTARG)
+ ;;
h)
- echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] "
- echo " -f [pkg file] "
+ echo "Usage: `basename $0` -c [aarch32 | aarch64 | amd64 | x86 | mips64 ...] "
echo " -n [version number] "
echo " -p [password for docker hub] "
+ echo " -V [stable | beta] "
+ echo " -f [pkg file] "
+
exit 0
;;
?) #unknow option
@@ -47,17 +57,44 @@ do
esac
done
-echo "cpuType=${cpuType} verNumber=${verNumber} pkgFile=${pkgFile} "
+# if [ "$verType" == "beta" ]; then
+# pkgFile=TDengine-server-${version}-Linux-${cpuType}-${verType}.tar.gz
+# elif [ "$verType" == "stable" ]; then
+# pkgFile=TDengine-server-${version}-Linux-${cpuType}.tar.gz
+# else
+# echo "unknow verType, nor stabel or beta"
+# exit 1
+
+if [ "$verType" == "beta" ]; then
+ dockername=${cpuType}-${verType}
+elif [ "$verType" == "stable" ]; then
+ dockername=${cpuType}
+else
+ echo "unknow verType, nor stabel or beta"
+ exit 1
+fi
+
+
+echo "cpuType=${cpuType} version=${version} pkgFile=${pkgFile} verType=${verType} "
echo "$(pwd)"
echo "====NOTES: ${pkgFile} must be in the same directory as dockerbuild.sh===="
-dirName=${pkgFile%-Linux*}
-#echo "dirName=${dirName}"
+scriptDir=$(dirname $(readlink -f $0))
+comunityArchiveDir=/nas/TDengine/v$version/community # community version’package directory
+cd ${scriptDir}
+cp -f ${comunityArchiveDir}/${pkgFile} .
-docker build --rm -f "Dockerfile" -t tdengine/tdengine-${cpuType}:${verNumber} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName}
+dirName=${pkgFile%-Linux*}
+echo "dirName=${dirName}"
+
+
+docker build --rm -f "Dockerfile" -t tdengine/tdengine-${dockername}:${version} "." --build-arg pkgFile=${pkgFile} --build-arg dirName=${dirName}
docker login -u tdengine -p ${passWord} #replace the docker registry username and password
-docker push tdengine/tdengine-${cpuType}:${verNumber}
+docker push tdengine/tdengine-${dockername}:${version}
# set this version to latest version
-docker tag tdengine/tdengine-${cpuType}:${verNumber} tdengine/tdengine-${cpuType}:latest
-docker push tdengine/tdengine-${cpuType}:latest
+docker tag tdengine/tdengine-${dockername}:${version} tdengine/tdengine-${dockername}:latest
+docker push tdengine/tdengine-${dockername}:latest
+
+
+rm -f ${pkgFile}
\ No newline at end of file
diff --git a/packaging/rpm/makerpm.sh b/packaging/rpm/makerpm.sh
index 7c3272f8d0..4cc7daf1a4 100755
--- a/packaging/rpm/makerpm.sh
+++ b/packaging/rpm/makerpm.sh
@@ -73,7 +73,7 @@ else
fi
if [ "$verType" == "beta" ]; then
- rpmname=${rpmname}-${verType}".rpm"
+ rpmname="TDengine-server-"${tdengine_ver}-${verType}-${osType}-${cpuType}".rpm"
elif [ "$verType" == "stable" ]; then
rpmname=${rpmname}".rpm"
else
diff --git a/packaging/tools/makearbi.sh b/packaging/tools/makearbi.sh
index 82808bcae9..5346a79c8f 100755
--- a/packaging/tools/makearbi.sh
+++ b/packaging/tools/makearbi.sh
@@ -47,24 +47,28 @@ mkdir -p ${install_dir}/init.d && cp ${init_file_tarbitrator_rpm} ${install_dir}
cd ${release_dir}
-if [ "$verMode" == "cluster" ]; then
- pkg_name=${install_dir}-${osType}-${cpuType}
-elif [ "$verMode" == "edge" ]; then
- pkg_name=${install_dir}-${osType}-${cpuType}
-else
- echo "unknow verMode, nor cluster or edge"
- exit 1
-fi
+# install_dir has been distinguishes cluster from edege, so comments this code
+pkg_name=${install_dir}-${osType}-${cpuType}
+
+# if [ "$verMode" == "cluster" ]; then
+# pkg_name=${install_dir}-${osType}-${cpuType}
+# elif [ "$verMode" == "edge" ]; then
+# pkg_name=${install_dir}-${osType}-${cpuType}
+# else
+# echo "unknow verMode, nor cluster or edge"
+# exit 1
+# fi
if [ "$verType" == "beta" ]; then
- pkg_name=${pkg_name}-${verType}
-elif [ "$verType" == "stable" ]; then
- pkg_name=${pkg_name}
+ pkg_name=${install_dir}-${verType}-${osType}-${cpuType}
+elif [ "$verType" == "stable" ]; then
+ pkg_name=${pkg_name}
else
echo "unknow verType, nor stabel or beta"
exit 1
fi
+
tar -zcv -f "$(basename ${pkg_name}).tar.gz" $(basename ${install_dir}) --remove-files || :
exitcode=$?
if [ "$exitcode" != "0" ]; then
diff --git a/packaging/tools/makeclient.sh b/packaging/tools/makeclient.sh
index 0ae5733599..2c36e85970 100755
--- a/packaging/tools/makeclient.sh
+++ b/packaging/tools/makeclient.sh
@@ -170,12 +170,24 @@ fi
cd ${release_dir}
-if [ "$verMode" == "cluster" ]; then
- pkg_name=${install_dir}-${osType}-${cpuType}
-elif [ "$verMode" == "edge" ]; then
- pkg_name=${install_dir}-${osType}-${cpuType}
+# install_dir has been distinguishes cluster from edege, so comments this code
+pkg_name=${install_dir}-${osType}-${cpuType}
+
+# if [ "$verMode" == "cluster" ]; then
+# pkg_name=${install_dir}-${osType}-${cpuType}
+# elif [ "$verMode" == "edge" ]; then
+# pkg_name=${install_dir}-${osType}-${cpuType}
+# else
+# echo "unknow verMode, nor cluster or edge"
+# exit 1
+# fi
+
+if [ "$verType" == "beta" ]; then
+ pkg_name=${install_dir}-${verType}-${osType}-${cpuType}
+elif [ "$verType" == "stable" ]; then
+ pkg_name=${pkg_name}
else
- echo "unknow verMode, nor cluster or edge"
+ echo "unknow verType, nor stabel or beta"
exit 1
fi
@@ -183,15 +195,6 @@ if [ "$pagMode" == "lite" ]; then
pkg_name=${pkg_name}-Lite
fi
-if [ "$verType" == "beta" ]; then
- pkg_name=${pkg_name}-${verType}
-elif [ "$verType" == "stable" ]; then
- pkg_name=${pkg_name}
-else
- echo "unknow verType, nor stable or beta"
- exit 1
-fi
-
if [ "$osType" != "Darwin" ]; then
tar -zcv -f "$(basename ${pkg_name}).tar.gz" $(basename ${install_dir}) --remove-files || :
else
diff --git a/packaging/tools/makepkg.sh b/packaging/tools/makepkg.sh
index 81061416a2..56ab24426f 100755
--- a/packaging/tools/makepkg.sh
+++ b/packaging/tools/makepkg.sh
@@ -203,21 +203,20 @@ fi
cd ${release_dir}
-if [ "$verMode" == "cluster" ]; then
- pkg_name=${install_dir}-${osType}-${cpuType}
-elif [ "$verMode" == "edge" ]; then
- pkg_name=${install_dir}-${osType}-${cpuType}
-else
- echo "unknow verMode, nor cluster or edge"
- exit 1
-fi
+# install_dir has been distinguishes cluster from edege, so comments this code
+pkg_name=${install_dir}-${osType}-${cpuType}
-if [ "$pagMode" == "lite" ]; then
- pkg_name=${pkg_name}-Lite
-fi
+# if [ "$verMode" == "cluster" ]; then
+# pkg_name=${install_dir}-${osType}-${cpuType}
+# elif [ "$verMode" == "edge" ]; then
+# pkg_name=${install_dir}-${osType}-${cpuType}
+# else
+# echo "unknow verMode, nor cluster or edge"
+# exit 1
+# fi
if [ "$verType" == "beta" ]; then
- pkg_name=${pkg_name}-${verType}
+ pkg_name=${install_dir}-${verType}-${osType}-${cpuType}
elif [ "$verType" == "stable" ]; then
pkg_name=${pkg_name}
else
@@ -225,6 +224,10 @@ else
exit 1
fi
+if [ "$pagMode" == "lite" ]; then
+ pkg_name=${pkg_name}-Lite
+fi
+
tar -zcv -f "$(basename ${pkg_name}).tar.gz" $(basename ${install_dir}) --remove-files || :
exitcode=$?
if [ "$exitcode" != "0" ]; then
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index 65a8e6b684..fe60dca6ed 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,6 +1,6 @@
name: tdengine
base: core18
-version: '2.1.3.0'
+version: '2.1.4.1'
icon: snap/gui/t-dengine.svg
summary: an open-source big data platform designed and optimized for IoT.
description: |
@@ -72,7 +72,7 @@ parts:
- usr/bin/taosd
- usr/bin/taos
- usr/bin/taosdemo
- - usr/lib/libtaos.so.2.1.3.0
+ - usr/lib/libtaos.so.2.1.4.1
- usr/lib/libtaos.so.1
- usr/lib/libtaos.so
diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c
index 0e01e58694..9f15f7e1a5 100644
--- a/src/client/src/tscSQLParser.c
+++ b/src/client/src/tscSQLParser.c
@@ -8195,13 +8195,19 @@ static STableMeta* extractTempTableMetaFromSubquery(SQueryInfo* pUpstream) {
int32_t n = 0;
for(int32_t i = 0; i < numOfColumns; ++i) {
SInternalField* pField = tscFieldInfoGetInternalField(&pUpstream->fieldsInfo, i);
- if (pField->visible) {
- meta->schema[n].bytes = pField->field.bytes;
- meta->schema[n].type = pField->field.type;
- meta->schema[n].colId = pField->pExpr->base.resColId;
- tstrncpy(meta->schema[n].name, pField->pExpr->base.aliasName, TSDB_COL_NAME_LEN);
- n += 1;
+ if (!pField->visible) {
+ continue;
}
+
+ meta->schema[n].bytes = pField->field.bytes;
+ meta->schema[n].type = pField->field.type;
+
+ SExprInfo* pExpr = pField->pExpr;
+ meta->schema[n].colId = pExpr->base.resColId;
+ tstrncpy(meta->schema[n].name, pField->pExpr->base.aliasName, TSDB_COL_NAME_LEN);
+ info->rowSize += meta->schema[n].bytes;
+
+ n += 1;
}
return meta;
diff --git a/src/kit/taosdemo/taosdemo.c b/src/kit/taosdemo/taosdemo.c
index e5945f4eac..fa3d263678 100644
--- a/src/kit/taosdemo/taosdemo.c
+++ b/src/kit/taosdemo/taosdemo.c
@@ -198,44 +198,45 @@ enum _describe_table_index {
static char *g_dupstr = NULL;
typedef struct SArguments_S {
- char * metaFile;
- uint32_t test_mode;
- char * host;
- uint16_t port;
- uint16_t iface;
- char * user;
- char * password;
- char * database;
- int replica;
- char * tb_prefix;
- char * sqlFile;
- bool use_metric;
- bool drop_database;
- bool insert_only;
- bool answer_yes;
- bool debug_print;
- bool verbose_print;
- bool performance_print;
- char * output_file;
- bool async_mode;
- char * datatype[MAX_NUM_DATATYPE + 1];
- uint32_t len_of_binary;
- uint32_t num_of_CPR;
- uint32_t num_of_threads;
- uint64_t insert_interval;
- int64_t query_times;
- uint32_t interlace_rows;
- uint32_t num_of_RPR; // num_of_records_per_req
- uint64_t max_sql_len;
- int64_t num_of_tables;
- int64_t num_of_DPT;
- int abort;
- uint32_t disorderRatio; // 0: no disorder, >0: x%
- int disorderRange; // ms or us by database precision
- uint32_t method_of_delete;
- char ** arg_list;
- uint64_t totalInsertRows;
- uint64_t totalAffectedRows;
+ char * metaFile;
+ uint32_t test_mode;
+ char * host;
+ uint16_t port;
+ uint16_t iface;
+ char * user;
+ char * password;
+ char * database;
+ int replica;
+ char * tb_prefix;
+ char * sqlFile;
+ bool use_metric;
+ bool drop_database;
+ bool insert_only;
+ bool answer_yes;
+ bool debug_print;
+ bool verbose_print;
+ bool performance_print;
+ char * output_file;
+ bool async_mode;
+ char * datatype[MAX_NUM_DATATYPE + 1];
+ uint32_t len_of_binary;
+ uint32_t num_of_CPR;
+ uint32_t num_of_threads;
+ uint64_t insert_interval;
+ int64_t query_times;
+ uint32_t interlace_rows;
+ uint32_t num_of_RPR; // num_of_records_per_req
+ uint64_t max_sql_len;
+ int64_t num_of_tables;
+ int64_t num_of_DPT;
+ int abort;
+ uint32_t disorderRatio; // 0: no disorder, >0: x%
+ int disorderRange; // ms or us by database precision
+ uint32_t method_of_delete;
+ char ** arg_list;
+ uint64_t totalInsertRows;
+ uint64_t totalAffectedRows;
+ bool demo_mode; // use default column name and semi-random data
} SArguments;
typedef struct SColumn_S {
@@ -427,47 +428,47 @@ typedef struct SQueryMetaInfo_S {
} SQueryMetaInfo;
typedef struct SThreadInfo_S {
- TAOS * taos;
- TAOS_STMT *stmt;
- int threadID;
- char db_name[TSDB_DB_NAME_LEN];
- uint32_t time_precision;
- char filePath[4096];
- FILE *fp;
- char tb_prefix[TSDB_TABLE_NAME_LEN];
- uint64_t start_table_from;
- uint64_t end_table_to;
- int64_t ntables;
- uint64_t data_of_rate;
- int64_t start_time;
- char* cols;
- bool use_metric;
- SSuperTable* superTblInfo;
- char *buffer; // sql cmd buffer
+ TAOS * taos;
+ TAOS_STMT *stmt;
+ int threadID;
+ char db_name[TSDB_DB_NAME_LEN];
+ uint32_t time_precision;
+ char filePath[4096];
+ FILE *fp;
+ char tb_prefix[TSDB_TABLE_NAME_LEN];
+ uint64_t start_table_from;
+ uint64_t end_table_to;
+ int64_t ntables;
+ uint64_t data_of_rate;
+ int64_t start_time;
+ char* cols;
+ bool use_metric;
+ SSuperTable* superTblInfo;
+ char *buffer; // sql cmd buffer
- // for async insert
- tsem_t lock_sem;
- int64_t counter;
- uint64_t st;
- uint64_t et;
- uint64_t lastTs;
+ // for async insert
+ tsem_t lock_sem;
+ int64_t counter;
+ uint64_t st;
+ uint64_t et;
+ uint64_t lastTs;
- // sample data
- int64_t samplePos;
- // statistics
- uint64_t totalInsertRows;
- uint64_t totalAffectedRows;
+ // sample data
+ int64_t samplePos;
+ // statistics
+ uint64_t totalInsertRows;
+ uint64_t totalAffectedRows;
- // insert delay statistics
- uint64_t cntDelay;
- uint64_t totalDelay;
- uint64_t avgDelay;
- uint64_t maxDelay;
- uint64_t minDelay;
+ // insert delay statistics
+ uint64_t cntDelay;
+ uint64_t totalDelay;
+ uint64_t avgDelay;
+ uint64_t maxDelay;
+ uint64_t minDelay;
- // seq of query or subscribe
- uint64_t querySeq; // sequence number of sql command
- TAOS_SUB* tsub;
+ // seq of query or subscribe
+ uint64_t querySeq; // sequence number of sql command
+ TAOS_SUB* tsub;
} threadInfo;
@@ -552,6 +553,8 @@ static int postProceSql(char *host, struct sockaddr_in *pServAddr,
uint16_t port, char* sqlstr, threadInfo *pThreadInfo);
static int64_t getTSRandTail(int64_t timeStampStep, int32_t seq,
int disorderRatio, int disorderRange);
+static bool getInfoFromJsonFile(char* file);
+static void init_rand_data();
/* ************ Global variables ************ */
@@ -563,53 +566,55 @@ char *aggreFunc[] = {"*", "count(*)", "avg(col0)", "sum(col0)",
"max(col0)", "min(col0)", "first(col0)", "last(col0)"};
SArguments g_args = {
- NULL, // metaFile
- 0, // test_mode
- "127.0.0.1", // host
- 6030, // port
- TAOSC_IFACE, // iface
- "root", // user
- #ifdef _TD_POWER_
- "powerdb", // password
- #elif (_TD_TQ_ == true)
- "tqueue", // password
- #else
- "taosdata", // password
- #endif
- "test", // database
- 1, // replica
- "t", // tb_prefix
- NULL, // sqlFile
- true, // use_metric
- true, // drop_database
- true, // insert_only
- false, // debug_print
- false, // verbose_print
- false, // performance statistic print
- false, // answer_yes;
- "./output.txt", // output_file
- 0, // mode : sync or async
- {
- "INT", // datatype
- "INT", // datatype
- "INT", // datatype
- "INT", // datatype
- },
- 16, // len_of_binary
- 4, // num_of_CPR
- 10, // num_of_connections/thread
- 0, // insert_interval
- 1, // query_times
- 0, // interlace_rows;
- 30000, // num_of_RPR
- (1024*1024), // max_sql_len
- 10000, // num_of_tables
- 10000, // num_of_DPT
- 0, // abort
- 0, // disorderRatio
- 1000, // disorderRange
- 1, // method_of_delete
- NULL // arg_list
+ NULL, // metaFile
+ 0, // test_mode
+ "127.0.0.1", // host
+ 6030, // port
+ TAOSC_IFACE, // iface
+ "root", // user
+#ifdef _TD_POWER_
+ "powerdb", // password
+#elif (_TD_TQ_ == true)
+ "tqueue", // password
+#else
+ "taosdata", // password
+#endif
+ "test", // database
+ 1, // replica
+ "d", // tb_prefix
+ NULL, // sqlFile
+ true, // use_metric
+ true, // drop_database
+ true, // insert_only
+ false, // debug_print
+ false, // verbose_print
+ false, // performance statistic print
+ false, // answer_yes;
+ "./output.txt", // output_file
+ 0, // mode : sync or async
+ {
+ "FLOAT", // datatype
+ "INT", // datatype
+ "FLOAT", // datatype
+ },
+ 16, // len_of_binary
+ 4, // num_of_CPR
+ 10, // num_of_connections/thread
+ 0, // insert_interval
+ 1, // query_times
+ 0, // interlace_rows;
+ 30000, // num_of_RPR
+ (1024*1024), // max_sql_len
+ 10000, // num_of_tables
+ 10000, // num_of_DPT
+ 0, // abort
+ 0, // disorderRatio
+ 1000, // disorderRange
+ 1, // method_of_delete
+ NULL, // arg_list
+ 0, // totalInsertRows;
+ 0, // totalAffectedRows;
+ true, // demo_mode;
};
@@ -673,645 +678,674 @@ static void printVersion() {
}
static void printHelp() {
- char indent[10] = " ";
- printf("%s%s%s%s\n", indent, "-f", indent,
- "The meta file to the execution procedure. Default is './meta.json'.");
- printf("%s%s%s%s\n", indent, "-u", indent,
- "The TDengine user name to use when connecting to the server. Default is 'root'.");
+ char indent[10] = " ";
+ printf("%s%s%s%s\n", indent, "-f", indent,
+ "The meta file to the execution procedure. Default is './meta.json'.");
+ printf("%s%s%s%s\n", indent, "-u", indent,
+ "The TDengine user name to use when connecting to the server. Default is 'root'.");
#ifdef _TD_POWER_
- printf("%s%s%s%s\n", indent, "-P", indent,
- "The password to use when connecting to the server. Default is 'powerdb'.");
- printf("%s%s%s%s\n", indent, "-c", indent,
- "Configuration directory. Default is '/etc/power/'.");
+ printf("%s%s%s%s\n", indent, "-P", indent,
+ "The password to use when connecting to the server. Default is 'powerdb'.");
+ printf("%s%s%s%s\n", indent, "-c", indent,
+ "Configuration directory. Default is '/etc/power/'.");
#elif (_TD_TQ_ == true)
- printf("%s%s%s%s\n", indent, "-P", indent,
- "The password to use when connecting to the server. Default is 'tqueue'.");
- printf("%s%s%s%s\n", indent, "-c", indent,
- "Configuration directory. Default is '/etc/tq/'.");
+ printf("%s%s%s%s\n", indent, "-P", indent,
+ "The password to use when connecting to the server. Default is 'tqueue'.");
+ printf("%s%s%s%s\n", indent, "-c", indent,
+ "Configuration directory. Default is '/etc/tq/'.");
#else
- printf("%s%s%s%s\n", indent, "-P", indent,
- "The password to use when connecting to the server. Default is 'taosdata'.");
- printf("%s%s%s%s\n", indent, "-c", indent,
- "Configuration directory. Default is '/etc/taos/'.");
+ printf("%s%s%s%s\n", indent, "-P", indent,
+ "The password to use when connecting to the server. Default is 'taosdata'.");
+ printf("%s%s%s%s\n", indent, "-c", indent,
+ "Configuration directory. Default is '/etc/taos/'.");
#endif
- printf("%s%s%s%s\n", indent, "-h", indent,
- "The host to connect to TDengine. Default is localhost.");
- printf("%s%s%s%s\n", indent, "-p", indent,
- "The TCP/IP port number to use for the connection. Default is 0.");
- printf("%s%s%s%s\n", indent, "-I", indent,
+ printf("%s%s%s%s\n", indent, "-h", indent,
+ "The host to connect to TDengine. Default is localhost.");
+ printf("%s%s%s%s\n", indent, "-p", indent,
+ "The TCP/IP port number to use for the connection. Default is 0.");
+ printf("%s%s%s%s\n", indent, "-I", indent,
#if STMT_IFACE_ENABLED == 1
- "The interface (taosc, rest, and stmt) taosdemo uses. Default is 'taosc'.");
+ "The interface (taosc, rest, and stmt) taosdemo uses. Default is 'taosc'.");
#else
- "The interface (taosc, rest) taosdemo uses. Default is 'taosc'.");
+ "The interface (taosc, rest) taosdemo uses. Default is 'taosc'.");
#endif
- printf("%s%s%s%s\n", indent, "-d", indent,
- "Destination database. Default is 'test'.");
- printf("%s%s%s%s\n", indent, "-a", indent,
- "Set the replica parameters of the database, Default 1, min: 1, max: 3.");
- printf("%s%s%s%s\n", indent, "-m", indent,
- "Table prefix name. Default is 't'.");
- printf("%s%s%s%s\n", indent, "-s", indent, "The select sql file.");
- printf("%s%s%s%s\n", indent, "-N", indent, "Use normal table flag.");
- printf("%s%s%s%s\n", indent, "-o", indent,
- "Direct output to the named file. Default is './output.txt'.");
- printf("%s%s%s%s\n", indent, "-q", indent,
- "Query mode -- 0: SYNC, 1: ASYNC. Default is SYNC.");
- printf("%s%s%s%s\n", indent, "-b", indent,
- "The data_type of columns, default: INT,INT,INT,INT.");
- printf("%s%s%s%s\n", indent, "-w", indent,
- "The length of data_type 'BINARY' or 'NCHAR'. Default is 16");
- printf("%s%s%s%s%d\n", indent, "-l", indent,
- "The number of columns per record. Default is 4. Max values is ",
- MAX_NUM_DATATYPE);
- printf("%s%s%s%s\n", indent, "-T", indent,
- "The number of threads. Default is 10.");
- printf("%s%s%s%s\n", indent, "-i", indent,
- "The sleep time (ms) between insertion. Default is 0.");
- printf("%s%s%s%s\n", indent, "-r", indent,
- "The number of records per request. Default is 30000.");
- printf("%s%s%s%s\n", indent, "-t", indent,
- "The number of tables. Default is 10000.");
- printf("%s%s%s%s\n", indent, "-n", indent,
- "The number of records per table. Default is 10000.");
- printf("%s%s%s%s\n", indent, "-x", indent, "Not insert only flag.");
- printf("%s%s%s%s\n", indent, "-y", indent, "Default input yes for prompt.");
- printf("%s%s%s%s\n", indent, "-O", indent,
- "Insert mode--0: In order, 1 ~ 50: disorder ratio. Default is in order.");
- printf("%s%s%s%s\n", indent, "-R", indent,
- "Out of order data's range, ms, default is 1000.");
- printf("%s%s%s%s\n", indent, "-g", indent,
- "Print debug info.");
- printf("%s%s%s\n", indent, "-V, --version\t",
- "Print version info.");
- printf("%s%s%s%s\n", indent, "--help\t", indent,
- "Print command line arguments list info.");
-/* printf("%s%s%s%s\n", indent, "-D", indent,
- "if elete database if exists. 0: no, 1: yes, default is 1");
+ printf("%s%s%s%s\n", indent, "-d", indent,
+ "Destination database. Default is 'test'.");
+ printf("%s%s%s%s\n", indent, "-a", indent,
+ "Set the replica parameters of the database, Default 1, min: 1, max: 3.");
+ printf("%s%s%s%s\n", indent, "-m", indent,
+ "Table prefix name. Default is 'd'.");
+ printf("%s%s%s%s\n", indent, "-s", indent, "The select sql file.");
+ printf("%s%s%s%s\n", indent, "-N", indent, "Use normal table flag.");
+ printf("%s%s%s%s\n", indent, "-o", indent,
+ "Direct output to the named file. Default is './output.txt'.");
+ printf("%s%s%s%s\n", indent, "-q", indent,
+ "Query mode -- 0: SYNC, 1: ASYNC. Default is SYNC.");
+ printf("%s%s%s%s\n", indent, "-b", indent,
+ "The data_type of columns, default: FLOAT, INT, FLOAT.");
+ printf("%s%s%s%s\n", indent, "-w", indent,
+ "The length of data_type 'BINARY' or 'NCHAR'. Default is 16");
+ printf("%s%s%s%s%d\n", indent, "-l", indent,
+ "The number of columns per record. Default is 3. Max values is ",
+ MAX_NUM_DATATYPE);
+ printf("%s%s%s%s\n", indent, "-T", indent,
+ "The number of threads. Default is 10.");
+ printf("%s%s%s%s\n", indent, "-i", indent,
+ "The sleep time (ms) between insertion. Default is 0.");
+ printf("%s%s%s%s\n", indent, "-r", indent,
+ "The number of records per request. Default is 30000.");
+ printf("%s%s%s%s\n", indent, "-t", indent,
+ "The number of tables. Default is 10000.");
+ printf("%s%s%s%s\n", indent, "-n", indent,
+ "The number of records per table. Default is 10000.");
+ printf("%s%s%s%s\n", indent, "-M", indent,
+ "The value of records generated are totally random.");
+ printf("%s%s%s%s\n", indent, indent, indent,
+ " The default is to simulate power equipment senario.");
+ printf("%s%s%s%s\n", indent, "-x", indent, "Not insert only flag.");
+ printf("%s%s%s%s\n", indent, "-y", indent, "Default input yes for prompt.");
+ printf("%s%s%s%s\n", indent, "-O", indent,
+ "Insert mode--0: In order, 1 ~ 50: disorder ratio. Default is in order.");
+ printf("%s%s%s%s\n", indent, "-R", indent,
+ "Out of order data's range, ms, default is 1000.");
+ printf("%s%s%s%s\n", indent, "-g", indent,
+ "Print debug info.");
+ printf("%s%s%s\n", indent, "-V, --version\t",
+ "Print version info.");
+ printf("%s%s%s%s\n", indent, "--help\t", indent,
+ "Print command line arguments list info.");
+ /* printf("%s%s%s%s\n", indent, "-D", indent,
+ "Delete database if exists. 0: no, 1: yes, default is 1");
*/
}
static bool isStringNumber(char *input)
{
- int len = strlen(input);
- if (0 == len) {
- return false;
- }
+ int len = strlen(input);
+ if (0 == len) {
+ return false;
+ }
- for (int i = 0; i < len; i++) {
- if (!isdigit(input[i]))
- return false;
- }
+ for (int i = 0; i < len; i++) {
+ if (!isdigit(input[i]))
+ return false;
+ }
- return true;
+ return true;
}
static void parse_args(int argc, char *argv[], SArguments *arguments) {
- for (int i = 1; i < argc; i++) {
- if (strcmp(argv[i], "-f") == 0) {
- arguments->metaFile = argv[++i];
- } else if (strcmp(argv[i], "-c") == 0) {
- if (argc == i+1) {
- printHelp();
- errorPrint("%s", "\n\t-c need a valid path following!\n");
- exit(EXIT_FAILURE);
- }
- tstrncpy(configDir, argv[++i], TSDB_FILENAME_LEN);
- } else if (strcmp(argv[i], "-h") == 0) {
- if (argc == i+1) {
- printHelp();
- errorPrint("%s", "\n\t-h need a valid string following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->host = argv[++i];
- } else if (strcmp(argv[i], "-p") == 0) {
- if ((argc == i+1) ||
- (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-p need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->port = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-I") == 0) {
- if (argc == i+1) {
- printHelp();
- errorPrint("%s", "\n\t-I need a valid string following!\n");
- exit(EXIT_FAILURE);
- }
- ++i;
- if (0 == strcasecmp(argv[i], "taosc")) {
- arguments->iface = TAOSC_IFACE;
- } else if (0 == strcasecmp(argv[i], "rest")) {
- arguments->iface = REST_IFACE;
+ for (int i = 1; i < argc; i++) {
+ if (strcmp(argv[i], "-f") == 0) {
+ arguments->demo_mode = false;
+ arguments->metaFile = argv[++i];
+ } else if (strcmp(argv[i], "-c") == 0) {
+ if (argc == i+1) {
+ printHelp();
+ errorPrint("%s", "\n\t-c need a valid path following!\n");
+ exit(EXIT_FAILURE);
+ }
+ tstrncpy(configDir, argv[++i], TSDB_FILENAME_LEN);
+ } else if (strcmp(argv[i], "-h") == 0) {
+ if (argc == i+1) {
+ printHelp();
+ errorPrint("%s", "\n\t-h need a valid string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->host = argv[++i];
+ } else if (strcmp(argv[i], "-p") == 0) {
+ if ((argc == i+1) ||
+ (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-p need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->port = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-I") == 0) {
+ if (argc == i+1) {
+ printHelp();
+ errorPrint("%s", "\n\t-I need a valid string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ ++i;
+ if (0 == strcasecmp(argv[i], "taosc")) {
+ arguments->iface = TAOSC_IFACE;
+ } else if (0 == strcasecmp(argv[i], "rest")) {
+ arguments->iface = REST_IFACE;
#if STMT_IFACE_ENABLED == 1
- } else if (0 == strcasecmp(argv[i], "stmt")) {
- arguments->iface = STMT_IFACE;
+ } else if (0 == strcasecmp(argv[i], "stmt")) {
+ arguments->iface = STMT_IFACE;
#endif
- } else {
- errorPrint("%s", "\n\t-I need a valid string following!\n");
- exit(EXIT_FAILURE);
- }
- } else if (strcmp(argv[i], "-u") == 0) {
- if (argc == i+1) {
- printHelp();
- errorPrint("%s", "\n\t-u need a valid string following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->user = argv[++i];
- } else if (strcmp(argv[i], "-P") == 0) {
- if (argc == i+1) {
- printHelp();
- errorPrint("%s", "\n\t-P need a valid string following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->password = argv[++i];
- } else if (strcmp(argv[i], "-o") == 0) {
- if (argc == i+1) {
- printHelp();
- errorPrint("%s", "\n\t-o need a valid string following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->output_file = argv[++i];
- } else if (strcmp(argv[i], "-s") == 0) {
- if (argc == i+1) {
- printHelp();
- errorPrint("%s", "\n\t-s need a valid string following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->sqlFile = argv[++i];
- } else if (strcmp(argv[i], "-q") == 0) {
- if ((argc == i+1)
- || (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-q need a number following!\nQuery mode -- 0: SYNC, not-0: ASYNC. Default is SYNC.\n");
- exit(EXIT_FAILURE);
- }
- arguments->async_mode = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-T") == 0) {
- if ((argc == i+1)
- || (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-T need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->num_of_threads = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-i") == 0) {
- if ((argc == i+1) ||
- (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-i need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->insert_interval = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-qt") == 0) {
- if ((argc == i+1)
- || (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-qt need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->query_times = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-B") == 0) {
- if ((argc == i+1)
- || (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-B need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->interlace_rows = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-r") == 0) {
- if ((argc == i+1)
- || (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-r need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->num_of_RPR = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-t") == 0) {
- if ((argc == i+1) ||
- (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-t need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->num_of_tables = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-n") == 0) {
- if ((argc == i+1) ||
- (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-n need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->num_of_DPT = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-d") == 0) {
- if (argc == i+1) {
- printHelp();
- errorPrint("%s", "\n\t-d need a valid string following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->database = argv[++i];
- } else if (strcmp(argv[i], "-l") == 0) {
- if (argc == i+1) {
- if (!isStringNumber(argv[i+1])) {
+ } else {
+ errorPrint("%s", "\n\t-I need a valid string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ } else if (strcmp(argv[i], "-u") == 0) {
+ if (argc == i+1) {
+ printHelp();
+ errorPrint("%s", "\n\t-u need a valid string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->user = argv[++i];
+ } else if (strcmp(argv[i], "-P") == 0) {
+ if (argc == i+1) {
+ printHelp();
+ errorPrint("%s", "\n\t-P need a valid string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->password = argv[++i];
+ } else if (strcmp(argv[i], "-o") == 0) {
+ if (argc == i+1) {
+ printHelp();
+ errorPrint("%s", "\n\t-o need a valid string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->output_file = argv[++i];
+ } else if (strcmp(argv[i], "-s") == 0) {
+ if (argc == i+1) {
+ printHelp();
+ errorPrint("%s", "\n\t-s need a valid string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->sqlFile = argv[++i];
+ } else if (strcmp(argv[i], "-q") == 0) {
+ if ((argc == i+1)
+ || (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-q need a number following!\nQuery mode -- 0: SYNC, not-0: ASYNC. Default is SYNC.\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->async_mode = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-T") == 0) {
+ if ((argc == i+1)
+ || (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-T need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->num_of_threads = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-i") == 0) {
+ if ((argc == i+1) ||
+ (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-i need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->insert_interval = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-qt") == 0) {
+ if ((argc == i+1)
+ || (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-qt need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->query_times = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-B") == 0) {
+ if ((argc == i+1)
+ || (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-B need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->interlace_rows = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-r") == 0) {
+ if ((argc == i+1)
+ || (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-r need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->num_of_RPR = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-t") == 0) {
+ if ((argc == i+1) ||
+ (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-t need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->num_of_tables = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-n") == 0) {
+ if ((argc == i+1) ||
+ (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-n need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->num_of_DPT = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-d") == 0) {
+ if (argc == i+1) {
+ printHelp();
+ errorPrint("%s", "\n\t-d need a valid string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->database = argv[++i];
+ } else if (strcmp(argv[i], "-l") == 0) {
+ arguments->demo_mode = false;
+ if (argc == i+1) {
+ if (!isStringNumber(argv[i+1])) {
+ printHelp();
+ errorPrint("%s", "\n\t-l need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ }
+ arguments->num_of_CPR = atoi(argv[++i]);
+
+ if (arguments->num_of_CPR > MAX_NUM_DATATYPE) {
+ printf("WARNING: max acceptible columns count is %d\n", MAX_NUM_DATATYPE);
+ prompt();
+ arguments->num_of_CPR = MAX_NUM_DATATYPE;
+ }
+
+ for (int col = arguments->num_of_CPR; col < MAX_NUM_DATATYPE; col++) {
+ arguments->datatype[col] = NULL;
+ }
+
+ } else if (strcmp(argv[i], "-b") == 0) {
+ arguments->demo_mode = false;
+ if (argc == i+1) {
+ printHelp();
+ errorPrint("%s", "\n\t-b need valid string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ ++i;
+ if (strstr(argv[i], ",") == NULL) {
+ // only one col
+ if (strcasecmp(argv[i], "INT")
+ && strcasecmp(argv[i], "FLOAT")
+ && strcasecmp(argv[i], "TINYINT")
+ && strcasecmp(argv[i], "BOOL")
+ && strcasecmp(argv[i], "SMALLINT")
+ && strcasecmp(argv[i], "BIGINT")
+ && strcasecmp(argv[i], "DOUBLE")
+ && strcasecmp(argv[i], "BINARY")
+ && strcasecmp(argv[i], "TIMESTAMP")
+ && strcasecmp(argv[i], "NCHAR")) {
+ printHelp();
+ errorPrint("%s", "-b: Invalid data_type!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->datatype[0] = argv[i];
+ } else {
+ // more than one col
+ int index = 0;
+ g_dupstr = strdup(argv[i]);
+ char *running = g_dupstr;
+ char *token = strsep(&running, ",");
+ while(token != NULL) {
+ if (strcasecmp(token, "INT")
+ && strcasecmp(token, "FLOAT")
+ && strcasecmp(token, "TINYINT")
+ && strcasecmp(token, "BOOL")
+ && strcasecmp(token, "SMALLINT")
+ && strcasecmp(token, "BIGINT")
+ && strcasecmp(token, "DOUBLE")
+ && strcasecmp(token, "BINARY")
+ && strcasecmp(token, "TIMESTAMP")
+ && strcasecmp(token, "NCHAR")) {
+ printHelp();
+ free(g_dupstr);
+ errorPrint("%s", "-b: Invalid data_type!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->datatype[index++] = token;
+ token = strsep(&running, ",");
+ if (index >= MAX_NUM_DATATYPE) break;
+ }
+ arguments->datatype[index] = NULL;
+ }
+ } else if (strcmp(argv[i], "-w") == 0) {
+ if ((argc == i+1) ||
+ (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-w need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->len_of_binary = atoi(argv[++i]);
+ } else if (strcmp(argv[i], "-m") == 0) {
+ if ((argc == i+1) ||
+ (isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-m need a letter-initial string following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->tb_prefix = argv[++i];
+ } else if (strcmp(argv[i], "-N") == 0) {
+ arguments->use_metric = false;
+ } else if (strcmp(argv[i], "-M") == 0) {
+ arguments->demo_mode = false;
+ } else if (strcmp(argv[i], "-x") == 0) {
+ arguments->insert_only = false;
+ } else if (strcmp(argv[i], "-y") == 0) {
+ arguments->answer_yes = true;
+ } else if (strcmp(argv[i], "-g") == 0) {
+ arguments->debug_print = true;
+ } else if (strcmp(argv[i], "-gg") == 0) {
+ arguments->verbose_print = true;
+ } else if (strcmp(argv[i], "-pp") == 0) {
+ arguments->performance_print = true;
+ } else if (strcmp(argv[i], "-O") == 0) {
+ if ((argc == i+1) ||
+ (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-O need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+
+ arguments->disorderRatio = atoi(argv[++i]);
+
+ if (arguments->disorderRatio > 50) {
+ arguments->disorderRatio = 50;
+ }
+
+ if (arguments->disorderRatio < 0) {
+ arguments->disorderRatio = 0;
+ }
+
+ } else if (strcmp(argv[i], "-R") == 0) {
+ if ((argc == i+1) ||
+ (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-R need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+
+ arguments->disorderRange = atoi(argv[++i]);
+ if (arguments->disorderRange < 0)
+ arguments->disorderRange = 1000;
+
+ } else if (strcmp(argv[i], "-a") == 0) {
+ if ((argc == i+1) ||
+ (!isStringNumber(argv[i+1]))) {
+ printHelp();
+ errorPrint("%s", "\n\t-a need a number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ arguments->replica = atoi(argv[++i]);
+ if (arguments->replica > 3 || arguments->replica < 1) {
+ arguments->replica = 1;
+ }
+ } else if (strcmp(argv[i], "-D") == 0) {
+ arguments->method_of_delete = atoi(argv[++i]);
+ if (arguments->method_of_delete > 3) {
+ errorPrint("%s", "\n\t-D need a valud (0~3) number following!\n");
+ exit(EXIT_FAILURE);
+ }
+ } else if ((strcmp(argv[i], "--version") == 0) ||
+ (strcmp(argv[i], "-V") == 0)){
+ printVersion();
+ exit(0);
+ } else if (strcmp(argv[i], "--help") == 0) {
printHelp();
- errorPrint("%s", "\n\t-l need a number following!\n");
+ exit(0);
+ } else {
+ printHelp();
+ errorPrint("%s", "ERROR: wrong options\n");
exit(EXIT_FAILURE);
}
- }
- arguments->num_of_CPR = atoi(argv[++i]);
+ }
- if (arguments->num_of_CPR > MAX_NUM_DATATYPE) {
- printf("WARNING: max acceptible columns count is %d\n", MAX_NUM_DATATYPE);
- prompt();
- arguments->num_of_CPR = MAX_NUM_DATATYPE;
- }
-
- for (int col = arguments->num_of_CPR; col < MAX_NUM_DATATYPE; col++) {
- arguments->datatype[col] = NULL;
- }
-
- } else if (strcmp(argv[i], "-b") == 0) {
- if (argc == i+1) {
- printHelp();
- errorPrint("%s", "\n\t-b need valid string following!\n");
- exit(EXIT_FAILURE);
- }
- ++i;
- if (strstr(argv[i], ",") == NULL) {
- // only one col
- if (strcasecmp(argv[i], "INT")
- && strcasecmp(argv[i], "FLOAT")
- && strcasecmp(argv[i], "TINYINT")
- && strcasecmp(argv[i], "BOOL")
- && strcasecmp(argv[i], "SMALLINT")
- && strcasecmp(argv[i], "BIGINT")
- && strcasecmp(argv[i], "DOUBLE")
- && strcasecmp(argv[i], "BINARY")
- && strcasecmp(argv[i], "TIMESTAMP")
- && strcasecmp(argv[i], "NCHAR")) {
- printHelp();
- errorPrint("%s", "-b: Invalid data_type!\n");
- exit(EXIT_FAILURE);
+ int columnCount;
+ for (columnCount = 0; columnCount < MAX_NUM_DATATYPE; columnCount ++) {
+ if (g_args.datatype[columnCount] == NULL) {
+ break;
}
- arguments->datatype[0] = argv[i];
- } else {
- // more than one col
- int index = 0;
- g_dupstr = strdup(argv[i]);
- char *running = g_dupstr;
- char *token = strsep(&running, ",");
- while(token != NULL) {
- if (strcasecmp(token, "INT")
- && strcasecmp(token, "FLOAT")
- && strcasecmp(token, "TINYINT")
- && strcasecmp(token, "BOOL")
- && strcasecmp(token, "SMALLINT")
- && strcasecmp(token, "BIGINT")
- && strcasecmp(token, "DOUBLE")
- && strcasecmp(token, "BINARY")
- && strcasecmp(token, "TIMESTAMP")
- && strcasecmp(token, "NCHAR")) {
- printHelp();
- free(g_dupstr);
- errorPrint("%s", "-b: Invalid data_type!\n");
- exit(EXIT_FAILURE);
- }
- arguments->datatype[index++] = token;
- token = strsep(&running, ",");
- if (index >= MAX_NUM_DATATYPE) break;
+ }
+
+ if (0 == columnCount) {
+ perror("data type error!");
+ exit(-1);
+ }
+ g_args.num_of_CPR = columnCount;
+
+ if (((arguments->debug_print) && (arguments->metaFile == NULL))
+ || arguments->verbose_print) {
+ printf("###################################################################\n");
+ printf("# meta file: %s\n", arguments->metaFile);
+ printf("# Server IP: %s:%hu\n",
+ arguments->host == NULL ? "localhost" : arguments->host,
+ arguments->port );
+ printf("# User: %s\n", arguments->user);
+ printf("# Password: %s\n", arguments->password);
+ printf("# Use metric: %s\n",
+ arguments->use_metric ? "true" : "false");
+ if (*(arguments->datatype)) {
+ printf("# Specified data type: ");
+ for (int i = 0; i < MAX_NUM_DATATYPE; i++)
+ if (arguments->datatype[i])
+ printf("%s,", arguments->datatype[i]);
+ else
+ break;
+ printf("\n");
}
- arguments->datatype[index] = NULL;
- }
- } else if (strcmp(argv[i], "-w") == 0) {
- if ((argc == i+1) ||
- (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-w need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->len_of_binary = atoi(argv[++i]);
- } else if (strcmp(argv[i], "-m") == 0) {
- if ((argc == i+1) ||
- (isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-m need a letter-initial string following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->tb_prefix = argv[++i];
- } else if (strcmp(argv[i], "-N") == 0) {
- arguments->use_metric = false;
- } else if (strcmp(argv[i], "-x") == 0) {
- arguments->insert_only = false;
- } else if (strcmp(argv[i], "-y") == 0) {
- arguments->answer_yes = true;
- } else if (strcmp(argv[i], "-g") == 0) {
- arguments->debug_print = true;
- } else if (strcmp(argv[i], "-gg") == 0) {
- arguments->verbose_print = true;
- } else if (strcmp(argv[i], "-pp") == 0) {
- arguments->performance_print = true;
- } else if (strcmp(argv[i], "-O") == 0) {
- if ((argc == i+1) ||
- (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-O need a number following!\n");
- exit(EXIT_FAILURE);
- }
+ printf("# Insertion interval: %"PRIu64"\n",
+ arguments->insert_interval);
+ printf("# Number of records per req: %u\n",
+ arguments->num_of_RPR);
+ printf("# Max SQL length: %"PRIu64"\n",
+ arguments->max_sql_len);
+ printf("# Length of Binary: %d\n", arguments->len_of_binary);
+ printf("# Number of Threads: %d\n", arguments->num_of_threads);
+ printf("# Number of Tables: %"PRId64"\n",
+ arguments->num_of_tables);
+ printf("# Number of Data per Table: %"PRId64"\n",
+ arguments->num_of_DPT);
+ printf("# Database name: %s\n", arguments->database);
+ printf("# Table prefix: %s\n", arguments->tb_prefix);
+ if (arguments->disorderRatio) {
+ printf("# Data order: %d\n", arguments->disorderRatio);
+ printf("# Data out of order rate: %d\n", arguments->disorderRange);
- arguments->disorderRatio = atoi(argv[++i]);
+ }
+ printf("# Delete method: %d\n", arguments->method_of_delete);
+ printf("# Answer yes when prompt: %d\n", arguments->answer_yes);
+ printf("# Print debug info: %d\n", arguments->debug_print);
+ printf("# Print verbose info: %d\n", arguments->verbose_print);
+ printf("###################################################################\n");
- if (arguments->disorderRatio > 50) {
- arguments->disorderRatio = 50;
- }
-
- if (arguments->disorderRatio < 0) {
- arguments->disorderRatio = 0;
- }
-
- } else if (strcmp(argv[i], "-R") == 0) {
- if ((argc == i+1) ||
- (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-R need a number following!\n");
- exit(EXIT_FAILURE);
- }
-
- arguments->disorderRange = atoi(argv[++i]);
- if (arguments->disorderRange < 0)
- arguments->disorderRange = 1000;
-
- } else if (strcmp(argv[i], "-a") == 0) {
- if ((argc == i+1) ||
- (!isStringNumber(argv[i+1]))) {
- printHelp();
- errorPrint("%s", "\n\t-a need a number following!\n");
- exit(EXIT_FAILURE);
- }
- arguments->replica = atoi(argv[++i]);
- if (arguments->replica > 3 || arguments->replica < 1) {
- arguments->replica = 1;
- }
- } else if (strcmp(argv[i], "-D") == 0) {
- arguments->method_of_delete = atoi(argv[++i]);
- if (arguments->method_of_delete > 3) {
- errorPrint("%s", "\n\t-D need a valud (0~3) number following!\n");
- exit(EXIT_FAILURE);
- }
- } else if ((strcmp(argv[i], "--version") == 0) ||
- (strcmp(argv[i], "-V") == 0)){
- printVersion();
- exit(0);
- } else if (strcmp(argv[i], "--help") == 0) {
- printHelp();
- exit(0);
- } else {
- printHelp();
- errorPrint("%s", "ERROR: wrong options\n");
- exit(EXIT_FAILURE);
+ prompt();
}
- }
-
- int columnCount;
- for (columnCount = 0; columnCount < MAX_NUM_DATATYPE; columnCount ++) {
- if (g_args.datatype[columnCount] == NULL) {
- break;
- }
- }
-
- if (0 == columnCount) {
- perror("data type error!");
- exit(-1);
- }
- g_args.num_of_CPR = columnCount;
-
- if (((arguments->debug_print) && (arguments->metaFile == NULL))
- || arguments->verbose_print) {
- printf("###################################################################\n");
- printf("# meta file: %s\n", arguments->metaFile);
- printf("# Server IP: %s:%hu\n",
- arguments->host == NULL ? "localhost" : arguments->host,
- arguments->port );
- printf("# User: %s\n", arguments->user);
- printf("# Password: %s\n", arguments->password);
- printf("# Use metric: %s\n",
- arguments->use_metric ? "true" : "false");
- if (*(arguments->datatype)) {
- printf("# Specified data type: ");
- for (int i = 0; i < MAX_NUM_DATATYPE; i++)
- if (arguments->datatype[i])
- printf("%s,", arguments->datatype[i]);
- else
- break;
- printf("\n");
- }
- printf("# Insertion interval: %"PRIu64"\n",
- arguments->insert_interval);
- printf("# Number of records per req: %u\n",
- arguments->num_of_RPR);
- printf("# Max SQL length: %"PRIu64"\n",
- arguments->max_sql_len);
- printf("# Length of Binary: %d\n", arguments->len_of_binary);
- printf("# Number of Threads: %d\n", arguments->num_of_threads);
- printf("# Number of Tables: %"PRId64"\n",
- arguments->num_of_tables);
- printf("# Number of Data per Table: %"PRId64"\n",
- arguments->num_of_DPT);
- printf("# Database name: %s\n", arguments->database);
- printf("# Table prefix: %s\n", arguments->tb_prefix);
- if (arguments->disorderRatio) {
- printf("# Data order: %d\n", arguments->disorderRatio);
- printf("# Data out of order rate: %d\n", arguments->disorderRange);
-
- }
- printf("# Delete method: %d\n", arguments->method_of_delete);
- printf("# Answer yes when prompt: %d\n", arguments->answer_yes);
- printf("# Print debug info: %d\n", arguments->debug_print);
- printf("# Print verbose info: %d\n", arguments->verbose_print);
- printf("###################################################################\n");
-
- prompt();
- }
}
-static bool getInfoFromJsonFile(char* file);
-static void init_rand_data();
static void tmfclose(FILE *fp) {
- if (NULL != fp) {
- fclose(fp);
- }
+ if (NULL != fp) {
+ fclose(fp);
+ }
}
static void tmfree(char *buf) {
- if (NULL != buf) {
- free(buf);
- }
+ if (NULL != buf) {
+ free(buf);
+ }
}
static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet) {
- int i;
- TAOS_RES *res = NULL;
- int32_t code = -1;
+ int i;
+ TAOS_RES *res = NULL;
+ int32_t code = -1;
- for (i = 0; i < 5 /* retry */; i++) {
- if (NULL != res) {
- taos_free_result(res);
- res = NULL;
+ for (i = 0; i < 5 /* retry */; i++) {
+ if (NULL != res) {
+ taos_free_result(res);
+ res = NULL;
+ }
+
+ res = taos_query(taos, command);
+ code = taos_errno(res);
+ if (0 == code) {
+ break;
+ }
}
- res = taos_query(taos, command);
- code = taos_errno(res);
- if (0 == code) {
- break;
+ verbosePrint("%s() LN%d - command: %s\n", __func__, __LINE__, command);
+ if (code != 0) {
+ if (!quiet) {
+ errorPrint("Failed to execute %s, reason: %s\n",
+ command, taos_errstr(res));
+ }
+ taos_free_result(res);
+ //taos_close(taos);
+ return -1;
}
- }
- verbosePrint("%s() LN%d - command: %s\n", __func__, __LINE__, command);
- if (code != 0) {
- if (!quiet) {
- errorPrint("Failed to execute %s, reason: %s\n",
- command, taos_errstr(res));
+ if (INSERT_TYPE == type) {
+ int affectedRows = taos_affected_rows(res);
+ taos_free_result(res);
+ return affectedRows;
}
+
taos_free_result(res);
- //taos_close(taos);
- return -1;
- }
-
- if (INSERT_TYPE == type) {
- int affectedRows = taos_affected_rows(res);
- taos_free_result(res);
- return affectedRows;
- }
-
- taos_free_result(res);
- return 0;
+ return 0;
}
static void appendResultBufToFile(char *resultBuf, threadInfo *pThreadInfo)
{
- pThreadInfo->fp = fopen(pThreadInfo->filePath, "at");
- if (pThreadInfo->fp == NULL) {
- errorPrint(
- "%s() LN%d, failed to open result file: %s, result will not save to file\n",
- __func__, __LINE__, pThreadInfo->filePath);
- return;
- }
+ pThreadInfo->fp = fopen(pThreadInfo->filePath, "at");
+ if (pThreadInfo->fp == NULL) {
+ errorPrint(
+ "%s() LN%d, failed to open result file: %s, result will not save to file\n",
+ __func__, __LINE__, pThreadInfo->filePath);
+ return;
+ }
- fprintf(pThreadInfo->fp, "%s", resultBuf);
- tmfclose(pThreadInfo->fp);
- pThreadInfo->fp = NULL;
+ fprintf(pThreadInfo->fp, "%s", resultBuf);
+ tmfclose(pThreadInfo->fp);
+ pThreadInfo->fp = NULL;
}
static void fetchResult(TAOS_RES *res, threadInfo* pThreadInfo) {
- TAOS_ROW row = NULL;
- int num_rows = 0;
- int num_fields = taos_field_count(res);
- TAOS_FIELD *fields = taos_fetch_fields(res);
+ TAOS_ROW row = NULL;
+ int num_rows = 0;
+ int num_fields = taos_field_count(res);
+ TAOS_FIELD *fields = taos_fetch_fields(res);
- char* databuf = (char*) calloc(1, 100*1024*1024);
- if (databuf == NULL) {
- errorPrint("%s() LN%d, failed to malloc, warning: save result to file slowly!\n",
- __func__, __LINE__);
- return ;
- }
-
- int64_t totalLen = 0;
-
- // fetch the records row by row
- while((row = taos_fetch_row(res))) {
- if (totalLen >= 100*1024*1024 - 32000) {
- if (strlen(pThreadInfo->filePath) > 0)
- appendResultBufToFile(databuf, pThreadInfo);
- totalLen = 0;
- memset(databuf, 0, 100*1024*1024);
+ char* databuf = (char*) calloc(1, 100*1024*1024);
+ if (databuf == NULL) {
+ errorPrint("%s() LN%d, failed to malloc, warning: save result to file slowly!\n",
+ __func__, __LINE__);
+ return ;
}
- num_rows++;
- char temp[16000] = {0};
- int len = taos_print_row(temp, row, fields, num_fields);
- len += sprintf(temp + len, "\n");
- //printf("query result:%s\n", temp);
- memcpy(databuf + totalLen, temp, len);
- totalLen += len;
- verbosePrint("%s() LN%d, totalLen: %"PRId64"\n", __func__, __LINE__, totalLen);
- }
- verbosePrint("%s() LN%d, databuf=%s resultFile=%s\n",
- __func__, __LINE__, databuf, pThreadInfo->filePath);
- if (strlen(pThreadInfo->filePath) > 0) {
- appendResultBufToFile(databuf, pThreadInfo);
- }
- free(databuf);
+ int64_t totalLen = 0;
+
+ // fetch the records row by row
+ while((row = taos_fetch_row(res))) {
+ if (totalLen >= 100*1024*1024 - 32000) {
+ if (strlen(pThreadInfo->filePath) > 0)
+ appendResultBufToFile(databuf, pThreadInfo);
+ totalLen = 0;
+ memset(databuf, 0, 100*1024*1024);
+ }
+ num_rows++;
+ char temp[16000] = {0};
+ int len = taos_print_row(temp, row, fields, num_fields);
+ len += sprintf(temp + len, "\n");
+ //printf("query result:%s\n", temp);
+ memcpy(databuf + totalLen, temp, len);
+ totalLen += len;
+ verbosePrint("%s() LN%d, totalLen: %"PRId64"\n",
+ __func__, __LINE__, totalLen);
+ }
+
+ verbosePrint("%s() LN%d, databuf=%s resultFile=%s\n",
+ __func__, __LINE__, databuf, pThreadInfo->filePath);
+ if (strlen(pThreadInfo->filePath) > 0) {
+ appendResultBufToFile(databuf, pThreadInfo);
+ }
+ free(databuf);
}
static void selectAndGetResult(
threadInfo *pThreadInfo, char *command)
{
- if (0 == strncasecmp(g_queryInfo.queryMode, "taosc", strlen("taosc"))) {
- TAOS_RES *res = taos_query(pThreadInfo->taos, command);
- if (res == NULL || taos_errno(res) != 0) {
- errorPrint("%s() LN%d, failed to execute sql:%s, reason:%s\n",
- __func__, __LINE__, command, taos_errstr(res));
+ if (0 == strncasecmp(g_queryInfo.queryMode, "taosc", strlen("taosc"))) {
+ TAOS_RES *res = taos_query(pThreadInfo->taos, command);
+ if (res == NULL || taos_errno(res) != 0) {
+ errorPrint("%s() LN%d, failed to execute sql:%s, reason:%s\n",
+ __func__, __LINE__, command, taos_errstr(res));
+ taos_free_result(res);
+ return;
+ }
+
+ fetchResult(res, pThreadInfo);
taos_free_result(res);
- return;
+
+ } else if (0 == strncasecmp(g_queryInfo.queryMode, "rest", strlen("rest"))) {
+ int retCode = postProceSql(
+ g_queryInfo.host, &(g_queryInfo.serv_addr), g_queryInfo.port,
+ command,
+ pThreadInfo);
+ if (0 != retCode) {
+ printf("====restful return fail, threadID[%d]\n", pThreadInfo->threadID);
+ }
+
+ } else {
+ errorPrint("%s() LN%d, unknown query mode: %s\n",
+ __func__, __LINE__, g_queryInfo.queryMode);
}
-
- fetchResult(res, pThreadInfo);
- taos_free_result(res);
-
- } else if (0 == strncasecmp(g_queryInfo.queryMode, "rest", strlen("rest"))) {
- int retCode = postProceSql(
- g_queryInfo.host, &(g_queryInfo.serv_addr), g_queryInfo.port,
- command,
- pThreadInfo);
- if (0 != retCode) {
- printf("====restful return fail, threadID[%d]\n", pThreadInfo->threadID);
- }
-
- } else {
- errorPrint("%s() LN%d, unknown query mode: %s\n",
- __func__, __LINE__, g_queryInfo.queryMode);
- }
}
static int32_t rand_bool(){
- static int cursor;
- cursor++;
- cursor = cursor % MAX_PREPARED_RAND;
- return randint[cursor] % 2;
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return randint[cursor] % 2;
}
static int32_t rand_tinyint(){
- static int cursor;
- cursor++;
- cursor = cursor % MAX_PREPARED_RAND;
- return randint[cursor] % 128;
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return randint[cursor] % 128;
}
static int32_t rand_smallint(){
- static int cursor;
- cursor++;
- cursor = cursor % MAX_PREPARED_RAND;
- return randint[cursor] % 32767;
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return randint[cursor] % 32767;
}
static int32_t rand_int(){
- static int cursor;
- cursor++;
- cursor = cursor % MAX_PREPARED_RAND;
- return randint[cursor];
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return randint[cursor];
}
static int64_t rand_bigint(){
- static int cursor;
- cursor++;
- cursor = cursor % MAX_PREPARED_RAND;
- return randbigint[cursor];
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return randbigint[cursor];
}
static float rand_float(){
- static int cursor;
- cursor++;
- cursor = cursor % MAX_PREPARED_RAND;
- return randfloat[cursor];
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return randfloat[cursor];
+}
+
+static float demo_current_float(){
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return (float)(9.8 + 0.04 * (randint[cursor] % 10) + randfloat[cursor]/1000000000);
+}
+
+static int32_t demo_voltage_int(){
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return 215 + randint[cursor] % 10;
+}
+
+static float demo_phase_float(){
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return (float)((115 + randint[cursor] % 10 + randfloat[cursor]/1000000000)/360);
}
#if 0
@@ -1334,33 +1368,32 @@ static void nonrand_string(char *str, int size)
static const char charset[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
static void rand_string(char *str, int size) {
- str[0] = 0;
- if (size > 0) {
- //--size;
- int n;
- for (n = 0; n < size; n++) {
- int key = abs(rand_tinyint()) % (int)(sizeof(charset) - 1);
- str[n] = charset[key];
+ str[0] = 0;
+ if (size > 0) {
+ //--size;
+ int n;
+ for (n = 0; n < size; n++) {
+ int key = abs(rand_tinyint()) % (int)(sizeof(charset) - 1);
+ str[n] = charset[key];
+ }
+ str[n] = 0;
}
- str[n] = 0;
- }
}
static double rand_double() {
- static int cursor;
- cursor++;
- cursor = cursor % MAX_PREPARED_RAND;
- return randdouble[cursor];
-
+ static int cursor;
+ cursor++;
+ cursor = cursor % MAX_PREPARED_RAND;
+ return randdouble[cursor];
}
static void init_rand_data() {
- for (int i = 0; i < MAX_PREPARED_RAND; i++){
- randint[i] = (int)(taosRandom() % 65535);
- randbigint[i] = (int64_t)(taosRandom() % 2147483648);
- randfloat[i] = (float)(taosRandom() / 1000.0);
- randdouble[i] = (double)(taosRandom() / 1000000.0);
- }
+ for (int i = 0; i < MAX_PREPARED_RAND; i++){
+ randint[i] = (int)(taosRandom() % 65535);
+ randbigint[i] = (int64_t)(taosRandom() % 2147483648);
+ randfloat[i] = (float)(taosRandom() / 1000.0);
+ randdouble[i] = (double)(taosRandom() / 1000000.0);
+ }
}
#define SHOW_PARSE_RESULT_START() \
@@ -1386,759 +1419,767 @@ static void init_rand_data() {
static int printfInsertMeta() {
SHOW_PARSE_RESULT_START();
- printf("interface: \033[33m%s\033[0m\n",
- (g_args.iface==TAOSC_IFACE)?"taosc":(g_args.iface==REST_IFACE)?"rest":"stmt");
- printf("host: \033[33m%s:%u\033[0m\n",
- g_Dbs.host, g_Dbs.port);
- printf("user: \033[33m%s\033[0m\n", g_Dbs.user);
- printf("password: \033[33m%s\033[0m\n", g_Dbs.password);
- printf("configDir: \033[33m%s\033[0m\n", configDir);
- printf("resultFile: \033[33m%s\033[0m\n", g_Dbs.resultFile);
- printf("thread num of insert data: \033[33m%d\033[0m\n", g_Dbs.threadCount);
- printf("thread num of create table: \033[33m%d\033[0m\n",
- g_Dbs.threadCountByCreateTbl);
- printf("top insert interval: \033[33m%"PRIu64"\033[0m\n",
- g_args.insert_interval);
- printf("number of records per req: \033[33m%u\033[0m\n",
- g_args.num_of_RPR);
- printf("max sql length: \033[33m%"PRIu64"\033[0m\n",
- g_args.max_sql_len);
+ if (g_args.demo_mode)
+ printf("\ntaosdemo is simulating data generated by power equipments monitoring...\n\n");
+ else
+ printf("\ntaosdemo is simulating random data as you request..\n\n");
- printf("database count: \033[33m%d\033[0m\n", g_Dbs.dbCount);
+ printf("interface: \033[33m%s\033[0m\n",
+ (g_args.iface==TAOSC_IFACE)?"taosc":(g_args.iface==REST_IFACE)?"rest":"stmt");
+ printf("host: \033[33m%s:%u\033[0m\n",
+ g_Dbs.host, g_Dbs.port);
+ printf("user: \033[33m%s\033[0m\n", g_Dbs.user);
+ printf("password: \033[33m%s\033[0m\n", g_Dbs.password);
+ printf("configDir: \033[33m%s\033[0m\n", configDir);
+ printf("resultFile: \033[33m%s\033[0m\n", g_Dbs.resultFile);
+ printf("thread num of insert data: \033[33m%d\033[0m\n", g_Dbs.threadCount);
+ printf("thread num of create table: \033[33m%d\033[0m\n",
+ g_Dbs.threadCountByCreateTbl);
+ printf("top insert interval: \033[33m%"PRIu64"\033[0m\n",
+ g_args.insert_interval);
+ printf("number of records per req: \033[33m%u\033[0m\n",
+ g_args.num_of_RPR);
+ printf("max sql length: \033[33m%"PRIu64"\033[0m\n",
+ g_args.max_sql_len);
- for (int i = 0; i < g_Dbs.dbCount; i++) {
- printf("database[\033[33m%d\033[0m]:\n", i);
- printf(" database[%d] name: \033[33m%s\033[0m\n",
- i, g_Dbs.db[i].dbName);
- if (0 == g_Dbs.db[i].drop) {
- printf(" drop: \033[33mno\033[0m\n");
- } else {
- printf(" drop: \033[33myes\033[0m\n");
- }
+ printf("database count: \033[33m%d\033[0m\n", g_Dbs.dbCount);
- if (g_Dbs.db[i].dbCfg.blocks > 0) {
- printf(" blocks: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.blocks);
- }
- if (g_Dbs.db[i].dbCfg.cache > 0) {
- printf(" cache: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.cache);
- }
- if (g_Dbs.db[i].dbCfg.days > 0) {
- printf(" days: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.days);
- }
- if (g_Dbs.db[i].dbCfg.keep > 0) {
- printf(" keep: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.keep);
- }
- if (g_Dbs.db[i].dbCfg.replica > 0) {
- printf(" replica: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.replica);
- }
- if (g_Dbs.db[i].dbCfg.update > 0) {
- printf(" update: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.update);
- }
- if (g_Dbs.db[i].dbCfg.minRows > 0) {
- printf(" minRows: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.minRows);
- }
- if (g_Dbs.db[i].dbCfg.maxRows > 0) {
- printf(" maxRows: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.maxRows);
- }
- if (g_Dbs.db[i].dbCfg.comp > 0) {
- printf(" comp: \033[33m%d\033[0m\n", g_Dbs.db[i].dbCfg.comp);
- }
- if (g_Dbs.db[i].dbCfg.walLevel > 0) {
- printf(" walLevel: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.walLevel);
- }
- if (g_Dbs.db[i].dbCfg.fsync > 0) {
- printf(" fsync: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.fsync);
- }
- if (g_Dbs.db[i].dbCfg.quorum > 0) {
- printf(" quorum: \033[33m%d\033[0m\n",
- g_Dbs.db[i].dbCfg.quorum);
- }
- if (g_Dbs.db[i].dbCfg.precision[0] != 0) {
- if ((0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "ms", 2))
- || (0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "us", 2))) {
- printf(" precision: \033[33m%s\033[0m\n",
- g_Dbs.db[i].dbCfg.precision);
- } else {
- printf("\033[1m\033[40;31m precision error: %s\033[0m\n",
- g_Dbs.db[i].dbCfg.precision);
- return -1;
- }
- }
-
- printf(" super table count: \033[33m%"PRIu64"\033[0m\n",
- g_Dbs.db[i].superTblCount);
- for (uint64_t j = 0; j < g_Dbs.db[i].superTblCount; j++) {
- printf(" super table[\033[33m%"PRIu64"\033[0m]:\n", j);
-
- printf(" stbName: \033[33m%s\033[0m\n",
- g_Dbs.db[i].superTbls[j].sTblName);
-
- if (PRE_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable) {
- printf(" autoCreateTable: \033[33m%s\033[0m\n", "no");
- } else if (AUTO_CREATE_SUBTBL ==
- g_Dbs.db[i].superTbls[j].autoCreateTable) {
- printf(" autoCreateTable: \033[33m%s\033[0m\n", "yes");
- } else {
- printf(" autoCreateTable: \033[33m%s\033[0m\n", "error");
- }
-
- if (TBL_NO_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
- printf(" childTblExists: \033[33m%s\033[0m\n", "no");
- } else if (TBL_ALREADY_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
- printf(" childTblExists: \033[33m%s\033[0m\n", "yes");
- } else {
- printf(" childTblExists: \033[33m%s\033[0m\n", "error");
- }
-
- printf(" childTblCount: \033[33m%"PRId64"\033[0m\n",
- g_Dbs.db[i].superTbls[j].childTblCount);
- printf(" childTblPrefix: \033[33m%s\033[0m\n",
- g_Dbs.db[i].superTbls[j].childTblPrefix);
- printf(" dataSource: \033[33m%s\033[0m\n",
- g_Dbs.db[i].superTbls[j].dataSource);
- printf(" iface: \033[33m%s\033[0m\n",
- (g_Dbs.db[i].superTbls[j].iface==TAOSC_IFACE)?"taosc":
- (g_Dbs.db[i].superTbls[j].iface==REST_IFACE)?"rest":"stmt");
- if (g_Dbs.db[i].superTbls[j].childTblLimit > 0) {
- printf(" childTblLimit: \033[33m%"PRId64"\033[0m\n",
- g_Dbs.db[i].superTbls[j].childTblLimit);
- }
- if (g_Dbs.db[i].superTbls[j].childTblOffset > 0) {
- printf(" childTblOffset: \033[33m%"PRIu64"\033[0m\n",
- g_Dbs.db[i].superTbls[j].childTblOffset);
- }
- printf(" insertRows: \033[33m%"PRId64"\033[0m\n",
- g_Dbs.db[i].superTbls[j].insertRows);
-/*
- if (0 == g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl) {
- printf(" multiThreadWriteOneTbl: \033[33mno\033[0m\n");
- }else {
- printf(" multiThreadWriteOneTbl: \033[33myes\033[0m\n");
- }
- */
- printf(" interlaceRows: \033[33m%u\033[0m\n",
- g_Dbs.db[i].superTbls[j].interlaceRows);
-
- if (g_Dbs.db[i].superTbls[j].interlaceRows > 0) {
- printf(" stable insert interval: \033[33m%"PRIu64"\033[0m\n",
- g_Dbs.db[i].superTbls[j].insertInterval);
- }
-
- printf(" disorderRange: \033[33m%d\033[0m\n",
- g_Dbs.db[i].superTbls[j].disorderRange);
- printf(" disorderRatio: \033[33m%d\033[0m\n",
- g_Dbs.db[i].superTbls[j].disorderRatio);
- printf(" maxSqlLen: \033[33m%"PRIu64"\033[0m\n",
- g_Dbs.db[i].superTbls[j].maxSqlLen);
- printf(" timeStampStep: \033[33m%"PRId64"\033[0m\n",
- g_Dbs.db[i].superTbls[j].timeStampStep);
- printf(" startTimestamp: \033[33m%s\033[0m\n",
- g_Dbs.db[i].superTbls[j].startTimestamp);
- printf(" sampleFormat: \033[33m%s\033[0m\n",
- g_Dbs.db[i].superTbls[j].sampleFormat);
- printf(" sampleFile: \033[33m%s\033[0m\n",
- g_Dbs.db[i].superTbls[j].sampleFile);
- printf(" tagsFile: \033[33m%s\033[0m\n",
- g_Dbs.db[i].superTbls[j].tagsFile);
- printf(" columnCount: \033[33m%d\033[0m\n",
- g_Dbs.db[i].superTbls[j].columnCount);
- for (int k = 0; k < g_Dbs.db[i].superTbls[j].columnCount; k++) {
- //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].columns[k].dataType, g_Dbs.db[i].superTbls[j].columns[k].dataLen);
- if ((0 == strncasecmp(g_Dbs.db[i].superTbls[j].columns[k].dataType,
- "binary", 6))
- || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].columns[k].dataType,
- "nchar", 5))) {
- printf("column[\033[33m%d\033[0m]:\033[33m%s(%d)\033[0m ", k,
- g_Dbs.db[i].superTbls[j].columns[k].dataType,
- g_Dbs.db[i].superTbls[j].columns[k].dataLen);
+ for (int i = 0; i < g_Dbs.dbCount; i++) {
+ printf("database[\033[33m%d\033[0m]:\n", i);
+ printf(" database[%d] name: \033[33m%s\033[0m\n",
+ i, g_Dbs.db[i].dbName);
+ if (0 == g_Dbs.db[i].drop) {
+ printf(" drop: \033[33mno\033[0m\n");
} else {
- printf("column[%d]:\033[33m%s\033[0m ", k,
- g_Dbs.db[i].superTbls[j].columns[k].dataType);
+ printf(" drop: \033[33myes\033[0m\n");
}
- }
- printf("\n");
- printf(" tagCount: \033[33m%d\033[0m\n ",
- g_Dbs.db[i].superTbls[j].tagCount);
- for (int k = 0; k < g_Dbs.db[i].superTbls[j].tagCount; k++) {
- //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].tags[k].dataType, g_Dbs.db[i].superTbls[j].tags[k].dataLen);
- if ((0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType,
- "binary", strlen("binary")))
- || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType,
- "nchar", strlen("nchar")))) {
- printf("tag[%d]:\033[33m%s(%d)\033[0m ", k,
- g_Dbs.db[i].superTbls[j].tags[k].dataType,
- g_Dbs.db[i].superTbls[j].tags[k].dataLen);
- } else {
- printf("tag[%d]:\033[33m%s\033[0m ", k,
- g_Dbs.db[i].superTbls[j].tags[k].dataType);
+ if (g_Dbs.db[i].dbCfg.blocks > 0) {
+ printf(" blocks: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.blocks);
}
- }
- printf("\n");
+ if (g_Dbs.db[i].dbCfg.cache > 0) {
+ printf(" cache: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.cache);
+ }
+ if (g_Dbs.db[i].dbCfg.days > 0) {
+ printf(" days: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.days);
+ }
+ if (g_Dbs.db[i].dbCfg.keep > 0) {
+ printf(" keep: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.keep);
+ }
+ if (g_Dbs.db[i].dbCfg.replica > 0) {
+ printf(" replica: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.replica);
+ }
+ if (g_Dbs.db[i].dbCfg.update > 0) {
+ printf(" update: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.update);
+ }
+ if (g_Dbs.db[i].dbCfg.minRows > 0) {
+ printf(" minRows: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.minRows);
+ }
+ if (g_Dbs.db[i].dbCfg.maxRows > 0) {
+ printf(" maxRows: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.maxRows);
+ }
+ if (g_Dbs.db[i].dbCfg.comp > 0) {
+ printf(" comp: \033[33m%d\033[0m\n", g_Dbs.db[i].dbCfg.comp);
+ }
+ if (g_Dbs.db[i].dbCfg.walLevel > 0) {
+ printf(" walLevel: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.walLevel);
+ }
+ if (g_Dbs.db[i].dbCfg.fsync > 0) {
+ printf(" fsync: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.fsync);
+ }
+ if (g_Dbs.db[i].dbCfg.quorum > 0) {
+ printf(" quorum: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].dbCfg.quorum);
+ }
+ if (g_Dbs.db[i].dbCfg.precision[0] != 0) {
+ if ((0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "ms", 2))
+ || (0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "us", 2))) {
+ printf(" precision: \033[33m%s\033[0m\n",
+ g_Dbs.db[i].dbCfg.precision);
+ } else {
+ printf("\033[1m\033[40;31m precision error: %s\033[0m\n",
+ g_Dbs.db[i].dbCfg.precision);
+ return -1;
+ }
+ }
+
+ printf(" super table count: \033[33m%"PRIu64"\033[0m\n",
+ g_Dbs.db[i].superTblCount);
+ for (uint64_t j = 0; j < g_Dbs.db[i].superTblCount; j++) {
+ printf(" super table[\033[33m%"PRIu64"\033[0m]:\n", j);
+
+ printf(" stbName: \033[33m%s\033[0m\n",
+ g_Dbs.db[i].superTbls[j].sTblName);
+
+ if (PRE_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable) {
+ printf(" autoCreateTable: \033[33m%s\033[0m\n", "no");
+ } else if (AUTO_CREATE_SUBTBL ==
+ g_Dbs.db[i].superTbls[j].autoCreateTable) {
+ printf(" autoCreateTable: \033[33m%s\033[0m\n", "yes");
+ } else {
+ printf(" autoCreateTable: \033[33m%s\033[0m\n", "error");
+ }
+
+ if (TBL_NO_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
+ printf(" childTblExists: \033[33m%s\033[0m\n", "no");
+ } else if (TBL_ALREADY_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
+ printf(" childTblExists: \033[33m%s\033[0m\n", "yes");
+ } else {
+ printf(" childTblExists: \033[33m%s\033[0m\n", "error");
+ }
+
+ printf(" childTblCount: \033[33m%"PRId64"\033[0m\n",
+ g_Dbs.db[i].superTbls[j].childTblCount);
+ printf(" childTblPrefix: \033[33m%s\033[0m\n",
+ g_Dbs.db[i].superTbls[j].childTblPrefix);
+ printf(" dataSource: \033[33m%s\033[0m\n",
+ g_Dbs.db[i].superTbls[j].dataSource);
+ printf(" iface: \033[33m%s\033[0m\n",
+ (g_Dbs.db[i].superTbls[j].iface==TAOSC_IFACE)?"taosc":
+ (g_Dbs.db[i].superTbls[j].iface==REST_IFACE)?"rest":"stmt");
+ if (g_Dbs.db[i].superTbls[j].childTblLimit > 0) {
+ printf(" childTblLimit: \033[33m%"PRId64"\033[0m\n",
+ g_Dbs.db[i].superTbls[j].childTblLimit);
+ }
+ if (g_Dbs.db[i].superTbls[j].childTblOffset > 0) {
+ printf(" childTblOffset: \033[33m%"PRIu64"\033[0m\n",
+ g_Dbs.db[i].superTbls[j].childTblOffset);
+ }
+ printf(" insertRows: \033[33m%"PRId64"\033[0m\n",
+ g_Dbs.db[i].superTbls[j].insertRows);
+ /*
+ if (0 == g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl) {
+ printf(" multiThreadWriteOneTbl: \033[33mno\033[0m\n");
+ }else {
+ printf(" multiThreadWriteOneTbl: \033[33myes\033[0m\n");
+ }
+ */
+ printf(" interlaceRows: \033[33m%u\033[0m\n",
+ g_Dbs.db[i].superTbls[j].interlaceRows);
+
+ if (g_Dbs.db[i].superTbls[j].interlaceRows > 0) {
+ printf(" stable insert interval: \033[33m%"PRIu64"\033[0m\n",
+ g_Dbs.db[i].superTbls[j].insertInterval);
+ }
+
+ printf(" disorderRange: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].superTbls[j].disorderRange);
+ printf(" disorderRatio: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].superTbls[j].disorderRatio);
+ printf(" maxSqlLen: \033[33m%"PRIu64"\033[0m\n",
+ g_Dbs.db[i].superTbls[j].maxSqlLen);
+ printf(" timeStampStep: \033[33m%"PRId64"\033[0m\n",
+ g_Dbs.db[i].superTbls[j].timeStampStep);
+ printf(" startTimestamp: \033[33m%s\033[0m\n",
+ g_Dbs.db[i].superTbls[j].startTimestamp);
+ printf(" sampleFormat: \033[33m%s\033[0m\n",
+ g_Dbs.db[i].superTbls[j].sampleFormat);
+ printf(" sampleFile: \033[33m%s\033[0m\n",
+ g_Dbs.db[i].superTbls[j].sampleFile);
+ printf(" tagsFile: \033[33m%s\033[0m\n",
+ g_Dbs.db[i].superTbls[j].tagsFile);
+ printf(" columnCount: \033[33m%d\033[0m\n",
+ g_Dbs.db[i].superTbls[j].columnCount);
+ for (int k = 0; k < g_Dbs.db[i].superTbls[j].columnCount; k++) {
+ //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].columns[k].dataType, g_Dbs.db[i].superTbls[j].columns[k].dataLen);
+ if ((0 == strncasecmp(g_Dbs.db[i].superTbls[j].columns[k].dataType,
+ "binary", 6))
+ || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].columns[k].dataType,
+ "nchar", 5))) {
+ printf("column[\033[33m%d\033[0m]:\033[33m%s(%d)\033[0m ", k,
+ g_Dbs.db[i].superTbls[j].columns[k].dataType,
+ g_Dbs.db[i].superTbls[j].columns[k].dataLen);
+ } else {
+ printf("column[%d]:\033[33m%s\033[0m ", k,
+ g_Dbs.db[i].superTbls[j].columns[k].dataType);
+ }
+ }
+ printf("\n");
+
+ printf(" tagCount: \033[33m%d\033[0m\n ",
+ g_Dbs.db[i].superTbls[j].tagCount);
+ for (int k = 0; k < g_Dbs.db[i].superTbls[j].tagCount; k++) {
+ //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].tags[k].dataType, g_Dbs.db[i].superTbls[j].tags[k].dataLen);
+ if ((0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType,
+ "binary", strlen("binary")))
+ || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType,
+ "nchar", strlen("nchar")))) {
+ printf("tag[%d]:\033[33m%s(%d)\033[0m ", k,
+ g_Dbs.db[i].superTbls[j].tags[k].dataType,
+ g_Dbs.db[i].superTbls[j].tags[k].dataLen);
+ } else {
+ printf("tag[%d]:\033[33m%s\033[0m ", k,
+ g_Dbs.db[i].superTbls[j].tags[k].dataType);
+ }
+ }
+ printf("\n");
+ }
+ printf("\n");
}
- printf("\n");
- }
- SHOW_PARSE_RESULT_END();
+ SHOW_PARSE_RESULT_END();
- return 0;
+ return 0;
}
static void printfInsertMetaToFile(FILE* fp) {
- SHOW_PARSE_RESULT_START_TO_FILE(fp);
+ SHOW_PARSE_RESULT_START_TO_FILE(fp);
- fprintf(fp, "host: %s:%u\n", g_Dbs.host, g_Dbs.port);
- fprintf(fp, "user: %s\n", g_Dbs.user);
- fprintf(fp, "configDir: %s\n", configDir);
- fprintf(fp, "resultFile: %s\n", g_Dbs.resultFile);
- fprintf(fp, "thread num of insert data: %d\n", g_Dbs.threadCount);
- fprintf(fp, "thread num of create table: %d\n", g_Dbs.threadCountByCreateTbl);
- fprintf(fp, "number of records per req: %u\n", g_args.num_of_RPR);
- fprintf(fp, "max sql length: %"PRIu64"\n", g_args.max_sql_len);
- fprintf(fp, "database count: %d\n", g_Dbs.dbCount);
+ fprintf(fp, "host: %s:%u\n", g_Dbs.host, g_Dbs.port);
+ fprintf(fp, "user: %s\n", g_Dbs.user);
+ fprintf(fp, "configDir: %s\n", configDir);
+ fprintf(fp, "resultFile: %s\n", g_Dbs.resultFile);
+ fprintf(fp, "thread num of insert data: %d\n", g_Dbs.threadCount);
+ fprintf(fp, "thread num of create table: %d\n", g_Dbs.threadCountByCreateTbl);
+ fprintf(fp, "number of records per req: %u\n", g_args.num_of_RPR);
+ fprintf(fp, "max sql length: %"PRIu64"\n", g_args.max_sql_len);
+ fprintf(fp, "database count: %d\n", g_Dbs.dbCount);
- for (int i = 0; i < g_Dbs.dbCount; i++) {
- fprintf(fp, "database[%d]:\n", i);
- fprintf(fp, " database[%d] name: %s\n", i, g_Dbs.db[i].dbName);
- if (0 == g_Dbs.db[i].drop) {
- fprintf(fp, " drop: no\n");
- }else {
- fprintf(fp, " drop: yes\n");
- }
-
- if (g_Dbs.db[i].dbCfg.blocks > 0) {
- fprintf(fp, " blocks: %d\n", g_Dbs.db[i].dbCfg.blocks);
- }
- if (g_Dbs.db[i].dbCfg.cache > 0) {
- fprintf(fp, " cache: %d\n", g_Dbs.db[i].dbCfg.cache);
- }
- if (g_Dbs.db[i].dbCfg.days > 0) {
- fprintf(fp, " days: %d\n", g_Dbs.db[i].dbCfg.days);
- }
- if (g_Dbs.db[i].dbCfg.keep > 0) {
- fprintf(fp, " keep: %d\n", g_Dbs.db[i].dbCfg.keep);
- }
- if (g_Dbs.db[i].dbCfg.replica > 0) {
- fprintf(fp, " replica: %d\n", g_Dbs.db[i].dbCfg.replica);
- }
- if (g_Dbs.db[i].dbCfg.update > 0) {
- fprintf(fp, " update: %d\n", g_Dbs.db[i].dbCfg.update);
- }
- if (g_Dbs.db[i].dbCfg.minRows > 0) {
- fprintf(fp, " minRows: %d\n", g_Dbs.db[i].dbCfg.minRows);
- }
- if (g_Dbs.db[i].dbCfg.maxRows > 0) {
- fprintf(fp, " maxRows: %d\n", g_Dbs.db[i].dbCfg.maxRows);
- }
- if (g_Dbs.db[i].dbCfg.comp > 0) {
- fprintf(fp, " comp: %d\n", g_Dbs.db[i].dbCfg.comp);
- }
- if (g_Dbs.db[i].dbCfg.walLevel > 0) {
- fprintf(fp, " walLevel: %d\n", g_Dbs.db[i].dbCfg.walLevel);
- }
- if (g_Dbs.db[i].dbCfg.fsync > 0) {
- fprintf(fp, " fsync: %d\n", g_Dbs.db[i].dbCfg.fsync);
- }
- if (g_Dbs.db[i].dbCfg.quorum > 0) {
- fprintf(fp, " quorum: %d\n", g_Dbs.db[i].dbCfg.quorum);
- }
- if (g_Dbs.db[i].dbCfg.precision[0] != 0) {
- if ((0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "ms", 2))
- || (0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "us", 2))) {
- fprintf(fp, " precision: %s\n",
- g_Dbs.db[i].dbCfg.precision);
- } else {
- fprintf(fp, " precision error: %s\n",
- g_Dbs.db[i].dbCfg.precision);
- }
- }
-
- fprintf(fp, " super table count: %"PRIu64"\n",
- g_Dbs.db[i].superTblCount);
- for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) {
- fprintf(fp, " super table[%d]:\n", j);
-
- fprintf(fp, " stbName: %s\n",
- g_Dbs.db[i].superTbls[j].sTblName);
-
- if (PRE_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable) {
- fprintf(fp, " autoCreateTable: %s\n", "no");
- } else if (AUTO_CREATE_SUBTBL
- == g_Dbs.db[i].superTbls[j].autoCreateTable) {
- fprintf(fp, " autoCreateTable: %s\n", "yes");
- } else {
- fprintf(fp, " autoCreateTable: %s\n", "error");
- }
-
- if (TBL_NO_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
- fprintf(fp, " childTblExists: %s\n", "no");
- } else if (TBL_ALREADY_EXISTS
- == g_Dbs.db[i].superTbls[j].childTblExists) {
- fprintf(fp, " childTblExists: %s\n", "yes");
- } else {
- fprintf(fp, " childTblExists: %s\n", "error");
- }
-
- fprintf(fp, " childTblCount: %"PRId64"\n",
- g_Dbs.db[i].superTbls[j].childTblCount);
- fprintf(fp, " childTblPrefix: %s\n",
- g_Dbs.db[i].superTbls[j].childTblPrefix);
- fprintf(fp, " dataSource: %s\n",
- g_Dbs.db[i].superTbls[j].dataSource);
- fprintf(fp, " iface: %s\n",
- (g_Dbs.db[i].superTbls[j].iface==TAOSC_IFACE)?"taosc":
- (g_Dbs.db[i].superTbls[j].iface==REST_IFACE)?"rest":"stmt");
- fprintf(fp, " insertRows: %"PRId64"\n",
- g_Dbs.db[i].superTbls[j].insertRows);
- fprintf(fp, " interlace rows: %u\n",
- g_Dbs.db[i].superTbls[j].interlaceRows);
- if (g_Dbs.db[i].superTbls[j].interlaceRows > 0) {
- fprintf(fp, " stable insert interval: %"PRIu64"\n",
- g_Dbs.db[i].superTbls[j].insertInterval);
- }
-/*
- if (0 == g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl) {
- fprintf(fp, " multiThreadWriteOneTbl: no\n");
- }else {
- fprintf(fp, " multiThreadWriteOneTbl: yes\n");
- }
- */
- fprintf(fp, " interlaceRows: %u\n",
- g_Dbs.db[i].superTbls[j].interlaceRows);
- fprintf(fp, " disorderRange: %d\n",
- g_Dbs.db[i].superTbls[j].disorderRange);
- fprintf(fp, " disorderRatio: %d\n",
- g_Dbs.db[i].superTbls[j].disorderRatio);
- fprintf(fp, " maxSqlLen: %"PRIu64"\n",
- g_Dbs.db[i].superTbls[j].maxSqlLen);
-
- fprintf(fp, " timeStampStep: %"PRId64"\n",
- g_Dbs.db[i].superTbls[j].timeStampStep);
- fprintf(fp, " startTimestamp: %s\n",
- g_Dbs.db[i].superTbls[j].startTimestamp);
- fprintf(fp, " sampleFormat: %s\n",
- g_Dbs.db[i].superTbls[j].sampleFormat);
- fprintf(fp, " sampleFile: %s\n",
- g_Dbs.db[i].superTbls[j].sampleFile);
- fprintf(fp, " tagsFile: %s\n",
- g_Dbs.db[i].superTbls[j].tagsFile);
-
- fprintf(fp, " columnCount: %d\n ",
- g_Dbs.db[i].superTbls[j].columnCount);
- for (int k = 0; k < g_Dbs.db[i].superTbls[j].columnCount; k++) {
- //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].columns[k].dataType, g_Dbs.db[i].superTbls[j].columns[k].dataLen);
- if ((0 == strncasecmp(
- g_Dbs.db[i].superTbls[j].columns[k].dataType,
- "binary", strlen("binary")))
- || (0 == strncasecmp(
- g_Dbs.db[i].superTbls[j].columns[k].dataType,
- "nchar", strlen("nchar")))) {
- fprintf(fp, "column[%d]:%s(%d) ", k,
- g_Dbs.db[i].superTbls[j].columns[k].dataType,
- g_Dbs.db[i].superTbls[j].columns[k].dataLen);
- } else {
- fprintf(fp, "column[%d]:%s ",
- k, g_Dbs.db[i].superTbls[j].columns[k].dataType);
+ for (int i = 0; i < g_Dbs.dbCount; i++) {
+ fprintf(fp, "database[%d]:\n", i);
+ fprintf(fp, " database[%d] name: %s\n", i, g_Dbs.db[i].dbName);
+ if (0 == g_Dbs.db[i].drop) {
+ fprintf(fp, " drop: no\n");
+ }else {
+ fprintf(fp, " drop: yes\n");
}
- }
- fprintf(fp, "\n");
- fprintf(fp, " tagCount: %d\n ",
- g_Dbs.db[i].superTbls[j].tagCount);
- for (int k = 0; k < g_Dbs.db[i].superTbls[j].tagCount; k++) {
- //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].tags[k].dataType, g_Dbs.db[i].superTbls[j].tags[k].dataLen);
- if ((0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType,
- "binary", strlen("binary")))
- || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType,
- "nchar", strlen("nchar")))) {
- fprintf(fp, "tag[%d]:%s(%d) ",
- k, g_Dbs.db[i].superTbls[j].tags[k].dataType,
- g_Dbs.db[i].superTbls[j].tags[k].dataLen);
- } else {
- fprintf(fp, "tag[%d]:%s ", k, g_Dbs.db[i].superTbls[j].tags[k].dataType);
+ if (g_Dbs.db[i].dbCfg.blocks > 0) {
+ fprintf(fp, " blocks: %d\n", g_Dbs.db[i].dbCfg.blocks);
+ }
+ if (g_Dbs.db[i].dbCfg.cache > 0) {
+ fprintf(fp, " cache: %d\n", g_Dbs.db[i].dbCfg.cache);
+ }
+ if (g_Dbs.db[i].dbCfg.days > 0) {
+ fprintf(fp, " days: %d\n", g_Dbs.db[i].dbCfg.days);
+ }
+ if (g_Dbs.db[i].dbCfg.keep > 0) {
+ fprintf(fp, " keep: %d\n", g_Dbs.db[i].dbCfg.keep);
+ }
+ if (g_Dbs.db[i].dbCfg.replica > 0) {
+ fprintf(fp, " replica: %d\n", g_Dbs.db[i].dbCfg.replica);
+ }
+ if (g_Dbs.db[i].dbCfg.update > 0) {
+ fprintf(fp, " update: %d\n", g_Dbs.db[i].dbCfg.update);
+ }
+ if (g_Dbs.db[i].dbCfg.minRows > 0) {
+ fprintf(fp, " minRows: %d\n", g_Dbs.db[i].dbCfg.minRows);
+ }
+ if (g_Dbs.db[i].dbCfg.maxRows > 0) {
+ fprintf(fp, " maxRows: %d\n", g_Dbs.db[i].dbCfg.maxRows);
+ }
+ if (g_Dbs.db[i].dbCfg.comp > 0) {
+ fprintf(fp, " comp: %d\n", g_Dbs.db[i].dbCfg.comp);
+ }
+ if (g_Dbs.db[i].dbCfg.walLevel > 0) {
+ fprintf(fp, " walLevel: %d\n", g_Dbs.db[i].dbCfg.walLevel);
+ }
+ if (g_Dbs.db[i].dbCfg.fsync > 0) {
+ fprintf(fp, " fsync: %d\n", g_Dbs.db[i].dbCfg.fsync);
+ }
+ if (g_Dbs.db[i].dbCfg.quorum > 0) {
+ fprintf(fp, " quorum: %d\n", g_Dbs.db[i].dbCfg.quorum);
+ }
+ if (g_Dbs.db[i].dbCfg.precision[0] != 0) {
+ if ((0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "ms", 2))
+ || (0 == strncasecmp(g_Dbs.db[i].dbCfg.precision, "us", 2))) {
+ fprintf(fp, " precision: %s\n",
+ g_Dbs.db[i].dbCfg.precision);
+ } else {
+ fprintf(fp, " precision error: %s\n",
+ g_Dbs.db[i].dbCfg.precision);
+ }
}
- }
- fprintf(fp, "\n");
- }
- fprintf(fp, "\n");
- }
- SHOW_PARSE_RESULT_END_TO_FILE(fp);
+ fprintf(fp, " super table count: %"PRIu64"\n",
+ g_Dbs.db[i].superTblCount);
+ for (int j = 0; j < g_Dbs.db[i].superTblCount; j++) {
+ fprintf(fp, " super table[%d]:\n", j);
+
+ fprintf(fp, " stbName: %s\n",
+ g_Dbs.db[i].superTbls[j].sTblName);
+
+ if (PRE_CREATE_SUBTBL == g_Dbs.db[i].superTbls[j].autoCreateTable) {
+ fprintf(fp, " autoCreateTable: %s\n", "no");
+ } else if (AUTO_CREATE_SUBTBL
+ == g_Dbs.db[i].superTbls[j].autoCreateTable) {
+ fprintf(fp, " autoCreateTable: %s\n", "yes");
+ } else {
+ fprintf(fp, " autoCreateTable: %s\n", "error");
+ }
+
+ if (TBL_NO_EXISTS == g_Dbs.db[i].superTbls[j].childTblExists) {
+ fprintf(fp, " childTblExists: %s\n", "no");
+ } else if (TBL_ALREADY_EXISTS
+ == g_Dbs.db[i].superTbls[j].childTblExists) {
+ fprintf(fp, " childTblExists: %s\n", "yes");
+ } else {
+ fprintf(fp, " childTblExists: %s\n", "error");
+ }
+
+ fprintf(fp, " childTblCount: %"PRId64"\n",
+ g_Dbs.db[i].superTbls[j].childTblCount);
+ fprintf(fp, " childTblPrefix: %s\n",
+ g_Dbs.db[i].superTbls[j].childTblPrefix);
+ fprintf(fp, " dataSource: %s\n",
+ g_Dbs.db[i].superTbls[j].dataSource);
+ fprintf(fp, " iface: %s\n",
+ (g_Dbs.db[i].superTbls[j].iface==TAOSC_IFACE)?"taosc":
+ (g_Dbs.db[i].superTbls[j].iface==REST_IFACE)?"rest":"stmt");
+ fprintf(fp, " insertRows: %"PRId64"\n",
+ g_Dbs.db[i].superTbls[j].insertRows);
+ fprintf(fp, " interlace rows: %u\n",
+ g_Dbs.db[i].superTbls[j].interlaceRows);
+ if (g_Dbs.db[i].superTbls[j].interlaceRows > 0) {
+ fprintf(fp, " stable insert interval: %"PRIu64"\n",
+ g_Dbs.db[i].superTbls[j].insertInterval);
+ }
+ /*
+ if (0 == g_Dbs.db[i].superTbls[j].multiThreadWriteOneTbl) {
+ fprintf(fp, " multiThreadWriteOneTbl: no\n");
+ }else {
+ fprintf(fp, " multiThreadWriteOneTbl: yes\n");
+ }
+ */
+ fprintf(fp, " interlaceRows: %u\n",
+ g_Dbs.db[i].superTbls[j].interlaceRows);
+ fprintf(fp, " disorderRange: %d\n",
+ g_Dbs.db[i].superTbls[j].disorderRange);
+ fprintf(fp, " disorderRatio: %d\n",
+ g_Dbs.db[i].superTbls[j].disorderRatio);
+ fprintf(fp, " maxSqlLen: %"PRIu64"\n",
+ g_Dbs.db[i].superTbls[j].maxSqlLen);
+
+ fprintf(fp, " timeStampStep: %"PRId64"\n",
+ g_Dbs.db[i].superTbls[j].timeStampStep);
+ fprintf(fp, " startTimestamp: %s\n",
+ g_Dbs.db[i].superTbls[j].startTimestamp);
+ fprintf(fp, " sampleFormat: %s\n",
+ g_Dbs.db[i].superTbls[j].sampleFormat);
+ fprintf(fp, " sampleFile: %s\n",
+ g_Dbs.db[i].superTbls[j].sampleFile);
+ fprintf(fp, " tagsFile: %s\n",
+ g_Dbs.db[i].superTbls[j].tagsFile);
+
+ fprintf(fp, " columnCount: %d\n ",
+ g_Dbs.db[i].superTbls[j].columnCount);
+ for (int k = 0; k < g_Dbs.db[i].superTbls[j].columnCount; k++) {
+ //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].columns[k].dataType, g_Dbs.db[i].superTbls[j].columns[k].dataLen);
+ if ((0 == strncasecmp(
+ g_Dbs.db[i].superTbls[j].columns[k].dataType,
+ "binary", strlen("binary")))
+ || (0 == strncasecmp(
+ g_Dbs.db[i].superTbls[j].columns[k].dataType,
+ "nchar", strlen("nchar")))) {
+ fprintf(fp, "column[%d]:%s(%d) ", k,
+ g_Dbs.db[i].superTbls[j].columns[k].dataType,
+ g_Dbs.db[i].superTbls[j].columns[k].dataLen);
+ } else {
+ fprintf(fp, "column[%d]:%s ",
+ k, g_Dbs.db[i].superTbls[j].columns[k].dataType);
+ }
+ }
+ fprintf(fp, "\n");
+
+ fprintf(fp, " tagCount: %d\n ",
+ g_Dbs.db[i].superTbls[j].tagCount);
+ for (int k = 0; k < g_Dbs.db[i].superTbls[j].tagCount; k++) {
+ //printf("dataType:%s, dataLen:%d\t", g_Dbs.db[i].superTbls[j].tags[k].dataType, g_Dbs.db[i].superTbls[j].tags[k].dataLen);
+ if ((0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType,
+ "binary", strlen("binary")))
+ || (0 == strncasecmp(g_Dbs.db[i].superTbls[j].tags[k].dataType,
+ "nchar", strlen("nchar")))) {
+ fprintf(fp, "tag[%d]:%s(%d) ",
+ k, g_Dbs.db[i].superTbls[j].tags[k].dataType,
+ g_Dbs.db[i].superTbls[j].tags[k].dataLen);
+ } else {
+ fprintf(fp, "tag[%d]:%s ", k, g_Dbs.db[i].superTbls[j].tags[k].dataType);
+ }
+ }
+ fprintf(fp, "\n");
+ }
+ fprintf(fp, "\n");
+ }
+
+ SHOW_PARSE_RESULT_END_TO_FILE(fp);
}
static void printfQueryMeta() {
- SHOW_PARSE_RESULT_START();
+ SHOW_PARSE_RESULT_START();
- printf("host: \033[33m%s:%u\033[0m\n",
- g_queryInfo.host, g_queryInfo.port);
- printf("user: \033[33m%s\033[0m\n", g_queryInfo.user);
- printf("database name: \033[33m%s\033[0m\n", g_queryInfo.dbName);
+ printf("host: \033[33m%s:%u\033[0m\n",
+ g_queryInfo.host, g_queryInfo.port);
+ printf("user: \033[33m%s\033[0m\n", g_queryInfo.user);
+ printf("database name: \033[33m%s\033[0m\n", g_queryInfo.dbName);
- printf("\n");
+ printf("\n");
- if ((SUBSCRIBE_TEST == g_args.test_mode) || (QUERY_TEST == g_args.test_mode)) {
- printf("specified table query info: \n");
- printf("sqlCount: \033[33m%d\033[0m\n",
- g_queryInfo.specifiedQueryInfo.sqlCount);
- if (g_queryInfo.specifiedQueryInfo.sqlCount > 0) {
- printf("specified tbl query times:\n");
- printf(" \033[33m%"PRIu64"\033[0m\n",
- g_queryInfo.specifiedQueryInfo.queryTimes);
- printf("query interval: \033[33m%"PRIu64" ms\033[0m\n",
- g_queryInfo.specifiedQueryInfo.queryInterval);
- printf("top query times:\033[33m%"PRIu64"\033[0m\n", g_args.query_times);
- printf("concurrent: \033[33m%d\033[0m\n",
- g_queryInfo.specifiedQueryInfo.concurrent);
- printf("mod: \033[33m%s\033[0m\n",
- (g_queryInfo.specifiedQueryInfo.asyncMode)?"async":"sync");
- printf("interval: \033[33m%"PRIu64"\033[0m\n",
- g_queryInfo.specifiedQueryInfo.subscribeInterval);
- printf("restart: \033[33m%d\033[0m\n",
- g_queryInfo.specifiedQueryInfo.subscribeRestart);
- printf("keepProgress: \033[33m%d\033[0m\n",
- g_queryInfo.specifiedQueryInfo.subscribeKeepProgress);
+ if ((SUBSCRIBE_TEST == g_args.test_mode) || (QUERY_TEST == g_args.test_mode)) {
+ printf("specified table query info: \n");
+ printf("sqlCount: \033[33m%d\033[0m\n",
+ g_queryInfo.specifiedQueryInfo.sqlCount);
+ if (g_queryInfo.specifiedQueryInfo.sqlCount > 0) {
+ printf("specified tbl query times:\n");
+ printf(" \033[33m%"PRIu64"\033[0m\n",
+ g_queryInfo.specifiedQueryInfo.queryTimes);
+ printf("query interval: \033[33m%"PRIu64" ms\033[0m\n",
+ g_queryInfo.specifiedQueryInfo.queryInterval);
+ printf("top query times:\033[33m%"PRIu64"\033[0m\n", g_args.query_times);
+ printf("concurrent: \033[33m%d\033[0m\n",
+ g_queryInfo.specifiedQueryInfo.concurrent);
+ printf("mod: \033[33m%s\033[0m\n",
+ (g_queryInfo.specifiedQueryInfo.asyncMode)?"async":"sync");
+ printf("interval: \033[33m%"PRIu64"\033[0m\n",
+ g_queryInfo.specifiedQueryInfo.subscribeInterval);
+ printf("restart: \033[33m%d\033[0m\n",
+ g_queryInfo.specifiedQueryInfo.subscribeRestart);
+ printf("keepProgress: \033[33m%d\033[0m\n",
+ g_queryInfo.specifiedQueryInfo.subscribeKeepProgress);
- for (int i = 0; i < g_queryInfo.specifiedQueryInfo.sqlCount; i++) {
- printf(" sql[%d]: \033[33m%s\033[0m\n",
- i, g_queryInfo.specifiedQueryInfo.sql[i]);
- }
- printf("\n");
+ for (int i = 0; i < g_queryInfo.specifiedQueryInfo.sqlCount; i++) {
+ printf(" sql[%d]: \033[33m%s\033[0m\n",
+ i, g_queryInfo.specifiedQueryInfo.sql[i]);
+ }
+ printf("\n");
+ }
+
+ printf("super table query info:\n");
+ printf("sqlCount: \033[33m%d\033[0m\n",
+ g_queryInfo.superQueryInfo.sqlCount);
+
+ if (g_queryInfo.superQueryInfo.sqlCount > 0) {
+ printf("query interval: \033[33m%"PRIu64"\033[0m\n",
+ g_queryInfo.superQueryInfo.queryInterval);
+ printf("threadCnt: \033[33m%d\033[0m\n",
+ g_queryInfo.superQueryInfo.threadCnt);
+ printf("childTblCount: \033[33m%"PRId64"\033[0m\n",
+ g_queryInfo.superQueryInfo.childTblCount);
+ printf("stable name: \033[33m%s\033[0m\n",
+ g_queryInfo.superQueryInfo.sTblName);
+ printf("stb query times:\033[33m%"PRIu64"\033[0m\n",
+ g_queryInfo.superQueryInfo.queryTimes);
+
+ printf("mod: \033[33m%s\033[0m\n",
+ (g_queryInfo.superQueryInfo.asyncMode)?"async":"sync");
+ printf("interval: \033[33m%"PRIu64"\033[0m\n",
+ g_queryInfo.superQueryInfo.subscribeInterval);
+ printf("restart: \033[33m%d\033[0m\n",
+ g_queryInfo.superQueryInfo.subscribeRestart);
+ printf("keepProgress: \033[33m%d\033[0m\n",
+ g_queryInfo.superQueryInfo.subscribeKeepProgress);
+
+ for (int i = 0; i < g_queryInfo.superQueryInfo.sqlCount; i++) {
+ printf(" sql[%d]: \033[33m%s\033[0m\n",
+ i, g_queryInfo.superQueryInfo.sql[i]);
+ }
+ printf("\n");
+ }
}
- printf("super table query info:\n");
- printf("sqlCount: \033[33m%d\033[0m\n",
- g_queryInfo.superQueryInfo.sqlCount);
-
- if (g_queryInfo.superQueryInfo.sqlCount > 0) {
- printf("query interval: \033[33m%"PRIu64"\033[0m\n",
- g_queryInfo.superQueryInfo.queryInterval);
- printf("threadCnt: \033[33m%d\033[0m\n",
- g_queryInfo.superQueryInfo.threadCnt);
- printf("childTblCount: \033[33m%"PRId64"\033[0m\n",
- g_queryInfo.superQueryInfo.childTblCount);
- printf("stable name: \033[33m%s\033[0m\n",
- g_queryInfo.superQueryInfo.sTblName);
- printf("stb query times:\033[33m%"PRIu64"\033[0m\n",
- g_queryInfo.superQueryInfo.queryTimes);
-
- printf("mod: \033[33m%s\033[0m\n",
- (g_queryInfo.superQueryInfo.asyncMode)?"async":"sync");
- printf("interval: \033[33m%"PRIu64"\033[0m\n",
- g_queryInfo.superQueryInfo.subscribeInterval);
- printf("restart: \033[33m%d\033[0m\n",
- g_queryInfo.superQueryInfo.subscribeRestart);
- printf("keepProgress: \033[33m%d\033[0m\n",
- g_queryInfo.superQueryInfo.subscribeKeepProgress);
-
- for (int i = 0; i < g_queryInfo.superQueryInfo.sqlCount; i++) {
- printf(" sql[%d]: \033[33m%s\033[0m\n",
- i, g_queryInfo.superQueryInfo.sql[i]);
- }
- printf("\n");
- }
- }
-
- SHOW_PARSE_RESULT_END();
+ SHOW_PARSE_RESULT_END();
}
static char* formatTimestamp(char* buf, int64_t val, int precision) {
- time_t tt;
- if (precision == TSDB_TIME_PRECISION_NANO) {
- tt = (time_t)(val / 1000000000);
- } else if (precision == TSDB_TIME_PRECISION_MICRO) {
- tt = (time_t)(val / 1000000);
- } else {
- tt = (time_t)(val / 1000);
- }
+ time_t tt;
+ if (precision == TSDB_TIME_PRECISION_NANO) {
+ tt = (time_t)(val / 1000000000);
+ } else if (precision == TSDB_TIME_PRECISION_MICRO) {
+ tt = (time_t)(val / 1000000);
+ } else {
+ tt = (time_t)(val / 1000);
+ }
-/* comment out as it make testcases like select_with_tags.sim fail.
- but in windows, this may cause the call to localtime crash if tt < 0,
- need to find a better solution.
- if (tt < 0) {
- tt = 0;
- }
- */
+ /* comment out as it make testcases like select_with_tags.sim fail.
+ but in windows, this may cause the call to localtime crash if tt < 0,
+ need to find a better solution.
+ if (tt < 0) {
+ tt = 0;
+ }
+ */
#ifdef WINDOWS
- if (tt < 0) tt = 0;
+ if (tt < 0) tt = 0;
#endif
- struct tm* ptm = localtime(&tt);
- size_t pos = strftime(buf, 32, "%Y-%m-%d %H:%M:%S", ptm);
+ struct tm* ptm = localtime(&tt);
+ size_t pos = strftime(buf, 32, "%Y-%m-%d %H:%M:%S", ptm);
- if (precision == TSDB_TIME_PRECISION_NANO) {
- sprintf(buf + pos, ".%09d", (int)(val % 1000000000));
- } else if (precision == TSDB_TIME_PRECISION_MICRO) {
- sprintf(buf + pos, ".%06d", (int)(val % 1000000));
- } else {
- sprintf(buf + pos, ".%03d", (int)(val % 1000));
- }
+ if (precision == TSDB_TIME_PRECISION_NANO) {
+ sprintf(buf + pos, ".%09d", (int)(val % 1000000000));
+ } else if (precision == TSDB_TIME_PRECISION_MICRO) {
+ sprintf(buf + pos, ".%06d", (int)(val % 1000000));
+ } else {
+ sprintf(buf + pos, ".%03d", (int)(val % 1000));
+ }
- return buf;
+ return buf;
}
static void xDumpFieldToFile(FILE* fp, const char* val,
TAOS_FIELD* field, int32_t length, int precision) {
- if (val == NULL) {
- fprintf(fp, "%s", TSDB_DATA_NULL_STR);
- return;
- }
+ if (val == NULL) {
+ fprintf(fp, "%s", TSDB_DATA_NULL_STR);
+ return;
+ }
- char buf[TSDB_MAX_BYTES_PER_ROW];
- switch (field->type) {
- case TSDB_DATA_TYPE_BOOL:
- fprintf(fp, "%d", ((((int32_t)(*((char *)val))) == 1) ? 1 : 0));
- break;
- case TSDB_DATA_TYPE_TINYINT:
- fprintf(fp, "%d", *((int8_t *)val));
- break;
- case TSDB_DATA_TYPE_SMALLINT:
- fprintf(fp, "%d", *((int16_t *)val));
- break;
- case TSDB_DATA_TYPE_INT:
- fprintf(fp, "%d", *((int32_t *)val));
- break;
- case TSDB_DATA_TYPE_BIGINT:
- fprintf(fp, "%" PRId64, *((int64_t *)val));
- break;
- case TSDB_DATA_TYPE_FLOAT:
- fprintf(fp, "%.5f", GET_FLOAT_VAL(val));
- break;
- case TSDB_DATA_TYPE_DOUBLE:
- fprintf(fp, "%.9f", GET_DOUBLE_VAL(val));
- break;
- case TSDB_DATA_TYPE_BINARY:
- case TSDB_DATA_TYPE_NCHAR:
- memcpy(buf, val, length);
- buf[length] = 0;
- fprintf(fp, "\'%s\'", buf);
- break;
- case TSDB_DATA_TYPE_TIMESTAMP:
- formatTimestamp(buf, *(int64_t*)val, precision);
- fprintf(fp, "'%s'", buf);
- break;
- default:
- break;
- }
+ char buf[TSDB_MAX_BYTES_PER_ROW];
+ switch (field->type) {
+ case TSDB_DATA_TYPE_BOOL:
+ fprintf(fp, "%d", ((((int32_t)(*((char *)val))) == 1) ? 1 : 0));
+ break;
+ case TSDB_DATA_TYPE_TINYINT:
+ fprintf(fp, "%d", *((int8_t *)val));
+ break;
+ case TSDB_DATA_TYPE_SMALLINT:
+ fprintf(fp, "%d", *((int16_t *)val));
+ break;
+ case TSDB_DATA_TYPE_INT:
+ fprintf(fp, "%d", *((int32_t *)val));
+ break;
+ case TSDB_DATA_TYPE_BIGINT:
+ fprintf(fp, "%" PRId64, *((int64_t *)val));
+ break;
+ case TSDB_DATA_TYPE_FLOAT:
+ fprintf(fp, "%.5f", GET_FLOAT_VAL(val));
+ break;
+ case TSDB_DATA_TYPE_DOUBLE:
+ fprintf(fp, "%.9f", GET_DOUBLE_VAL(val));
+ break;
+ case TSDB_DATA_TYPE_BINARY:
+ case TSDB_DATA_TYPE_NCHAR:
+ memcpy(buf, val, length);
+ buf[length] = 0;
+ fprintf(fp, "\'%s\'", buf);
+ break;
+ case TSDB_DATA_TYPE_TIMESTAMP:
+ formatTimestamp(buf, *(int64_t*)val, precision);
+ fprintf(fp, "'%s'", buf);
+ break;
+ default:
+ break;
+ }
}
static int xDumpResultToFile(const char* fname, TAOS_RES* tres) {
- TAOS_ROW row = taos_fetch_row(tres);
- if (row == NULL) {
- return 0;
- }
-
- FILE* fp = fopen(fname, "at");
- if (fp == NULL) {
- errorPrint("%s() LN%d, failed to open file: %s\n", __func__, __LINE__, fname);
- return -1;
- }
-
- int num_fields = taos_num_fields(tres);
- TAOS_FIELD *fields = taos_fetch_fields(tres);
- int precision = taos_result_precision(tres);
-
- for (int col = 0; col < num_fields; col++) {
- if (col > 0) {
- fprintf(fp, ",");
+ TAOS_ROW row = taos_fetch_row(tres);
+ if (row == NULL) {
+ return 0;
}
- fprintf(fp, "%s", fields[col].name);
- }
- fputc('\n', fp);
- int numOfRows = 0;
- do {
- int32_t* length = taos_fetch_lengths(tres);
- for (int i = 0; i < num_fields; i++) {
- if (i > 0) {
- fputc(',', fp);
- }
- xDumpFieldToFile(fp, (const char*)row[i], fields +i, length[i], precision);
+ FILE* fp = fopen(fname, "at");
+ if (fp == NULL) {
+ errorPrint("%s() LN%d, failed to open file: %s\n",
+ __func__, __LINE__, fname);
+ return -1;
+ }
+
+ int num_fields = taos_num_fields(tres);
+ TAOS_FIELD *fields = taos_fetch_fields(tres);
+ int precision = taos_result_precision(tres);
+
+ for (int col = 0; col < num_fields; col++) {
+ if (col > 0) {
+ fprintf(fp, ",");
+ }
+ fprintf(fp, "%s", fields[col].name);
}
fputc('\n', fp);
- numOfRows++;
- row = taos_fetch_row(tres);
- } while( row != NULL);
+ int numOfRows = 0;
+ do {
+ int32_t* length = taos_fetch_lengths(tres);
+ for (int i = 0; i < num_fields; i++) {
+ if (i > 0) {
+ fputc(',', fp);
+ }
+ xDumpFieldToFile(fp,
+ (const char*)row[i], fields +i, length[i], precision);
+ }
+ fputc('\n', fp);
- fclose(fp);
+ numOfRows++;
+ row = taos_fetch_row(tres);
+ } while( row != NULL);
- return numOfRows;
+ fclose(fp);
+
+ return numOfRows;
}
static int getDbFromServer(TAOS * taos, SDbInfo** dbInfos) {
- TAOS_RES * res;
- TAOS_ROW row = NULL;
- int count = 0;
+ TAOS_RES * res;
+ TAOS_ROW row = NULL;
+ int count = 0;
- res = taos_query(taos, "show databases;");
- int32_t code = taos_errno(res);
+ res = taos_query(taos, "show databases;");
+ int32_t code = taos_errno(res);
- if (code != 0) {
- errorPrint( "failed to run , reason: %s\n", taos_errstr(res));
- return -1;
- }
-
- TAOS_FIELD *fields = taos_fetch_fields(res);
-
- while((row = taos_fetch_row(res)) != NULL) {
- // sys database name : 'log'
- if (strncasecmp(row[TSDB_SHOW_DB_NAME_INDEX], "log",
- fields[TSDB_SHOW_DB_NAME_INDEX].bytes) == 0) {
- continue;
+ if (code != 0) {
+ errorPrint( "failed to run , reason: %s\n",
+ taos_errstr(res));
+ return -1;
}
- dbInfos[count] = (SDbInfo *)calloc(1, sizeof(SDbInfo));
- if (dbInfos[count] == NULL) {
- errorPrint( "failed to allocate memory for some dbInfo[%d]\n", count);
- return -1;
+ TAOS_FIELD *fields = taos_fetch_fields(res);
+
+ while((row = taos_fetch_row(res)) != NULL) {
+ // sys database name : 'log'
+ if (strncasecmp(row[TSDB_SHOW_DB_NAME_INDEX], "log",
+ fields[TSDB_SHOW_DB_NAME_INDEX].bytes) == 0) {
+ continue;
+ }
+
+ dbInfos[count] = (SDbInfo *)calloc(1, sizeof(SDbInfo));
+ if (dbInfos[count] == NULL) {
+ errorPrint( "failed to allocate memory for some dbInfo[%d]\n", count);
+ return -1;
+ }
+
+ tstrncpy(dbInfos[count]->name, (char *)row[TSDB_SHOW_DB_NAME_INDEX],
+ fields[TSDB_SHOW_DB_NAME_INDEX].bytes);
+ formatTimestamp(dbInfos[count]->create_time,
+ *(int64_t*)row[TSDB_SHOW_DB_CREATED_TIME_INDEX],
+ TSDB_TIME_PRECISION_MILLI);
+ dbInfos[count]->ntables = *((int64_t *)row[TSDB_SHOW_DB_NTABLES_INDEX]);
+ dbInfos[count]->vgroups = *((int32_t *)row[TSDB_SHOW_DB_VGROUPS_INDEX]);
+ dbInfos[count]->replica = *((int16_t *)row[TSDB_SHOW_DB_REPLICA_INDEX]);
+ dbInfos[count]->quorum = *((int16_t *)row[TSDB_SHOW_DB_QUORUM_INDEX]);
+ dbInfos[count]->days = *((int16_t *)row[TSDB_SHOW_DB_DAYS_INDEX]);
+
+ tstrncpy(dbInfos[count]->keeplist, (char *)row[TSDB_SHOW_DB_KEEP_INDEX],
+ fields[TSDB_SHOW_DB_KEEP_INDEX].bytes);
+ dbInfos[count]->cache = *((int32_t *)row[TSDB_SHOW_DB_CACHE_INDEX]);
+ dbInfos[count]->blocks = *((int32_t *)row[TSDB_SHOW_DB_BLOCKS_INDEX]);
+ dbInfos[count]->minrows = *((int32_t *)row[TSDB_SHOW_DB_MINROWS_INDEX]);
+ dbInfos[count]->maxrows = *((int32_t *)row[TSDB_SHOW_DB_MAXROWS_INDEX]);
+ dbInfos[count]->wallevel = *((int8_t *)row[TSDB_SHOW_DB_WALLEVEL_INDEX]);
+ dbInfos[count]->fsync = *((int32_t *)row[TSDB_SHOW_DB_FSYNC_INDEX]);
+ dbInfos[count]->comp = (int8_t)(*((int8_t *)row[TSDB_SHOW_DB_COMP_INDEX]));
+ dbInfos[count]->cachelast =
+ (int8_t)(*((int8_t *)row[TSDB_SHOW_DB_CACHELAST_INDEX]));
+
+ tstrncpy(dbInfos[count]->precision,
+ (char *)row[TSDB_SHOW_DB_PRECISION_INDEX],
+ fields[TSDB_SHOW_DB_PRECISION_INDEX].bytes);
+ dbInfos[count]->update = *((int8_t *)row[TSDB_SHOW_DB_UPDATE_INDEX]);
+ tstrncpy(dbInfos[count]->status, (char *)row[TSDB_SHOW_DB_STATUS_INDEX],
+ fields[TSDB_SHOW_DB_STATUS_INDEX].bytes);
+
+ count++;
+ if (count > MAX_DATABASE_COUNT) {
+ errorPrint("%s() LN%d, The database count overflow than %d\n",
+ __func__, __LINE__, MAX_DATABASE_COUNT);
+ break;
+ }
}
- tstrncpy(dbInfos[count]->name, (char *)row[TSDB_SHOW_DB_NAME_INDEX],
- fields[TSDB_SHOW_DB_NAME_INDEX].bytes);
- formatTimestamp(dbInfos[count]->create_time,
- *(int64_t*)row[TSDB_SHOW_DB_CREATED_TIME_INDEX],
- TSDB_TIME_PRECISION_MILLI);
- dbInfos[count]->ntables = *((int64_t *)row[TSDB_SHOW_DB_NTABLES_INDEX]);
- dbInfos[count]->vgroups = *((int32_t *)row[TSDB_SHOW_DB_VGROUPS_INDEX]);
- dbInfos[count]->replica = *((int16_t *)row[TSDB_SHOW_DB_REPLICA_INDEX]);
- dbInfos[count]->quorum = *((int16_t *)row[TSDB_SHOW_DB_QUORUM_INDEX]);
- dbInfos[count]->days = *((int16_t *)row[TSDB_SHOW_DB_DAYS_INDEX]);
-
- tstrncpy(dbInfos[count]->keeplist, (char *)row[TSDB_SHOW_DB_KEEP_INDEX],
- fields[TSDB_SHOW_DB_KEEP_INDEX].bytes);
- dbInfos[count]->cache = *((int32_t *)row[TSDB_SHOW_DB_CACHE_INDEX]);
- dbInfos[count]->blocks = *((int32_t *)row[TSDB_SHOW_DB_BLOCKS_INDEX]);
- dbInfos[count]->minrows = *((int32_t *)row[TSDB_SHOW_DB_MINROWS_INDEX]);
- dbInfos[count]->maxrows = *((int32_t *)row[TSDB_SHOW_DB_MAXROWS_INDEX]);
- dbInfos[count]->wallevel = *((int8_t *)row[TSDB_SHOW_DB_WALLEVEL_INDEX]);
- dbInfos[count]->fsync = *((int32_t *)row[TSDB_SHOW_DB_FSYNC_INDEX]);
- dbInfos[count]->comp = (int8_t)(*((int8_t *)row[TSDB_SHOW_DB_COMP_INDEX]));
- dbInfos[count]->cachelast =
- (int8_t)(*((int8_t *)row[TSDB_SHOW_DB_CACHELAST_INDEX]));
-
- tstrncpy(dbInfos[count]->precision,
- (char *)row[TSDB_SHOW_DB_PRECISION_INDEX],
- fields[TSDB_SHOW_DB_PRECISION_INDEX].bytes);
- dbInfos[count]->update = *((int8_t *)row[TSDB_SHOW_DB_UPDATE_INDEX]);
- tstrncpy(dbInfos[count]->status, (char *)row[TSDB_SHOW_DB_STATUS_INDEX],
- fields[TSDB_SHOW_DB_STATUS_INDEX].bytes);
-
- count++;
- if (count > MAX_DATABASE_COUNT) {
- errorPrint("%s() LN%d, The database count overflow than %d\n",
- __func__, __LINE__, MAX_DATABASE_COUNT);
- break;
- }
- }
-
- return count;
+ return count;
}
static void printfDbInfoForQueryToFile(
char* filename, SDbInfo* dbInfos, int index) {
- if (filename[0] == 0)
- return;
+ if (filename[0] == 0)
+ return;
- FILE *fp = fopen(filename, "at");
- if (fp == NULL) {
- errorPrint( "failed to open file: %s\n", filename);
- return;
- }
+ FILE *fp = fopen(filename, "at");
+ if (fp == NULL) {
+ errorPrint( "failed to open file: %s\n", filename);
+ return;
+ }
- fprintf(fp, "================ database[%d] ================\n", index);
- fprintf(fp, "name: %s\n", dbInfos->name);
- fprintf(fp, "created_time: %s\n", dbInfos->create_time);
- fprintf(fp, "ntables: %"PRId64"\n", dbInfos->ntables);
- fprintf(fp, "vgroups: %d\n", dbInfos->vgroups);
- fprintf(fp, "replica: %d\n", dbInfos->replica);
- fprintf(fp, "quorum: %d\n", dbInfos->quorum);
- fprintf(fp, "days: %d\n", dbInfos->days);
- fprintf(fp, "keep0,keep1,keep(D): %s\n", dbInfos->keeplist);
- fprintf(fp, "cache(MB): %d\n", dbInfos->cache);
- fprintf(fp, "blocks: %d\n", dbInfos->blocks);
- fprintf(fp, "minrows: %d\n", dbInfos->minrows);
- fprintf(fp, "maxrows: %d\n", dbInfos->maxrows);
- fprintf(fp, "wallevel: %d\n", dbInfos->wallevel);
- fprintf(fp, "fsync: %d\n", dbInfos->fsync);
- fprintf(fp, "comp: %d\n", dbInfos->comp);
- fprintf(fp, "cachelast: %d\n", dbInfos->cachelast);
- fprintf(fp, "precision: %s\n", dbInfos->precision);
- fprintf(fp, "update: %d\n", dbInfos->update);
- fprintf(fp, "status: %s\n", dbInfos->status);
- fprintf(fp, "\n");
+ fprintf(fp, "================ database[%d] ================\n", index);
+ fprintf(fp, "name: %s\n", dbInfos->name);
+ fprintf(fp, "created_time: %s\n", dbInfos->create_time);
+ fprintf(fp, "ntables: %"PRId64"\n", dbInfos->ntables);
+ fprintf(fp, "vgroups: %d\n", dbInfos->vgroups);
+ fprintf(fp, "replica: %d\n", dbInfos->replica);
+ fprintf(fp, "quorum: %d\n", dbInfos->quorum);
+ fprintf(fp, "days: %d\n", dbInfos->days);
+ fprintf(fp, "keep0,keep1,keep(D): %s\n", dbInfos->keeplist);
+ fprintf(fp, "cache(MB): %d\n", dbInfos->cache);
+ fprintf(fp, "blocks: %d\n", dbInfos->blocks);
+ fprintf(fp, "minrows: %d\n", dbInfos->minrows);
+ fprintf(fp, "maxrows: %d\n", dbInfos->maxrows);
+ fprintf(fp, "wallevel: %d\n", dbInfos->wallevel);
+ fprintf(fp, "fsync: %d\n", dbInfos->fsync);
+ fprintf(fp, "comp: %d\n", dbInfos->comp);
+ fprintf(fp, "cachelast: %d\n", dbInfos->cachelast);
+ fprintf(fp, "precision: %s\n", dbInfos->precision);
+ fprintf(fp, "update: %d\n", dbInfos->update);
+ fprintf(fp, "status: %s\n", dbInfos->status);
+ fprintf(fp, "\n");
- fclose(fp);
+ fclose(fp);
}
static void printfQuerySystemInfo(TAOS * taos) {
- char filename[MAX_QUERY_SQL_LENGTH+1] = {0};
- char buffer[MAX_QUERY_SQL_LENGTH+1] = {0};
- TAOS_RES* res;
+ char filename[MAX_QUERY_SQL_LENGTH+1] = {0};
+ char buffer[MAX_QUERY_SQL_LENGTH+1] = {0};
+ TAOS_RES* res;
- time_t t;
- struct tm* lt;
- time(&t);
- lt = localtime(&t);
- snprintf(filename, MAX_QUERY_SQL_LENGTH, "querySystemInfo-%d-%d-%d %d:%d:%d",
- lt->tm_year+1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min,
- lt->tm_sec);
+ time_t t;
+ struct tm* lt;
+ time(&t);
+ lt = localtime(&t);
+ snprintf(filename, MAX_QUERY_SQL_LENGTH, "querySystemInfo-%d-%d-%d %d:%d:%d",
+ lt->tm_year+1900, lt->tm_mon, lt->tm_mday, lt->tm_hour, lt->tm_min,
+ lt->tm_sec);
- // show variables
- res = taos_query(taos, "show variables;");
- //fetchResult(res, filename);
- xDumpResultToFile(filename, res);
-
- // show dnodes
- res = taos_query(taos, "show dnodes;");
- xDumpResultToFile(filename, res);
- //fetchResult(res, filename);
-
- // show databases
- res = taos_query(taos, "show databases;");
- SDbInfo** dbInfos = (SDbInfo **)calloc(MAX_DATABASE_COUNT, sizeof(SDbInfo *));
- if (dbInfos == NULL) {
- errorPrint("%s() LN%d, failed to allocate memory\n", __func__, __LINE__);
- return;
- }
- int dbCount = getDbFromServer(taos, dbInfos);
- if (dbCount <= 0) {
- free(dbInfos);
- return;
- }
-
- for (int i = 0; i < dbCount; i++) {
- // printf database info
- printfDbInfoForQueryToFile(filename, dbInfos[i], i);
-
- // show db.vgroups
- snprintf(buffer, MAX_QUERY_SQL_LENGTH, "show %s.vgroups;", dbInfos[i]->name);
- res = taos_query(taos, buffer);
+ // show variables
+ res = taos_query(taos, "show variables;");
+ //fetchResult(res, filename);
xDumpResultToFile(filename, res);
- // show db.stables
- snprintf(buffer, MAX_QUERY_SQL_LENGTH, "show %s.stables;", dbInfos[i]->name);
- res = taos_query(taos, buffer);
+ // show dnodes
+ res = taos_query(taos, "show dnodes;");
xDumpResultToFile(filename, res);
+ //fetchResult(res, filename);
- free(dbInfos[i]);
- }
+ // show databases
+ res = taos_query(taos, "show databases;");
+ SDbInfo** dbInfos = (SDbInfo **)calloc(MAX_DATABASE_COUNT, sizeof(SDbInfo *));
+ if (dbInfos == NULL) {
+ errorPrint("%s() LN%d, failed to allocate memory\n", __func__, __LINE__);
+ return;
+ }
+ int dbCount = getDbFromServer(taos, dbInfos);
+ if (dbCount <= 0) {
+ free(dbInfos);
+ return;
+ }
- free(dbInfos);
+ for (int i = 0; i < dbCount; i++) {
+ // printf database info
+ printfDbInfoForQueryToFile(filename, dbInfos[i], i);
+
+ // show db.vgroups
+ snprintf(buffer, MAX_QUERY_SQL_LENGTH, "show %s.vgroups;", dbInfos[i]->name);
+ res = taos_query(taos, buffer);
+ xDumpResultToFile(filename, res);
+
+ // show db.stables
+ snprintf(buffer, MAX_QUERY_SQL_LENGTH, "show %s.stables;", dbInfos[i]->name);
+ res = taos_query(taos, buffer);
+ xDumpResultToFile(filename, res);
+
+ free(dbInfos[i]);
+ }
+
+ free(dbInfos);
}
static int postProceSql(char *host, struct sockaddr_in *pServAddr, uint16_t port,
@@ -2294,98 +2335,100 @@ static int postProceSql(char *host, struct sockaddr_in *pServAddr, uint16_t port
}
static char* getTagValueFromTagSample(SSuperTable* stbInfo, int tagUsePos) {
- char* dataBuf = (char*)calloc(TSDB_MAX_SQL_LEN+1, 1);
- if (NULL == dataBuf) {
- errorPrint("%s() LN%d, calloc failed! size:%d\n",
- __func__, __LINE__, TSDB_MAX_SQL_LEN+1);
- return NULL;
- }
+ char* dataBuf = (char*)calloc(TSDB_MAX_SQL_LEN+1, 1);
+ if (NULL == dataBuf) {
+ errorPrint("%s() LN%d, calloc failed! size:%d\n",
+ __func__, __LINE__, TSDB_MAX_SQL_LEN+1);
+ return NULL;
+ }
- int dataLen = 0;
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "(%s)", stbInfo->tagDataBuf + stbInfo->lenOfTagOfOneRow * tagUsePos);
+ int dataLen = 0;
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "(%s)", stbInfo->tagDataBuf + stbInfo->lenOfTagOfOneRow * tagUsePos);
- return dataBuf;
+ return dataBuf;
}
static char* generateTagVaulesForStb(SSuperTable* stbInfo, int32_t tableSeq) {
- char* dataBuf = (char*)calloc(TSDB_MAX_SQL_LEN+1, 1);
- if (NULL == dataBuf) {
- printf("calloc failed! size:%d\n", TSDB_MAX_SQL_LEN+1);
- return NULL;
- }
-
- int dataLen = 0;
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, "(");
- for (int i = 0; i < stbInfo->tagCount; i++) {
- if ((0 == strncasecmp(stbInfo->tags[i].dataType, "binary", strlen("binary")))
- || (0 == strncasecmp(stbInfo->tags[i].dataType, "nchar", strlen("nchar")))) {
- if (stbInfo->tags[i].dataLen > TSDB_MAX_BINARY_LEN) {
- printf("binary or nchar length overflow, max size:%u\n",
- (uint32_t)TSDB_MAX_BINARY_LEN);
- tmfree(dataBuf);
+ char* dataBuf = (char*)calloc(TSDB_MAX_SQL_LEN+1, 1);
+ if (NULL == dataBuf) {
+ printf("calloc failed! size:%d\n", TSDB_MAX_SQL_LEN+1);
return NULL;
- }
-
- int tagBufLen = stbInfo->tags[i].dataLen + 1;
- char* buf = (char*)calloc(tagBufLen, 1);
- if (NULL == buf) {
- printf("calloc failed! size:%d\n", stbInfo->tags[i].dataLen);
- tmfree(dataBuf);
- return NULL;
- }
-
- if (tableSeq % 2) {
- tstrncpy(buf, "beijing", tagBufLen);
- } else {
- tstrncpy(buf, "shanghai", tagBufLen);
- }
- //rand_string(buf, stbInfo->tags[i].dataLen);
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "\'%s\', ", buf);
- tmfree(buf);
- } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
- "int", strlen("int"))) {
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "%d, ", tableSeq);
- } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
- "bigint", strlen("bigint"))) {
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "%"PRId64", ", rand_bigint());
- } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
- "float", strlen("float"))) {
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "%f, ", rand_float());
- } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
- "double", strlen("double"))) {
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "%f, ", rand_double());
- } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
- "smallint", strlen("smallint"))) {
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "%d, ", rand_smallint());
- } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
- "tinyint", strlen("tinyint"))) {
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "%d, ", rand_tinyint());
- } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
- "bool", strlen("bool"))) {
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "%d, ", rand_bool());
- } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
- "timestamp", strlen("timestamp"))) {
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
- "%"PRId64", ", rand_bigint());
- } else {
- printf("No support data type: %s\n", stbInfo->tags[i].dataType);
- tmfree(dataBuf);
- return NULL;
}
- }
- dataLen -= 2;
- dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, ")");
- return dataBuf;
+ int dataLen = 0;
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, "(");
+ for (int i = 0; i < stbInfo->tagCount; i++) {
+ if ((0 == strncasecmp(stbInfo->tags[i].dataType,
+ "binary", strlen("binary")))
+ || (0 == strncasecmp(stbInfo->tags[i].dataType,
+ "nchar", strlen("nchar")))) {
+ if (stbInfo->tags[i].dataLen > TSDB_MAX_BINARY_LEN) {
+ printf("binary or nchar length overflow, max size:%u\n",
+ (uint32_t)TSDB_MAX_BINARY_LEN);
+ tmfree(dataBuf);
+ return NULL;
+ }
+
+ int tagBufLen = stbInfo->tags[i].dataLen + 1;
+ char* buf = (char*)calloc(tagBufLen, 1);
+ if (NULL == buf) {
+ printf("calloc failed! size:%d\n", stbInfo->tags[i].dataLen);
+ tmfree(dataBuf);
+ return NULL;
+ }
+
+ if (tableSeq % 2) {
+ tstrncpy(buf, "beijing", tagBufLen);
+ } else {
+ tstrncpy(buf, "shanghai", tagBufLen);
+ }
+ //rand_string(buf, stbInfo->tags[i].dataLen);
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "\'%s\', ", buf);
+ tmfree(buf);
+ } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
+ "int", strlen("int"))) {
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "%d, ", tableSeq);
+ } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
+ "bigint", strlen("bigint"))) {
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "%"PRId64", ", rand_bigint());
+ } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
+ "float", strlen("float"))) {
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "%f, ", rand_float());
+ } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
+ "double", strlen("double"))) {
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "%f, ", rand_double());
+ } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
+ "smallint", strlen("smallint"))) {
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "%d, ", rand_smallint());
+ } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
+ "tinyint", strlen("tinyint"))) {
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "%d, ", rand_tinyint());
+ } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
+ "bool", strlen("bool"))) {
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "%d, ", rand_bool());
+ } else if (0 == strncasecmp(stbInfo->tags[i].dataType,
+ "timestamp", strlen("timestamp"))) {
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen,
+ "%"PRId64", ", rand_bigint());
+ } else {
+ printf("No support data type: %s\n", stbInfo->tags[i].dataType);
+ tmfree(dataBuf);
+ return NULL;
+ }
+ }
+
+ dataLen -= 2;
+ dataLen += snprintf(dataBuf + dataLen, TSDB_MAX_SQL_LEN - dataLen, ")");
+ return dataBuf;
}
static int calcRowLen(SSuperTable* superTbls) {
@@ -2636,155 +2679,172 @@ static int createSuperTable(
TAOS * taos, char* dbName,
SSuperTable* superTbl) {
- char command[BUFFER_SIZE] = "\0";
+ char command[BUFFER_SIZE] = "\0";
- char cols[STRING_LEN] = "\0";
- int colIndex;
- int len = 0;
+ char cols[STRING_LEN] = "\0";
+ int colIndex;
+ int len = 0;
- int lenOfOneRow = 0;
+ int lenOfOneRow = 0;
- if (superTbl->columnCount == 0) {
- errorPrint("%s() LN%d, super table column count is %d\n",
- __func__, __LINE__, superTbl->columnCount);
- return -1;
- }
-
- for (colIndex = 0; colIndex < superTbl->columnCount; colIndex++) {
- char* dataType = superTbl->columns[colIndex].dataType;
-
- if (strcasecmp(dataType, "BINARY") == 0) {
- len += snprintf(cols + len, STRING_LEN - len,
- ", col%d %s(%d)", colIndex, "BINARY",
- superTbl->columns[colIndex].dataLen);
- lenOfOneRow += superTbl->columns[colIndex].dataLen + 3;
- } else if (strcasecmp(dataType, "NCHAR") == 0) {
- len += snprintf(cols + len, STRING_LEN - len,
- ", col%d %s(%d)", colIndex, "NCHAR",
- superTbl->columns[colIndex].dataLen);
- lenOfOneRow += superTbl->columns[colIndex].dataLen + 3;
- } else if (strcasecmp(dataType, "INT") == 0) {
- len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "INT");
- lenOfOneRow += 11;
- } else if (strcasecmp(dataType, "BIGINT") == 0) {
- len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "BIGINT");
- lenOfOneRow += 21;
- } else if (strcasecmp(dataType, "SMALLINT") == 0) {
- len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "SMALLINT");
- lenOfOneRow += 6;
- } else if (strcasecmp(dataType, "TINYINT") == 0) {
- len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "TINYINT");
- lenOfOneRow += 4;
- } else if (strcasecmp(dataType, "BOOL") == 0) {
- len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "BOOL");
- lenOfOneRow += 6;
- } else if (strcasecmp(dataType, "FLOAT") == 0) {
- len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "FLOAT");
- lenOfOneRow += 22;
- } else if (strcasecmp(dataType, "DOUBLE") == 0) {
- len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "DOUBLE");
- lenOfOneRow += 42;
- } else if (strcasecmp(dataType, "TIMESTAMP") == 0) {
- len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "TIMESTAMP");
- lenOfOneRow += 21;
- } else {
- taos_close(taos);
- errorPrint("%s() LN%d, config error data type : %s\n",
- __func__, __LINE__, dataType);
- exit(-1);
+ if (superTbl->columnCount == 0) {
+ errorPrint("%s() LN%d, super table column count is %d\n",
+ __func__, __LINE__, superTbl->columnCount);
+ return -1;
}
- }
- superTbl->lenOfOneRow = lenOfOneRow + 20; // timestamp
- //printf("%s.%s column count:%d, column length:%d\n\n", g_Dbs.db[i].dbName, g_Dbs.db[i].superTbl[j].sTblName, g_Dbs.db[i].superTbl[j].columnCount, lenOfOneRow);
+ for (colIndex = 0; colIndex < superTbl->columnCount; colIndex++) {
+ char* dataType = superTbl->columns[colIndex].dataType;
- // save for creating child table
- superTbl->colsOfCreateChildTable = (char*)calloc(len+20, 1);
- if (NULL == superTbl->colsOfCreateChildTable) {
- errorPrint("%s() LN%d, Failed when calloc, size:%d",
- __func__, __LINE__, len+1);
- taos_close(taos);
- exit(-1);
- }
+ if (strcasecmp(dataType, "BINARY") == 0) {
+ len += snprintf(cols + len, STRING_LEN - len,
+ ", col%d %s(%d)", colIndex, "BINARY",
+ superTbl->columns[colIndex].dataLen);
+ lenOfOneRow += superTbl->columns[colIndex].dataLen + 3;
+ } else if (strcasecmp(dataType, "NCHAR") == 0) {
+ len += snprintf(cols + len, STRING_LEN - len,
+ ", col%d %s(%d)", colIndex, "NCHAR",
+ superTbl->columns[colIndex].dataLen);
+ lenOfOneRow += superTbl->columns[colIndex].dataLen + 3;
+ } else if (strcasecmp(dataType, "INT") == 0) {
+ if ((g_args.demo_mode) && (colIndex == 1)) {
+ len += snprintf(cols + len, STRING_LEN - len,
+ ", VOLTAGE INT");
+ } else {
+ len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "INT");
+ }
+ lenOfOneRow += 11;
+ } else if (strcasecmp(dataType, "BIGINT") == 0) {
+ len += snprintf(cols + len, STRING_LEN - len, ", col%d %s",
+ colIndex, "BIGINT");
+ lenOfOneRow += 21;
+ } else if (strcasecmp(dataType, "SMALLINT") == 0) {
+ len += snprintf(cols + len, STRING_LEN - len, ", col%d %s",
+ colIndex, "SMALLINT");
+ lenOfOneRow += 6;
+ } else if (strcasecmp(dataType, "TINYINT") == 0) {
+ len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "TINYINT");
+ lenOfOneRow += 4;
+ } else if (strcasecmp(dataType, "BOOL") == 0) {
+ len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "BOOL");
+ lenOfOneRow += 6;
+ } else if (strcasecmp(dataType, "FLOAT") == 0) {
+ if (g_args.demo_mode) {
+ if (colIndex == 0) {
+ len += snprintf(cols + len, STRING_LEN - len, ", CURRENT FLOAT");
+ } else if (colIndex == 2) {
+ len += snprintf(cols + len, STRING_LEN - len, ", PHASE FLOAT");
+ }
+ } else {
+ len += snprintf(cols + len, STRING_LEN - len, ", col%d %s", colIndex, "FLOAT");
+ }
- snprintf(superTbl->colsOfCreateChildTable, len+20, "(ts timestamp%s)", cols);
- verbosePrint("%s() LN%d: %s\n",
- __func__, __LINE__, superTbl->colsOfCreateChildTable);
-
- if (superTbl->tagCount == 0) {
- errorPrint("%s() LN%d, super table tag count is %d\n",
- __func__, __LINE__, superTbl->tagCount);
- return -1;
- }
-
- char tags[STRING_LEN] = "\0";
- int tagIndex;
- len = 0;
-
- int lenOfTagOfOneRow = 0;
- len += snprintf(tags + len, STRING_LEN - len, "(");
- for (tagIndex = 0; tagIndex < superTbl->tagCount; tagIndex++) {
- char* dataType = superTbl->tags[tagIndex].dataType;
-
- if (strcasecmp(dataType, "BINARY") == 0) {
- len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", tagIndex,
- "BINARY", superTbl->tags[tagIndex].dataLen);
- lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3;
- } else if (strcasecmp(dataType, "NCHAR") == 0) {
- len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", tagIndex,
- "NCHAR", superTbl->tags[tagIndex].dataLen);
- lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3;
- } else if (strcasecmp(dataType, "INT") == 0) {
- len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
- "INT");
- lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 11;
- } else if (strcasecmp(dataType, "BIGINT") == 0) {
- len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
- "BIGINT");
- lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 21;
- } else if (strcasecmp(dataType, "SMALLINT") == 0) {
- len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
- "SMALLINT");
- lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6;
- } else if (strcasecmp(dataType, "TINYINT") == 0) {
- len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
- "TINYINT");
- lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 4;
- } else if (strcasecmp(dataType, "BOOL") == 0) {
- len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
- "BOOL");
- lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6;
- } else if (strcasecmp(dataType, "FLOAT") == 0) {
- len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
- "FLOAT");
- lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 22;
- } else if (strcasecmp(dataType, "DOUBLE") == 0) {
- len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
- "DOUBLE");
- lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 42;
- } else {
- taos_close(taos);
- errorPrint("%s() LN%d, config error tag type : %s\n",
- __func__, __LINE__, dataType);
- exit(-1);
+ lenOfOneRow += 22;
+ } else if (strcasecmp(dataType, "DOUBLE") == 0) {
+ len += snprintf(cols + len, STRING_LEN - len, ", col%d %s",
+ colIndex, "DOUBLE");
+ lenOfOneRow += 42;
+ } else if (strcasecmp(dataType, "TIMESTAMP") == 0) {
+ len += snprintf(cols + len, STRING_LEN - len, ", col%d %s",
+ colIndex, "TIMESTAMP");
+ lenOfOneRow += 21;
+ } else {
+ taos_close(taos);
+ errorPrint("%s() LN%d, config error data type : %s\n",
+ __func__, __LINE__, dataType);
+ exit(-1);
+ }
}
- }
- len -= 2;
- len += snprintf(tags + len, STRING_LEN - len, ")");
+ superTbl->lenOfOneRow = lenOfOneRow + 20; // timestamp
- superTbl->lenOfTagOfOneRow = lenOfTagOfOneRow;
+ // save for creating child table
+ superTbl->colsOfCreateChildTable = (char*)calloc(len+20, 1);
+ if (NULL == superTbl->colsOfCreateChildTable) {
+ errorPrint("%s() LN%d, Failed when calloc, size:%d",
+ __func__, __LINE__, len+1);
+ taos_close(taos);
+ exit(-1);
+ }
- snprintf(command, BUFFER_SIZE,
- "create table if not exists %s.%s (ts timestamp%s) tags %s",
- dbName, superTbl->sTblName, cols, tags);
- if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) {
- errorPrint( "create supertable %s failed!\n\n",
- superTbl->sTblName);
- return -1;
- }
- debugPrint("create supertable %s success!\n\n", superTbl->sTblName);
- return 0;
+ snprintf(superTbl->colsOfCreateChildTable, len+20, "(ts timestamp%s)", cols);
+ verbosePrint("%s() LN%d: %s\n",
+ __func__, __LINE__, superTbl->colsOfCreateChildTable);
+
+ if (superTbl->tagCount == 0) {
+ errorPrint("%s() LN%d, super table tag count is %d\n",
+ __func__, __LINE__, superTbl->tagCount);
+ return -1;
+ }
+
+ char tags[STRING_LEN] = "\0";
+ int tagIndex;
+ len = 0;
+
+ int lenOfTagOfOneRow = 0;
+ len += snprintf(tags + len, STRING_LEN - len, "(");
+ for (tagIndex = 0; tagIndex < superTbl->tagCount; tagIndex++) {
+ char* dataType = superTbl->tags[tagIndex].dataType;
+
+ if (strcasecmp(dataType, "BINARY") == 0) {
+ len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", tagIndex,
+ "BINARY", superTbl->tags[tagIndex].dataLen);
+ lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3;
+ } else if (strcasecmp(dataType, "NCHAR") == 0) {
+ len += snprintf(tags + len, STRING_LEN - len, "t%d %s(%d), ", tagIndex,
+ "NCHAR", superTbl->tags[tagIndex].dataLen);
+ lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 3;
+ } else if (strcasecmp(dataType, "INT") == 0) {
+ len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
+ "INT");
+ lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 11;
+ } else if (strcasecmp(dataType, "BIGINT") == 0) {
+ len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
+ "BIGINT");
+ lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 21;
+ } else if (strcasecmp(dataType, "SMALLINT") == 0) {
+ len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
+ "SMALLINT");
+ lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6;
+ } else if (strcasecmp(dataType, "TINYINT") == 0) {
+ len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
+ "TINYINT");
+ lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 4;
+ } else if (strcasecmp(dataType, "BOOL") == 0) {
+ len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
+ "BOOL");
+ lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 6;
+ } else if (strcasecmp(dataType, "FLOAT") == 0) {
+ len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
+ "FLOAT");
+ lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 22;
+ } else if (strcasecmp(dataType, "DOUBLE") == 0) {
+ len += snprintf(tags + len, STRING_LEN - len, "t%d %s, ", tagIndex,
+ "DOUBLE");
+ lenOfTagOfOneRow += superTbl->tags[tagIndex].dataLen + 42;
+ } else {
+ taos_close(taos);
+ errorPrint("%s() LN%d, config error tag type : %s\n",
+ __func__, __LINE__, dataType);
+ exit(-1);
+ }
+ }
+
+ len -= 2;
+ len += snprintf(tags + len, STRING_LEN - len, ")");
+
+ superTbl->lenOfTagOfOneRow = lenOfTagOfOneRow;
+
+ snprintf(command, BUFFER_SIZE,
+ "create table if not exists %s.%s (ts timestamp%s) tags %s",
+ dbName, superTbl->sTblName, cols, tags);
+ if (0 != queryDbExec(taos, command, NO_INSERT_TYPE, false)) {
+ errorPrint( "create supertable %s failed!\n\n",
+ superTbl->sTblName);
+ return -1;
+ }
+ debugPrint("create supertable %s success!\n\n", superTbl->sTblName);
+ return 0;
}
static int createDatabasesAndStables() {
@@ -4746,106 +4806,124 @@ static void postFreeResource() {
static int getRowDataFromSample(
char* dataBuf, int64_t maxLen, int64_t timestamp,
- SSuperTable* superTblInfo, int64_t* sampleUsePos) {
- if ((*sampleUsePos) == MAX_SAMPLES_ONCE_FROM_FILE) {
-/* int ret = readSampleFromCsvFileToMem(superTblInfo);
- if (0 != ret) {
- tmfree(superTblInfo->sampleDataBuf);
- superTblInfo->sampleDataBuf = NULL;
- return -1;
+ SSuperTable* superTblInfo, int64_t* sampleUsePos)
+{
+ if ((*sampleUsePos) == MAX_SAMPLES_ONCE_FROM_FILE) {
+ /* int ret = readSampleFromCsvFileToMem(superTblInfo);
+ if (0 != ret) {
+ tmfree(superTblInfo->sampleDataBuf);
+ superTblInfo->sampleDataBuf = NULL;
+ return -1;
+ }
+ */
+ *sampleUsePos = 0;
}
-*/
- *sampleUsePos = 0;
- }
- int dataLen = 0;
+ int dataLen = 0;
- dataLen += snprintf(dataBuf + dataLen, maxLen - dataLen,
- "(%" PRId64 ", ", timestamp);
- dataLen += snprintf(dataBuf + dataLen, maxLen - dataLen,
- "%s", superTblInfo->sampleDataBuf + superTblInfo->lenOfOneRow * (*sampleUsePos));
- dataLen += snprintf(dataBuf + dataLen, maxLen - dataLen, ")");
+ dataLen += snprintf(dataBuf + dataLen, maxLen - dataLen,
+ "(%" PRId64 ", ", timestamp);
+ dataLen += snprintf(dataBuf + dataLen, maxLen - dataLen,
+ "%s",
+ superTblInfo->sampleDataBuf
+ + superTblInfo->lenOfOneRow * (*sampleUsePos));
+ dataLen += snprintf(dataBuf + dataLen, maxLen - dataLen, ")");
- (*sampleUsePos)++;
+ (*sampleUsePos)++;
- return dataLen;
+ return dataLen;
}
static int64_t generateStbRowData(
SSuperTable* stbInfo,
char* recBuf, int64_t timestamp)
{
- int64_t dataLen = 0;
- char *pstr = recBuf;
- int64_t maxLen = MAX_DATA_SIZE;
+ int64_t dataLen = 0;
+ char *pstr = recBuf;
+ int64_t maxLen = MAX_DATA_SIZE;
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
- "(%" PRId64 ",", timestamp);
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "(%" PRId64 ",", timestamp);
- for (int i = 0; i < stbInfo->columnCount; i++) {
- if ((0 == strncasecmp(stbInfo->columns[i].dataType,
- "BINARY", strlen("BINARY")))
- || (0 == strncasecmp(stbInfo->columns[i].dataType,
- "NCHAR", strlen("NCHAR")))) {
- if (stbInfo->columns[i].dataLen > TSDB_MAX_BINARY_LEN) {
- errorPrint( "binary or nchar length overflow, max size:%u\n",
- (uint32_t)TSDB_MAX_BINARY_LEN);
- return -1;
- }
+ for (int i = 0; i < stbInfo->columnCount; i++) {
+ if ((0 == strncasecmp(stbInfo->columns[i].dataType,
+ "BINARY", strlen("BINARY")))
+ || (0 == strncasecmp(stbInfo->columns[i].dataType,
+ "NCHAR", strlen("NCHAR")))) {
+ if (stbInfo->columns[i].dataLen > TSDB_MAX_BINARY_LEN) {
+ errorPrint( "binary or nchar length overflow, max size:%u\n",
+ (uint32_t)TSDB_MAX_BINARY_LEN);
+ return -1;
+ }
- char* buf = (char*)calloc(stbInfo->columns[i].dataLen+1, 1);
- if (NULL == buf) {
- errorPrint( "calloc failed! size:%d\n", stbInfo->columns[i].dataLen);
- return -1;
- }
- rand_string(buf, stbInfo->columns[i].dataLen);
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen, "\'%s\',", buf);
- tmfree(buf);
- } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
- "INT", strlen("INT"))) {
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
- "%d,", rand_int());
- } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
- "BIGINT", strlen("BIGINT"))) {
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
- "%"PRId64",", rand_bigint());
- } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
- "FLOAT", strlen("FLOAT"))) {
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
- "%f,", rand_float());
- } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
- "DOUBLE", strlen("DOUBLE"))) {
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
- "%f,", rand_double());
- } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
- "SMALLINT", strlen("SMALLINT"))) {
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
- "%d,", rand_smallint());
- } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
- "TINYINT", strlen("TINYINT"))) {
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
- "%d,", rand_tinyint());
- } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
- "BOOL", strlen("BOOL"))) {
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
- "%d,", rand_bool());
- } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
- "TIMESTAMP", strlen("TIMESTAMP"))) {
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
- "%"PRId64",", rand_bigint());
- } else {
- errorPrint( "Not support data type: %s\n", stbInfo->columns[i].dataType);
- return -1;
+ char* buf = (char*)calloc(stbInfo->columns[i].dataLen+1, 1);
+ if (NULL == buf) {
+ errorPrint( "calloc failed! size:%d\n", stbInfo->columns[i].dataLen);
+ return -1;
+ }
+ rand_string(buf, stbInfo->columns[i].dataLen);
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen, "\'%s\',", buf);
+ tmfree(buf);
+ } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
+ "INT", strlen("INT"))) {
+ if ((g_args.demo_mode) && (i == 1)) {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%d,", demo_voltage_int());
+ } else {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%d,", rand_int());
+ }
+ } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
+ "BIGINT", strlen("BIGINT"))) {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%"PRId64",", rand_bigint());
+ } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
+ "FLOAT", strlen("FLOAT"))) {
+ if (g_args.demo_mode) {
+ if (i == 0) {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%f,", demo_current_float());
+ } else {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%f,", demo_phase_float());
+ }
+ } else {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%f,", rand_float());
+ }
+ } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
+ "DOUBLE", strlen("DOUBLE"))) {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%f,", rand_double());
+ } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
+ "SMALLINT", strlen("SMALLINT"))) {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%d,", rand_smallint());
+ } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
+ "TINYINT", strlen("TINYINT"))) {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%d,", rand_tinyint());
+ } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
+ "BOOL", strlen("BOOL"))) {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%d,", rand_bool());
+ } else if (0 == strncasecmp(stbInfo->columns[i].dataType,
+ "TIMESTAMP", strlen("TIMESTAMP"))) {
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen,
+ "%"PRId64",", rand_bigint());
+ } else {
+ errorPrint( "Not support data type: %s\n", stbInfo->columns[i].dataType);
+ return -1;
+ }
}
- }
- dataLen -= 1;
- dataLen += snprintf(pstr + dataLen, maxLen - dataLen, ")");
+ dataLen -= 1;
+ dataLen += snprintf(pstr + dataLen, maxLen - dataLen, ")");
- verbosePrint("%s() LN%d, dataLen:%"PRId64"\n", __func__, __LINE__, dataLen);
- verbosePrint("%s() LN%d, recBuf:\n\t%s\n", __func__, __LINE__, recBuf);
+ verbosePrint("%s() LN%d, dataLen:%"PRId64"\n", __func__, __LINE__, dataLen);
+ verbosePrint("%s() LN%d, recBuf:\n\t%s\n", __func__, __LINE__, recBuf);
- return strlen(recBuf);
+ return strlen(recBuf);
}
static int64_t generateData(char *recBuf, char **data_type,
@@ -6008,8 +6086,10 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
errorPrint("[%d] %s() LN%d Failed to insert records of batch %d\n",
pThreadInfo->threadID, __func__, __LINE__,
batchPerTbl);
- errorPrint("\tIf the batch is %d, the length of the SQL to insert a row must be less then %"PRId64"\n",
- batchPerTbl, maxSqlLen / batchPerTbl);
+ if (batchPerTbl > 0) {
+ errorPrint("\tIf the batch is %d, the length of the SQL to insert a row must be less then %"PRId64"\n",
+ batchPerTbl, maxSqlLen / batchPerTbl);
+ }
errorPrint("\tPlease check if the buffer length(%"PRId64") or batch(%d) is set with proper value!\n",
maxSqlLen, batchPerTbl);
goto free_of_interlace;
diff --git a/src/kit/taosdump/taosdump.c b/src/kit/taosdump/taosdump.c
index b03d557309..98521d8420 100644
--- a/src/kit/taosdump/taosdump.c
+++ b/src/kit/taosdump/taosdump.c
@@ -124,6 +124,9 @@ typedef struct {
extern char version[];
+#define DB_PRECISION_LEN 8
+#define DB_STATUS_LEN 16
+
typedef struct {
char name[TSDB_DB_NAME_LEN];
char create_time[32];
@@ -144,9 +147,9 @@ typedef struct {
int32_t fsync;
int8_t comp;
int8_t cachelast;
- char precision[8]; // time resolution
+ char precision[DB_PRECISION_LEN]; // time resolution
int8_t update;
- char status[16];
+ char status[DB_STATUS_LEN];
} SDbInfo;
typedef struct {
@@ -542,7 +545,8 @@ static void parse_precision_first(
free(tmp);
exit(-1);
}
- strncpy(g_args.precision, tmp, strlen(tmp));
+ strncpy(g_args.precision, tmp,
+ min(DB_PRECISION_LEN - 1, strlen(tmp)));
free(tmp);
}
}
@@ -1596,6 +1600,7 @@ static void taosStartDumpOutWorkThreads(int32_t numOfThread, char *dbName)
NULL, g_args.port);
if (pThread->taosCon == NULL) {
errorPrint("Failed to connect to TDengine server %s\n", g_args.host);
+ free(threadObj);
return;
}
pthread_attr_init(&thattr);
@@ -2607,6 +2612,7 @@ static void taosStartDumpInWorkThreads()
NULL, g_args.port);
if (pThread->taosCon == NULL) {
errorPrint("Failed to connect to TDengine server %s\n", g_args.host);
+ free(threadObj);
return;
}
pthread_attr_init(&thattr);
diff --git a/src/query/inc/qExecutor.h b/src/query/inc/qExecutor.h
index 9cc310d820..e344bbacfc 100644
--- a/src/query/inc/qExecutor.h
+++ b/src/query/inc/qExecutor.h
@@ -106,7 +106,7 @@ typedef struct SResultRowInfo {
int16_t type:8; // data type for hash key
int32_t size:24; // number of result set
int32_t capacity; // max capacity
- SResultRow* current; // current active result row
+ int32_t curPos; // current active result row index of pResult list
} SResultRowInfo;
typedef struct SColumnFilterElem {
@@ -427,7 +427,7 @@ typedef struct STagScanInfo {
SColumnInfo* pCols;
SSDataBlock* pRes;
int32_t totalTables;
- int32_t currentIndex;
+ int32_t curPos;
} STagScanInfo;
typedef struct SOptrBasicInfo {
diff --git a/src/query/inc/sql.y b/src/query/inc/sql.y
index ee7f594e54..ecdde4f707 100644
--- a/src/query/inc/sql.y
+++ b/src/query/inc/sql.y
@@ -310,11 +310,13 @@ alter_db_optr(Y) ::= alter_db_optr(Z) quorum(X). { Y = Z; Y.quorum = strtol
alter_db_optr(Y) ::= alter_db_optr(Z) keep(X). { Y = Z; Y.keep = X; }
alter_db_optr(Y) ::= alter_db_optr(Z) blocks(X). { Y = Z; Y.numOfBlocks = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) comp(X). { Y = Z; Y.compressionLevel = strtol(X.z, NULL, 10); }
-alter_db_optr(Y) ::= alter_db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); }
-alter_db_optr(Y) ::= alter_db_optr(Z) fsync(X). { Y = Z; Y.fsyncPeriod = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) update(X). { Y = Z; Y.update = strtol(X.z, NULL, 10); }
alter_db_optr(Y) ::= alter_db_optr(Z) cachelast(X). { Y = Z; Y.cachelast = strtol(X.z, NULL, 10); }
+// dynamically update the following two parameters are not allowed.
+//alter_db_optr(Y) ::= alter_db_optr(Z) fsync(X). { Y = Z; Y.fsyncPeriod = strtol(X.z, NULL, 10); }
+//alter_db_optr(Y) ::= alter_db_optr(Z) wal(X). { Y = Z; Y.walLevel = strtol(X.z, NULL, 10); } not support yet
+
%type alter_topic_optr {SCreateDbInfo}
alter_topic_optr(Y) ::= alter_db_optr(Z). { Y = Z; Y.dbType = TSDB_DB_TYPE_TOPIC; }
diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c
index 17229d59a7..71ced7fc72 100644
--- a/src/query/src/qExecutor.c
+++ b/src/query/src/qExecutor.c
@@ -412,8 +412,8 @@ static void prepareResultListBuffer(SResultRowInfo* pResultRowInfo, SQueryRuntim
pResultRowInfo->capacity = (int32_t)newCapacity;
}
-static SResultRow *doPrepareResultRowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRowInfo, int64_t tid, char *pData,
- int16_t bytes, bool masterscan, uint64_t tableGroupId) {
+static SResultRow* doSetResultOutBufByKey(SQueryRuntimeEnv* pRuntimeEnv, SResultRowInfo* pResultRowInfo, int64_t tid,
+ char* pData, int16_t bytes, bool masterscan, uint64_t tableGroupId) {
bool existed = false;
SET_RES_WINDOW_KEY(pRuntimeEnv->keyBuf, pData, bytes, tableGroupId);
@@ -427,16 +427,21 @@ static SResultRow *doPrepareResultRowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SRes
}
if (p1 != NULL) {
- pResultRowInfo->current = (*p1);
-
if (pResultRowInfo->size == 0) {
existed = false;
+ assert(pResultRowInfo->curPos == -1);
} else if (pResultRowInfo->size == 1) {
existed = (pResultRowInfo->pResult[0] == (*p1));
+ pResultRowInfo->curPos = 0;
} else { // check if current pResultRowInfo contains the existed pResultRow
SET_RES_WINDOW_KEY(pRuntimeEnv->keyBuf, pData, bytes, tid);
- void* ptr = taosHashGet(pRuntimeEnv->pResultRowListSet, pRuntimeEnv->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
- existed = (ptr != NULL);
+ int64_t* index = taosHashGet(pRuntimeEnv->pResultRowListSet, pRuntimeEnv->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes));
+ if (index != NULL) {
+ pResultRowInfo->curPos = (int32_t) *index;
+ existed = true;
+ } else {
+ existed = false;
+ }
}
}
} else {
@@ -463,12 +468,12 @@ static SResultRow *doPrepareResultRowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SRes
pResult = *p1;
}
+ pResultRowInfo->curPos = pResultRowInfo->size;
pResultRowInfo->pResult[pResultRowInfo->size++] = pResult;
- pResultRowInfo->current = pResult;
- int64_t dummyVal = 0;
+ int64_t index = pResultRowInfo->curPos;
SET_RES_WINDOW_KEY(pRuntimeEnv->keyBuf, pData, bytes, tid);
- taosHashPut(pRuntimeEnv->pResultRowListSet, pRuntimeEnv->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes), &dummyVal, POINTER_BYTES);
+ taosHashPut(pRuntimeEnv->pResultRowListSet, pRuntimeEnv->keyBuf, GET_RES_WINDOW_KEY_LEN(bytes), &index, POINTER_BYTES);
}
// too many time window in query
@@ -476,7 +481,7 @@ static SResultRow *doPrepareResultRowFromKey(SQueryRuntimeEnv *pRuntimeEnv, SRes
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_TOO_MANY_TIMEWINDOW);
}
- return pResultRowInfo->current;
+ return pResultRowInfo->pResult[pResultRowInfo->curPos];
}
static void getInitialStartTimeWindow(SQueryAttr* pQueryAttr, TSKEY ts, STimeWindow* w) {
@@ -507,13 +512,8 @@ static void getInitialStartTimeWindow(SQueryAttr* pQueryAttr, TSKEY ts, STimeWin
static STimeWindow getActiveTimeWindow(SResultRowInfo * pResultRowInfo, int64_t ts, SQueryAttr *pQueryAttr) {
STimeWindow w = {0};
- if (pResultRowInfo->current == NULL) { // the first window, from the previous stored value
-// if (pResultRowInfo->prevSKey == TSKEY_INITIAL_VAL) {
- getInitialStartTimeWindow(pQueryAttr, ts, &w);
-// pResultRowInfo->prevSKey = w.skey;
-// } else {
-// w.skey = pResultRowInfo->prevSKey;
-// }
+ if (pResultRowInfo->curPos == -1) { // the first window, from the previous stored value
+ getInitialStartTimeWindow(pQueryAttr, ts, &w);
if (pQueryAttr->interval.intervalUnit == 'n' || pQueryAttr->interval.intervalUnit == 'y') {
w.ekey = taosTimeAdd(w.skey, pQueryAttr->interval.interval, pQueryAttr->interval.intervalUnit, pQueryAttr->precision) - 1;
@@ -521,7 +521,7 @@ static STimeWindow getActiveTimeWindow(SResultRowInfo * pResultRowInfo, int64_t
w.ekey = w.skey + pQueryAttr->interval.interval - 1;
}
} else {
- w = pResultRowInfo->current->win;
+ w = getResultRow(pResultRowInfo, pResultRowInfo->curPos)->win;
}
if (w.skey > ts || w.ekey < ts) {
@@ -601,13 +601,13 @@ static int32_t addNewWindowResultBuf(SResultRow *pWindowRes, SDiskbasedResultBuf
return 0;
}
-static int32_t setWindowOutputBufByKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRowInfo, int64_t tid, STimeWindow *win,
+static int32_t setResultOutputBufByKey(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRowInfo, int64_t tid, STimeWindow *win,
bool masterscan, SResultRow **pResult, int64_t tableGroupId, SQLFunctionCtx* pCtx,
int32_t numOfOutput, int32_t* rowCellInfoOffset) {
assert(win->skey <= win->ekey);
SDiskbasedResultBuf *pResultBuf = pRuntimeEnv->pResultBuf;
- SResultRow *pResultRow = doPrepareResultRowFromKey(pRuntimeEnv, pResultRowInfo, tid, (char *)&win->skey, TSDB_KEYSIZE, masterscan, tableGroupId);
+ SResultRow *pResultRow = doSetResultOutBufByKey(pRuntimeEnv, pResultRowInfo, tid, (char *)&win->skey, TSDB_KEYSIZE, masterscan, tableGroupId);
if (pResultRow == NULL) {
*pResult = NULL;
return TSDB_CODE_SUCCESS;
@@ -708,9 +708,10 @@ static void doUpdateResultRowIndex(SResultRowInfo*pResultRowInfo, TSKEY lastKey,
if (skey == TSKEY_INITIAL_VAL) {
if (pResultRowInfo->size == 0) {
// assert(pResultRowInfo->current == NULL);
- pResultRowInfo->current = NULL;
+ assert(pResultRowInfo->curPos == -1);
+ pResultRowInfo->curPos = -1;
} else {
- pResultRowInfo->current = pResultRowInfo->pResult[pResultRowInfo->size - 1];
+ pResultRowInfo->curPos = pResultRowInfo->size - 1;
}
} else {
@@ -722,9 +723,9 @@ static void doUpdateResultRowIndex(SResultRowInfo*pResultRowInfo, TSKEY lastKey,
}
if (i == pResultRowInfo->size - 1) {
- pResultRowInfo->current = pResultRowInfo->pResult[i];
+ pResultRowInfo->curPos = i;
} else {
- pResultRowInfo->current = pResultRowInfo->pResult[i + 1]; // current not closed result object
+ pResultRowInfo->curPos = i + 1; // current not closed result object
}
}
}
@@ -733,7 +734,7 @@ static void updateResultRowInfoActiveIndex(SResultRowInfo* pResultRowInfo, SQuer
bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr);
if ((lastKey > pQueryAttr->window.ekey && ascQuery) || (lastKey < pQueryAttr->window.ekey && (!ascQuery))) {
closeAllResultRows(pResultRowInfo);
- pResultRowInfo->current = pResultRowInfo->pResult[pResultRowInfo->size - 1];
+ pResultRowInfo->curPos = pResultRowInfo->size - 1;
} else {
int32_t step = ascQuery ? 1 : -1;
doUpdateResultRowIndex(pResultRowInfo, lastKey - step, ascQuery, pQueryAttr->timeWindowInterpo);
@@ -1343,7 +1344,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
int32_t step = GET_FORWARD_DIRECTION_FACTOR(pQueryAttr->order.order);
bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr);
- SResultRow* prevRow = pResultRowInfo->current;
+ int32_t prevIndex = pResultRowInfo->curPos;
TSKEY* tsCols = NULL;
if (pSDataBlock->pDataBlock != NULL) {
@@ -1360,7 +1361,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
bool masterScan = IS_MASTER_SCAN(pRuntimeEnv);
SResultRow* pResult = NULL;
- int32_t ret = setWindowOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &win, masterScan, &pResult, tableGroupId, pInfo->pCtx,
+ int32_t ret = setResultOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &win, masterScan, &pResult, tableGroupId, pInfo->pCtx,
numOfOutput, pInfo->rowCellInfoOffset);
if (ret != TSDB_CODE_SUCCESS || pResult == NULL) {
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
@@ -1372,25 +1373,17 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
getNumOfRowsInTimeWindow(pRuntimeEnv, &pSDataBlock->info, tsCols, startPos, ekey, binarySearchForKey, true);
// prev time window not interpolation yet.
-// int32_t curIndex = curTimeWindowIndex(pResultRowInfo);
-// if (prevIndex != -1 && prevIndex < curIndex && pQueryAttr->timeWindowInterpo) {
-// for (int32_t j = prevIndex; j < curIndex; ++j) { // previous time window may be all closed already.
- if (prevRow != NULL && prevRow != pResultRowInfo->current && pQueryAttr->timeWindowInterpo) {
- int32_t j = 0;
- while(pResultRowInfo->pResult[j] != prevRow) {
- j++;
- }
-
- SResultRow* current = pResultRowInfo->current;
- for(; pResultRowInfo->pResult[j] != current && j < pResultRowInfo->size; ++j) {
- SResultRow* pRes = pResultRowInfo->pResult[j];
+ int32_t curIndex = pResultRowInfo->curPos;
+ if (prevIndex != -1 && prevIndex < curIndex && pQueryAttr->timeWindowInterpo) {
+ for (int32_t j = prevIndex; j < curIndex; ++j) { // previous time window may be all closed already.
+ SResultRow* pRes = getResultRow(pResultRowInfo, j);
if (pRes->closed) {
assert(resultRowInterpolated(pRes, RESULT_ROW_START_INTERP) && resultRowInterpolated(pRes, RESULT_ROW_END_INTERP));
continue;
}
STimeWindow w = pRes->win;
- ret = setWindowOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &w, masterScan, &pResult,
+ ret = setResultOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &w, masterScan, &pResult,
tableGroupId, pInfo->pCtx, numOfOutput, pInfo->rowCellInfoOffset);
if (ret != TSDB_CODE_SUCCESS) {
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
@@ -1408,7 +1401,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
}
// restore current time window
- ret = setWindowOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &win, masterScan, &pResult, tableGroupId, pInfo->pCtx,
+ ret = setResultOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &win, masterScan, &pResult, tableGroupId, pInfo->pCtx,
numOfOutput, pInfo->rowCellInfoOffset);
if (ret != TSDB_CODE_SUCCESS) {
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
@@ -1428,7 +1421,7 @@ static void hashIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pResul
}
// null data, failed to allocate more memory buffer
- int32_t code = setWindowOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &nextWin, masterScan, &pResult, tableGroupId,
+ int32_t code = setResultOutputBufByKey(pRuntimeEnv, pResultRowInfo, pSDataBlock->info.tid, &nextWin, masterScan, &pResult, tableGroupId,
pInfo->pCtx, numOfOutput, pInfo->rowCellInfoOffset);
if (code != TSDB_CODE_SUCCESS || pResult == NULL) {
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
@@ -1569,7 +1562,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
SResultRow* pResult = NULL;
pInfo->curWindow.ekey = pInfo->curWindow.skey;
- int32_t ret = setWindowOutputBufByKey(pRuntimeEnv, &pBInfo->resultRowInfo, pSDataBlock->info.tid, &pInfo->curWindow, masterScan,
+ int32_t ret = setResultOutputBufByKey(pRuntimeEnv, &pBInfo->resultRowInfo, pSDataBlock->info.tid, &pInfo->curWindow, masterScan,
&pResult, item->groupIndex, pBInfo->pCtx, pOperator->numOfOutput,
pBInfo->rowCellInfoOffset);
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
@@ -1590,7 +1583,7 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
SResultRow* pResult = NULL;
pInfo->curWindow.ekey = pInfo->curWindow.skey;
- int32_t ret = setWindowOutputBufByKey(pRuntimeEnv, &pBInfo->resultRowInfo, pSDataBlock->info.tid, &pInfo->curWindow, masterScan,
+ int32_t ret = setResultOutputBufByKey(pRuntimeEnv, &pBInfo->resultRowInfo, pSDataBlock->info.tid, &pInfo->curWindow, masterScan,
&pResult, item->groupIndex, pBInfo->pCtx, pOperator->numOfOutput,
pBInfo->rowCellInfoOffset);
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
@@ -1634,7 +1627,7 @@ static int32_t setGroupResultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasic
}
int64_t tid = 0;
- SResultRow *pResultRow = doPrepareResultRowFromKey(pRuntimeEnv, pResultRowInfo, tid, d, len, true, groupIndex);
+ SResultRow *pResultRow = doSetResultOutBufByKey(pRuntimeEnv, pResultRowInfo, tid, d, len, true, groupIndex);
assert (pResultRow != NULL);
setResultRowKey(pResultRow, pData, type);
@@ -2888,7 +2881,7 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa
TSKEY k = ascQuery? pBlock->info.window.skey : pBlock->info.window.ekey;
STimeWindow win = getActiveTimeWindow(pTableScanInfo->pResultRowInfo, k, pQueryAttr);
- if (setWindowOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.tid, &win, masterScan, &pResult, groupId,
+ if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.tid, &win, masterScan, &pResult, groupId,
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
pTableScanInfo->rowCellInfoOffset) != TSDB_CODE_SUCCESS) {
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
@@ -2934,7 +2927,7 @@ int32_t loadDataBlockOnDemand(SQueryRuntimeEnv* pRuntimeEnv, STableScanInfo* pTa
TSKEY k = ascQuery? pBlock->info.window.skey : pBlock->info.window.ekey;
STimeWindow win = getActiveTimeWindow(pTableScanInfo->pResultRowInfo, k, pQueryAttr);
- if (setWindowOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.tid, &win, masterScan, &pResult, groupId,
+ if (setResultOutputBufByKey(pRuntimeEnv, pTableScanInfo->pResultRowInfo, pBlock->info.tid, &win, masterScan, &pResult, groupId,
pTableScanInfo->pCtx, pTableScanInfo->numOfOutput,
pTableScanInfo->rowCellInfoOffset) != TSDB_CODE_SUCCESS) {
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY);
@@ -3290,11 +3283,11 @@ static void updateTableQueryInfoForReverseScan(STableQueryInfo *pTableQueryInfo)
pTableQueryInfo->cur.vgroupIndex = -1;
// set the index to be the end slot of result rows array
- SResultRowInfo* pResRowInfo = &pTableQueryInfo->resInfo;
- if (pResRowInfo->size > 0) {
- pResRowInfo->current = pResRowInfo->pResult[pResRowInfo->size - 1];
+ SResultRowInfo* pResultRowInfo = &pTableQueryInfo->resInfo;
+ if (pResultRowInfo->size > 0) {
+ pResultRowInfo->curPos = pResultRowInfo->size - 1;
} else {
- pResRowInfo->current = NULL;
+ pResultRowInfo->curPos = -1;
}
}
@@ -3349,7 +3342,7 @@ void setDefaultOutputBuf(SQueryRuntimeEnv *pRuntimeEnv, SOptrBasicInfo *pInfo, i
SResultRowInfo* pResultRowInfo = &pInfo->resultRowInfo;
int64_t tid = 0;
- SResultRow* pRow = doPrepareResultRowFromKey(pRuntimeEnv, pResultRowInfo, tid, (char *)&tid, sizeof(tid), true, uid);
+ SResultRow* pRow = doSetResultOutBufByKey(pRuntimeEnv, pResultRowInfo, tid, (char *)&tid, sizeof(tid), true, uid);
for (int32_t i = 0; i < pDataBlock->info.numOfCols; ++i) {
SColumnInfoData* pData = taosArrayGet(pDataBlock->pDataBlock, i);
@@ -3619,7 +3612,7 @@ void doSetTableGroupOutputBuf(SQueryRuntimeEnv* pRuntimeEnv, SResultRowInfo* pRe
int64_t tid = 0;
SResultRow* pResultRow =
- doPrepareResultRowFromKey(pRuntimeEnv, pResultRowInfo, tid, (char*)&tableGroupId, sizeof(tableGroupId), true, uid);
+ doSetResultOutBufByKey(pRuntimeEnv, pResultRowInfo, tid, (char*)&tableGroupId, sizeof(tableGroupId), true, uid);
assert (pResultRow != NULL);
/*
@@ -3822,14 +3815,10 @@ void setIntervalQueryRange(SQueryRuntimeEnv *pRuntimeEnv, TSKEY key) {
STableQueryInfo *pTableQueryInfo = pRuntimeEnv->current;
SResultRowInfo *pResultRowInfo = &pTableQueryInfo->resInfo;
- if (pResultRowInfo->current != NULL) {
+ if (pResultRowInfo->curPos != -1) {
return;
}
-// if (pWindowResInfo->prevSKey != TSKEY_INITIAL_VAL) {
-// return;
-// }
-
pTableQueryInfo->win.skey = key;
STimeWindow win = {.skey = key, .ekey = pQueryAttr->window.ekey};
@@ -4751,8 +4740,7 @@ static SSDataBlock* doTableScan(void* param, bool *newgroup) {
}
if (pResultRowInfo->size > 0) {
- pResultRowInfo->current = pResultRowInfo->pResult[0];
-// pResultRowInfo->prevSKey = pResultRowInfo->pResult[0]->win.skey;
+ pResultRowInfo->curPos = 0;
}
qDebug("QInfo:0x%"PRIx64" start to repeat scan data blocks due to query func required, qrange:%" PRId64 "-%" PRId64,
@@ -4777,8 +4765,7 @@ static SSDataBlock* doTableScan(void* param, bool *newgroup) {
pTableScanInfo->order = cond.order;
if (pResultRowInfo->size > 0) {
- pResultRowInfo->current = pResultRowInfo->pResult[pResultRowInfo->size - 1];
-// pResultRowInfo->prevSKey = pResultRowInfo->current->win.skey;
+ pResultRowInfo->curPos = pResultRowInfo->size - 1;
}
p = doTableScanImpl(pOperator, newgroup);
@@ -5639,7 +5626,7 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
} else {
SResultRow* pResult = NULL;
pInfo->curWindow.ekey = pInfo->curWindow.skey;
- int32_t ret = setWindowOutputBufByKey(pRuntimeEnv, &pBInfo->resultRowInfo, pSDataBlock->info.tid, &pInfo->curWindow, masterScan,
+ int32_t ret = setResultOutputBufByKey(pRuntimeEnv, &pBInfo->resultRowInfo, pSDataBlock->info.tid, &pInfo->curWindow, masterScan,
&pResult, item->groupIndex, pBInfo->pCtx, pOperator->numOfOutput,
pBInfo->rowCellInfoOffset);
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
@@ -5656,10 +5643,11 @@ static void doStateWindowAggImpl(SOperatorInfo* pOperator, SStateWindowOperatorI
}
}
+
SResultRow* pResult = NULL;
pInfo->curWindow.ekey = pInfo->curWindow.skey;
- int32_t ret = setWindowOutputBufByKey(pRuntimeEnv, &pBInfo->resultRowInfo, pSDataBlock->info.tid, &pInfo->curWindow, masterScan,
+ int32_t ret = setResultOutputBufByKey(pRuntimeEnv, &pBInfo->resultRowInfo, pSDataBlock->info.tid, &pInfo->curWindow, masterScan,
&pResult, item->groupIndex, pBInfo->pCtx, pOperator->numOfOutput,
pBInfo->rowCellInfoOffset);
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
@@ -6437,8 +6425,8 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
SColumnInfoData* pColInfo = taosArrayGet(pRes->pDataBlock, 0);
- while(pInfo->currentIndex < pInfo->totalTables && count < maxNumOfTables) {
- int32_t i = pInfo->currentIndex++;
+ while(pInfo->curPos < pInfo->totalTables && count < maxNumOfTables) {
+ int32_t i = pInfo->curPos++;
STableQueryInfo *item = taosArrayGetP(pa, i);
char *output = pColInfo->pData + count * rsize;
@@ -6482,8 +6470,8 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
SExprInfo* pExprInfo = pOperator->pExpr; // todo use the column list instead of exprinfo
count = 0;
- while(pInfo->currentIndex < pInfo->totalTables && count < maxNumOfTables) {
- int32_t i = pInfo->currentIndex++;
+ while(pInfo->curPos < pInfo->totalTables && count < maxNumOfTables) {
+ int32_t i = pInfo->curPos++;
STableQueryInfo* item = taosArrayGetP(pa, i);
@@ -6512,7 +6500,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
count += 1;
}
- if (pInfo->currentIndex >= pInfo->totalTables) {
+ if (pInfo->curPos >= pInfo->totalTables) {
pOperator->status = OP_EXEC_DONE;
}
@@ -6531,7 +6519,7 @@ SOperatorInfo* createTagScanOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SExprInf
assert(numOfGroup == 0 || numOfGroup == 1);
pInfo->totalTables = pRuntimeEnv->tableqinfoGroupInfo.numOfTables;
- pInfo->currentIndex = 0;
+ pInfo->curPos = 0;
SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo));
pOperator->name = "SeqTableTagScan";
diff --git a/src/query/src/qUtil.c b/src/query/src/qUtil.c
index c14f46523d..04a7079128 100644
--- a/src/query/src/qUtil.c
+++ b/src/query/src/qUtil.c
@@ -44,8 +44,7 @@ int32_t getOutputInterResultBufSize(SQueryAttr* pQueryAttr) {
int32_t initResultRowInfo(SResultRowInfo *pResultRowInfo, int32_t size, int16_t type) {
pResultRowInfo->type = type;
pResultRowInfo->size = 0;
-// pResultRowInfo->prevSKey = TSKEY_INITIAL_VAL;
- pResultRowInfo->current = NULL;
+ pResultRowInfo->curPos = -1;
pResultRowInfo->capacity = size;
pResultRowInfo->pResult = calloc(pResultRowInfo->capacity, POINTER_BYTES);
@@ -92,8 +91,7 @@ void resetResultRowInfo(SQueryRuntimeEnv *pRuntimeEnv, SResultRowInfo *pResultRo
}
pResultRowInfo->size = 0;
- pResultRowInfo->current = NULL;
-// pResultRowInfo->prevSKey = TSKEY_INITIAL_VAL;
+ pResultRowInfo->curPos = -1;
}
int32_t numOfClosedResultRows(SResultRowInfo *pResultRowInfo) {
diff --git a/src/query/src/sql.c b/src/query/src/sql.c
index 96e40e24e0..8ee2384651 100644
--- a/src/query/src/sql.c
+++ b/src/query/src/sql.c
@@ -128,6 +128,7 @@ typedef union {
#define ParseARG_FETCH SSqlInfo* pInfo = yypParser->pInfo
#define ParseARG_STORE yypParser->pInfo = pInfo
#define YYFALLBACK 1
+<<<<<<< HEAD
#define YYNSTATE 362
#define YYNRULE 291
#define YYNTOKEN 195
@@ -139,6 +140,19 @@ typedef union {
#define YY_NO_ACTION 862
#define YY_MIN_REDUCE 863
#define YY_MAX_REDUCE 1153
+=======
+#define YYNSTATE 347
+#define YYNRULE 283
+#define YYNTOKEN 190
+#define YY_MAX_SHIFT 346
+#define YY_MIN_SHIFTREDUCE 547
+#define YY_MAX_SHIFTREDUCE 829
+#define YY_ERROR_ACTION 830
+#define YY_ACCEPT_ACTION 831
+#define YY_NO_ACTION 832
+#define YY_MIN_REDUCE 833
+#define YY_MAX_REDUCE 1115
+>>>>>>> dev
/************* End control #defines *******************************************/
/* Define the yytestcase() macro to be a no-op if is not already defined
@@ -204,6 +218,7 @@ typedef union {
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
+<<<<<<< HEAD
#define YY_ACTTAB_COUNT (757)
static const YYACTIONTYPE yy_action[] = {
/* 0 */ 206, 620, 245, 620, 620, 257, 1042, 94, 23, 621,
@@ -380,9 +395,183 @@ static const YYCODETYPE yy_lookahead[] = {
/* 930 */ 276, 276, 276, 276, 276, 276, 276, 276, 276, 276,
/* 940 */ 276, 276, 276, 276, 276, 276, 276, 276, 276, 276,
/* 950 */ 276, 276,
+=======
+#define YY_ACTTAB_COUNT (731)
+static const YYACTIONTYPE yy_action[] = {
+ /* 0 */ 23, 596, 1004, 596, 219, 344, 194, 831, 346, 597,
+ /* 10 */ 596, 597, 197, 54, 55, 225, 58, 59, 597, 982,
+ /* 20 */ 239, 48, 1091, 57, 302, 62, 60, 63, 61, 995,
+ /* 30 */ 995, 231, 233, 53, 52, 982, 982, 51, 50, 49,
+ /* 40 */ 54, 55, 35, 58, 59, 222, 223, 239, 48, 596,
+ /* 50 */ 57, 302, 62, 60, 63, 61, 995, 597, 152, 236,
+ /* 60 */ 53, 52, 235, 152, 51, 50, 49, 55, 1001, 58,
+ /* 70 */ 59, 770, 261, 239, 48, 240, 57, 302, 62, 60,
+ /* 80 */ 63, 61, 29, 83, 976, 221, 53, 52, 145, 979,
+ /* 90 */ 51, 50, 49, 548, 549, 550, 551, 552, 553, 554,
+ /* 100 */ 555, 556, 557, 558, 559, 560, 345, 771, 768, 220,
+ /* 110 */ 95, 77, 54, 55, 35, 58, 59, 42, 197, 239,
+ /* 120 */ 48, 197, 57, 302, 62, 60, 63, 61, 1092, 232,
+ /* 130 */ 1040, 1092, 53, 52, 197, 89, 51, 50, 49, 54,
+ /* 140 */ 56, 968, 58, 59, 1092, 970, 239, 48, 262, 57,
+ /* 150 */ 302, 62, 60, 63, 61, 268, 267, 229, 36, 53,
+ /* 160 */ 52, 979, 248, 51, 50, 49, 41, 298, 339, 338,
+ /* 170 */ 297, 296, 295, 337, 294, 293, 292, 336, 291, 335,
+ /* 180 */ 334, 944, 932, 933, 934, 935, 936, 937, 938, 939,
+ /* 190 */ 940, 941, 942, 943, 945, 946, 58, 59, 24, 980,
+ /* 200 */ 239, 48, 90, 57, 302, 62, 60, 63, 61, 51,
+ /* 210 */ 50, 49, 152, 53, 52, 205, 78, 51, 50, 49,
+ /* 220 */ 53, 52, 206, 300, 51, 50, 49, 129, 128, 204,
+ /* 230 */ 732, 238, 783, 307, 83, 772, 740, 775, 35, 778,
+ /* 240 */ 147, 238, 783, 116, 253, 772, 65, 775, 35, 778,
+ /* 250 */ 300, 332, 152, 257, 256, 35, 879, 62, 60, 63,
+ /* 260 */ 61, 179, 332, 217, 218, 53, 52, 303, 42, 51,
+ /* 270 */ 50, 49, 700, 217, 218, 697, 304, 698, 14, 699,
+ /* 280 */ 41, 230, 339, 338, 1041, 979, 280, 337, 340, 913,
+ /* 290 */ 260, 336, 75, 335, 334, 978, 1, 167, 311, 213,
+ /* 300 */ 628, 242, 979, 244, 245, 114, 108, 119, 94, 91,
+ /* 310 */ 64, 195, 118, 124, 127, 117, 952, 80, 950, 951,
+ /* 320 */ 64, 121, 282, 953, 88, 76, 247, 954, 35, 955,
+ /* 330 */ 956, 5, 38, 169, 92, 3, 180, 35, 168, 102,
+ /* 340 */ 97, 101, 784, 779, 35, 35, 35, 35, 716, 780,
+ /* 350 */ 676, 264, 784, 779, 188, 186, 184, 200, 967, 780,
+ /* 360 */ 35, 183, 132, 131, 130, 1088, 965, 966, 34, 969,
+ /* 370 */ 1087, 312, 243, 787, 241, 979, 310, 309, 322, 321,
+ /* 380 */ 313, 889, 701, 702, 979, 81, 179, 314, 318, 319,
+ /* 390 */ 320, 979, 979, 979, 979, 880, 774, 249, 777, 246,
+ /* 400 */ 179, 317, 316, 324, 773, 713, 776, 979, 343, 342,
+ /* 410 */ 137, 741, 143, 141, 140, 749, 750, 68, 71, 264,
+ /* 420 */ 686, 26, 237, 285, 16, 688, 15, 287, 720, 687,
+ /* 430 */ 36, 981, 9, 36, 33, 65, 804, 93, 785, 65,
+ /* 440 */ 595, 74, 6, 107, 1086, 106, 25, 18, 25, 17,
+ /* 450 */ 25, 705, 703, 706, 704, 20, 113, 19, 112, 72,
+ /* 460 */ 69, 215, 22, 288, 21, 126, 125, 216, 198, 675,
+ /* 470 */ 199, 201, 196, 202, 203, 208, 209, 210, 207, 193,
+ /* 480 */ 1111, 1103, 1051, 1050, 227, 1047, 1046, 228, 323, 45,
+ /* 490 */ 258, 144, 1003, 1014, 1011, 1012, 1016, 996, 142, 265,
+ /* 500 */ 146, 1033, 150, 274, 1032, 977, 163, 164, 269, 224,
+ /* 510 */ 781, 975, 165, 166, 892, 290, 731, 43, 782, 191,
+ /* 520 */ 283, 993, 39, 301, 154, 888, 308, 1110, 104, 1109,
+ /* 530 */ 1106, 170, 315, 73, 1102, 110, 271, 278, 70, 153,
+ /* 540 */ 47, 1101, 155, 1098, 281, 171, 910, 40, 279, 277,
+ /* 550 */ 37, 275, 44, 273, 192, 270, 156, 876, 120, 874,
+ /* 560 */ 122, 123, 872, 871, 250, 182, 869, 868, 867, 866,
+ /* 570 */ 865, 864, 185, 187, 861, 859, 857, 855, 189, 852,
+ /* 580 */ 190, 333, 263, 79, 46, 84, 115, 272, 1034, 325,
+ /* 590 */ 326, 327, 328, 329, 330, 331, 214, 341, 829, 234,
+ /* 600 */ 251, 252, 289, 828, 254, 255, 827, 211, 212, 809,
+ /* 610 */ 98, 810, 99, 259, 264, 284, 10, 82, 708, 266,
+ /* 620 */ 85, 30, 870, 174, 178, 863, 911, 172, 173, 175,
+ /* 630 */ 176, 4, 133, 177, 862, 912, 134, 135, 948, 136,
+ /* 640 */ 854, 733, 148, 853, 157, 158, 159, 160, 736, 161,
+ /* 650 */ 149, 162, 958, 2, 86, 226, 738, 87, 276, 31,
+ /* 660 */ 742, 151, 32, 13, 11, 27, 286, 28, 12, 641,
+ /* 670 */ 96, 94, 639, 638, 637, 635, 634, 633, 630, 299,
+ /* 680 */ 600, 100, 7, 305, 786, 788, 8, 306, 103, 105,
+ /* 690 */ 66, 67, 109, 111, 678, 36, 677, 674, 622, 620,
+ /* 700 */ 612, 618, 614, 616, 610, 608, 644, 643, 642, 640,
+ /* 710 */ 636, 632, 631, 181, 598, 564, 562, 833, 832, 832,
+ /* 720 */ 832, 832, 832, 832, 832, 832, 832, 832, 832, 138,
+ /* 730 */ 139,
+};
+static const YYCODETYPE yy_lookahead[] = {
+ /* 0 */ 259, 1, 194, 1, 193, 194, 259, 191, 192, 9,
+ /* 10 */ 1, 9, 259, 13, 14, 238, 16, 17, 9, 242,
+ /* 20 */ 20, 21, 269, 23, 24, 25, 26, 27, 28, 240,
+ /* 30 */ 240, 238, 238, 33, 34, 242, 242, 37, 38, 39,
+ /* 40 */ 13, 14, 194, 16, 17, 256, 256, 20, 21, 1,
+ /* 50 */ 23, 24, 25, 26, 27, 28, 240, 9, 194, 200,
+ /* 60 */ 33, 34, 200, 194, 37, 38, 39, 14, 260, 16,
+ /* 70 */ 17, 1, 256, 20, 21, 200, 23, 24, 25, 26,
+ /* 80 */ 27, 28, 80, 80, 194, 237, 33, 34, 194, 241,
+ /* 90 */ 37, 38, 39, 45, 46, 47, 48, 49, 50, 51,
+ /* 100 */ 52, 53, 54, 55, 56, 57, 58, 37, 81, 61,
+ /* 110 */ 201, 111, 13, 14, 194, 16, 17, 114, 259, 20,
+ /* 120 */ 21, 259, 23, 24, 25, 26, 27, 28, 269, 239,
+ /* 130 */ 266, 269, 33, 34, 259, 266, 37, 38, 39, 13,
+ /* 140 */ 14, 0, 16, 17, 269, 236, 20, 21, 81, 23,
+ /* 150 */ 24, 25, 26, 27, 28, 261, 262, 237, 91, 33,
+ /* 160 */ 34, 241, 194, 37, 38, 39, 92, 93, 94, 95,
+ /* 170 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
+ /* 180 */ 106, 215, 216, 217, 218, 219, 220, 221, 222, 223,
+ /* 190 */ 224, 225, 226, 227, 228, 229, 16, 17, 44, 231,
+ /* 200 */ 20, 21, 243, 23, 24, 25, 26, 27, 28, 37,
+ /* 210 */ 38, 39, 194, 33, 34, 61, 257, 37, 38, 39,
+ /* 220 */ 33, 34, 68, 82, 37, 38, 39, 73, 74, 75,
+ /* 230 */ 81, 1, 2, 79, 80, 5, 81, 7, 194, 9,
+ /* 240 */ 91, 1, 2, 76, 137, 5, 91, 7, 194, 9,
+ /* 250 */ 82, 84, 194, 146, 147, 194, 199, 25, 26, 27,
+ /* 260 */ 28, 204, 84, 33, 34, 33, 34, 37, 114, 37,
+ /* 270 */ 38, 39, 2, 33, 34, 5, 15, 7, 80, 9,
+ /* 280 */ 92, 237, 94, 95, 266, 241, 268, 99, 213, 214,
+ /* 290 */ 136, 103, 138, 105, 106, 241, 202, 203, 237, 145,
+ /* 300 */ 5, 68, 241, 33, 34, 62, 63, 64, 110, 111,
+ /* 310 */ 80, 259, 69, 70, 71, 72, 215, 81, 217, 218,
+ /* 320 */ 80, 78, 264, 222, 266, 201, 68, 226, 194, 228,
+ /* 330 */ 229, 62, 63, 64, 201, 197, 198, 194, 69, 70,
+ /* 340 */ 71, 72, 112, 113, 194, 194, 194, 194, 37, 119,
+ /* 350 */ 5, 115, 112, 113, 62, 63, 64, 259, 234, 119,
+ /* 360 */ 194, 69, 70, 71, 72, 259, 233, 234, 235, 236,
+ /* 370 */ 259, 237, 139, 112, 141, 241, 143, 144, 33, 34,
+ /* 380 */ 237, 199, 112, 113, 241, 81, 204, 237, 237, 237,
+ /* 390 */ 237, 241, 241, 241, 241, 199, 5, 139, 7, 141,
+ /* 400 */ 204, 143, 144, 237, 5, 91, 7, 241, 65, 66,
+ /* 410 */ 67, 81, 62, 63, 64, 127, 128, 91, 91, 115,
+ /* 420 */ 81, 91, 60, 81, 140, 81, 142, 81, 117, 81,
+ /* 430 */ 91, 242, 118, 91, 80, 91, 81, 91, 81, 91,
+ /* 440 */ 81, 80, 80, 140, 259, 142, 91, 140, 91, 142,
+ /* 450 */ 91, 5, 5, 7, 7, 140, 140, 142, 142, 132,
+ /* 460 */ 134, 259, 140, 109, 142, 76, 77, 259, 259, 108,
+ /* 470 */ 259, 259, 259, 259, 259, 259, 259, 259, 259, 259,
+ /* 480 */ 242, 242, 232, 232, 232, 232, 232, 232, 232, 258,
+ /* 490 */ 194, 194, 194, 194, 194, 194, 194, 240, 60, 240,
+ /* 500 */ 194, 267, 194, 194, 267, 240, 244, 194, 263, 263,
+ /* 510 */ 119, 194, 194, 194, 194, 194, 119, 194, 119, 194,
+ /* 520 */ 125, 255, 194, 194, 253, 194, 194, 194, 194, 194,
+ /* 530 */ 194, 194, 194, 131, 194, 194, 263, 263, 133, 254,
+ /* 540 */ 130, 194, 252, 194, 129, 194, 194, 194, 124, 123,
+ /* 550 */ 194, 122, 194, 121, 194, 120, 251, 194, 194, 194,
+ /* 560 */ 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
+ /* 570 */ 194, 194, 194, 194, 194, 194, 194, 194, 194, 194,
+ /* 580 */ 194, 107, 195, 195, 135, 195, 90, 195, 195, 89,
+ /* 590 */ 50, 86, 88, 54, 87, 85, 195, 82, 5, 195,
+ /* 600 */ 148, 5, 195, 5, 148, 5, 5, 195, 195, 93,
+ /* 610 */ 201, 94, 201, 137, 115, 109, 80, 116, 81, 91,
+ /* 620 */ 91, 80, 195, 206, 205, 195, 212, 211, 210, 209,
+ /* 630 */ 207, 197, 196, 208, 195, 214, 196, 196, 230, 196,
+ /* 640 */ 195, 81, 80, 195, 250, 249, 248, 247, 81, 246,
+ /* 650 */ 91, 245, 230, 202, 80, 1, 81, 80, 80, 91,
+ /* 660 */ 81, 80, 91, 80, 126, 80, 109, 80, 126, 9,
+ /* 670 */ 76, 110, 5, 5, 5, 5, 5, 5, 5, 15,
+ /* 680 */ 83, 76, 80, 24, 81, 112, 80, 58, 142, 142,
+ /* 690 */ 16, 16, 142, 142, 5, 91, 5, 81, 5, 5,
+ /* 700 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+ /* 710 */ 5, 5, 5, 91, 83, 60, 59, 0, 270, 270,
+ /* 720 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 21,
+ /* 730 */ 21, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 740 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 750 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 760 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 770 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 780 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 790 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 800 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 810 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 820 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 830 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 840 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 850 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 860 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 870 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 880 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 890 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 900 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 910 */ 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,
+ /* 920 */ 270,
+>>>>>>> dev
};
#define YY_SHIFT_COUNT (361)
#define YY_SHIFT_MIN (0)
+<<<<<<< HEAD
#define YY_SHIFT_MAX (743)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 162, 76, 76, 158, 158, 6, 227, 240, 240, 3,
@@ -487,6 +676,107 @@ static const YYACTIONTYPE yy_default[] = {
/* 340 */ 860, 860, 860, 860, 860, 860, 860, 860, 860, 860,
/* 350 */ 860, 860, 860, 860, 860, 951, 860, 889, 887, 860,
/* 360 */ 878, 860,
+=======
+#define YY_SHIFT_MAX (717)
+static const unsigned short int yy_shift_ofst[] = {
+ /* 0 */ 154, 74, 74, 188, 188, 168, 230, 240, 240, 2,
+ /* 10 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ /* 20 */ 9, 9, 9, 0, 48, 240, 270, 270, 270, 3,
+ /* 30 */ 3, 9, 9, 9, 141, 9, 9, 167, 168, 178,
+ /* 40 */ 178, 295, 731, 731, 731, 240, 240, 240, 240, 240,
+ /* 50 */ 240, 240, 240, 240, 240, 240, 240, 240, 240, 240,
+ /* 60 */ 240, 240, 240, 240, 240, 270, 270, 270, 345, 345,
+ /* 70 */ 345, 345, 345, 345, 345, 9, 9, 9, 311, 9,
+ /* 80 */ 9, 9, 3, 3, 9, 9, 9, 9, 288, 288,
+ /* 90 */ 314, 3, 9, 9, 9, 9, 9, 9, 9, 9,
+ /* 100 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ /* 110 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ /* 120 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ /* 130 */ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
+ /* 140 */ 9, 9, 9, 9, 438, 438, 438, 397, 397, 397,
+ /* 150 */ 438, 397, 438, 402, 405, 395, 410, 415, 424, 426,
+ /* 160 */ 429, 432, 435, 449, 438, 438, 438, 474, 168, 168,
+ /* 170 */ 438, 438, 496, 500, 540, 505, 504, 539, 507, 510,
+ /* 180 */ 474, 295, 438, 515, 515, 438, 515, 438, 515, 438,
+ /* 190 */ 438, 731, 731, 27, 99, 99, 126, 99, 53, 180,
+ /* 200 */ 232, 232, 232, 232, 243, 269, 292, 187, 187, 187,
+ /* 210 */ 187, 233, 258, 107, 198, 172, 172, 391, 399, 343,
+ /* 220 */ 350, 67, 236, 304, 149, 155, 330, 326, 327, 339,
+ /* 230 */ 342, 344, 346, 348, 354, 355, 357, 70, 362, 261,
+ /* 240 */ 359, 284, 303, 307, 446, 447, 315, 316, 361, 322,
+ /* 250 */ 389, 593, 452, 596, 598, 456, 600, 601, 517, 516,
+ /* 260 */ 476, 499, 506, 536, 501, 537, 541, 528, 529, 560,
+ /* 270 */ 562, 567, 559, 574, 575, 577, 654, 578, 579, 581,
+ /* 280 */ 568, 538, 571, 542, 583, 506, 585, 557, 587, 561,
+ /* 290 */ 594, 660, 667, 668, 669, 670, 671, 672, 673, 597,
+ /* 300 */ 664, 605, 602, 603, 573, 606, 659, 629, 674, 546,
+ /* 310 */ 547, 604, 604, 604, 604, 675, 550, 551, 604, 604,
+ /* 320 */ 604, 689, 691, 616, 604, 693, 694, 695, 696, 697,
+ /* 330 */ 698, 699, 700, 701, 702, 703, 704, 705, 706, 707,
+ /* 340 */ 622, 631, 708, 709, 655, 657, 717,
+};
+#define YY_REDUCE_COUNT (192)
+#define YY_REDUCE_MIN (-259)
+#define YY_REDUCE_MAX (451)
+static const short yy_reduce_ofst[] = {
+ /* 0 */ -184, -34, -34, 101, 101, 133, -141, -138, -125, -106,
+ /* 10 */ -152, 18, 58, -80, 44, 61, 134, 143, 150, 151,
+ /* 20 */ 152, 153, 166, -192, -189, -247, -223, -207, -206, -211,
+ /* 30 */ -210, -136, -131, -110, -91, -32, 54, 57, 124, 182,
+ /* 40 */ 196, 75, -41, 94, 138, -259, -253, 52, 98, 106,
+ /* 50 */ 111, 185, 202, 208, 209, 211, 212, 213, 214, 215,
+ /* 60 */ 216, 217, 218, 219, 220, 189, 238, 239, 250, 251,
+ /* 70 */ 252, 253, 254, 255, 256, 296, 297, 298, 231, 299,
+ /* 80 */ 300, 301, 257, 259, 302, 306, 308, 309, 234, 237,
+ /* 90 */ 262, 265, 313, 317, 318, 319, 320, 321, 323, 325,
+ /* 100 */ 328, 329, 331, 332, 333, 334, 335, 336, 337, 338,
+ /* 110 */ 340, 341, 347, 349, 351, 352, 353, 356, 358, 360,
+ /* 120 */ 363, 364, 365, 366, 367, 368, 369, 370, 371, 372,
+ /* 130 */ 373, 374, 375, 376, 377, 378, 379, 380, 381, 382,
+ /* 140 */ 383, 384, 385, 386, 387, 388, 390, 245, 246, 273,
+ /* 150 */ 392, 274, 393, 266, 285, 271, 290, 305, 394, 396,
+ /* 160 */ 398, 400, 403, 406, 401, 404, 407, 408, 409, 411,
+ /* 170 */ 412, 413, 414, 416, 418, 417, 420, 423, 425, 419,
+ /* 180 */ 422, 421, 427, 436, 440, 430, 441, 439, 443, 445,
+ /* 190 */ 448, 451, 434,
+};
+static const YYACTIONTYPE yy_default[] = {
+ /* 0 */ 830, 947, 890, 957, 877, 887, 1094, 1094, 1094, 830,
+ /* 10 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 20 */ 830, 830, 830, 1005, 849, 1094, 830, 830, 830, 830,
+ /* 30 */ 830, 830, 830, 830, 887, 830, 830, 893, 887, 893,
+ /* 40 */ 893, 830, 1000, 931, 949, 830, 830, 830, 830, 830,
+ /* 50 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 60 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 70 */ 830, 830, 830, 830, 830, 830, 830, 830, 1007, 1013,
+ /* 80 */ 1010, 830, 830, 830, 1015, 830, 830, 830, 1037, 1037,
+ /* 90 */ 998, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 100 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 110 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 120 */ 875, 830, 873, 830, 830, 830, 830, 830, 830, 830,
+ /* 130 */ 830, 830, 830, 830, 830, 830, 830, 860, 830, 830,
+ /* 140 */ 830, 830, 830, 830, 851, 851, 851, 830, 830, 830,
+ /* 150 */ 851, 830, 851, 1044, 1048, 1030, 1042, 1038, 1029, 1025,
+ /* 160 */ 1023, 1021, 1020, 1052, 851, 851, 851, 891, 887, 887,
+ /* 170 */ 851, 851, 909, 907, 905, 897, 903, 899, 901, 895,
+ /* 180 */ 878, 830, 851, 885, 885, 851, 885, 851, 885, 851,
+ /* 190 */ 851, 931, 949, 830, 1053, 1043, 830, 1093, 1083, 1082,
+ /* 200 */ 1089, 1081, 1080, 1079, 830, 830, 830, 1075, 1078, 1077,
+ /* 210 */ 1076, 830, 830, 830, 830, 1085, 1084, 830, 830, 830,
+ /* 220 */ 830, 830, 830, 830, 830, 830, 830, 1049, 1045, 830,
+ /* 230 */ 830, 830, 830, 830, 830, 830, 830, 830, 1055, 830,
+ /* 240 */ 830, 830, 830, 830, 830, 830, 830, 830, 959, 830,
+ /* 250 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 260 */ 830, 997, 830, 830, 830, 830, 830, 1009, 1008, 830,
+ /* 270 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 280 */ 1039, 830, 1031, 830, 830, 971, 830, 830, 830, 830,
+ /* 290 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 300 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 310 */ 830, 1112, 1107, 1108, 1105, 830, 830, 830, 1104, 1099,
+ /* 320 */ 1100, 830, 830, 830, 1097, 830, 830, 830, 830, 830,
+ /* 330 */ 830, 830, 830, 830, 830, 830, 830, 830, 830, 830,
+ /* 340 */ 915, 830, 858, 856, 830, 847, 830,
+>>>>>>> dev
};
/********** End of lemon-generated parsing tables *****************************/
@@ -834,6 +1124,7 @@ static const char *const yyTokenName[] = {
/* 44 */ "SHOW",
/* 45 */ "DATABASES",
/* 46 */ "TOPICS",
+<<<<<<< HEAD
/* 47 */ "FUNCTIONS",
/* 48 */ "MNODES",
/* 49 */ "DNODES",
@@ -1063,6 +1354,231 @@ static const char *const yyTokenName[] = {
/* 273 */ "sortorder",
/* 274 */ "grouplist",
/* 275 */ "expritem",
+=======
+ /* 47 */ "MNODES",
+ /* 48 */ "DNODES",
+ /* 49 */ "ACCOUNTS",
+ /* 50 */ "USERS",
+ /* 51 */ "MODULES",
+ /* 52 */ "QUERIES",
+ /* 53 */ "CONNECTIONS",
+ /* 54 */ "STREAMS",
+ /* 55 */ "VARIABLES",
+ /* 56 */ "SCORES",
+ /* 57 */ "GRANTS",
+ /* 58 */ "VNODES",
+ /* 59 */ "IPTOKEN",
+ /* 60 */ "DOT",
+ /* 61 */ "CREATE",
+ /* 62 */ "TABLE",
+ /* 63 */ "STABLE",
+ /* 64 */ "DATABASE",
+ /* 65 */ "TABLES",
+ /* 66 */ "STABLES",
+ /* 67 */ "VGROUPS",
+ /* 68 */ "DROP",
+ /* 69 */ "TOPIC",
+ /* 70 */ "DNODE",
+ /* 71 */ "USER",
+ /* 72 */ "ACCOUNT",
+ /* 73 */ "USE",
+ /* 74 */ "DESCRIBE",
+ /* 75 */ "ALTER",
+ /* 76 */ "PASS",
+ /* 77 */ "PRIVILEGE",
+ /* 78 */ "LOCAL",
+ /* 79 */ "COMPACT",
+ /* 80 */ "LP",
+ /* 81 */ "RP",
+ /* 82 */ "IF",
+ /* 83 */ "EXISTS",
+ /* 84 */ "PPS",
+ /* 85 */ "TSERIES",
+ /* 86 */ "DBS",
+ /* 87 */ "STORAGE",
+ /* 88 */ "QTIME",
+ /* 89 */ "CONNS",
+ /* 90 */ "STATE",
+ /* 91 */ "COMMA",
+ /* 92 */ "KEEP",
+ /* 93 */ "CACHE",
+ /* 94 */ "REPLICA",
+ /* 95 */ "QUORUM",
+ /* 96 */ "DAYS",
+ /* 97 */ "MINROWS",
+ /* 98 */ "MAXROWS",
+ /* 99 */ "BLOCKS",
+ /* 100 */ "CTIME",
+ /* 101 */ "WAL",
+ /* 102 */ "FSYNC",
+ /* 103 */ "COMP",
+ /* 104 */ "PRECISION",
+ /* 105 */ "UPDATE",
+ /* 106 */ "CACHELAST",
+ /* 107 */ "PARTITIONS",
+ /* 108 */ "UNSIGNED",
+ /* 109 */ "TAGS",
+ /* 110 */ "USING",
+ /* 111 */ "AS",
+ /* 112 */ "NULL",
+ /* 113 */ "NOW",
+ /* 114 */ "SELECT",
+ /* 115 */ "UNION",
+ /* 116 */ "ALL",
+ /* 117 */ "DISTINCT",
+ /* 118 */ "FROM",
+ /* 119 */ "VARIABLE",
+ /* 120 */ "INTERVAL",
+ /* 121 */ "SESSION",
+ /* 122 */ "STATE_WINDOW",
+ /* 123 */ "FILL",
+ /* 124 */ "SLIDING",
+ /* 125 */ "ORDER",
+ /* 126 */ "BY",
+ /* 127 */ "ASC",
+ /* 128 */ "DESC",
+ /* 129 */ "GROUP",
+ /* 130 */ "HAVING",
+ /* 131 */ "LIMIT",
+ /* 132 */ "OFFSET",
+ /* 133 */ "SLIMIT",
+ /* 134 */ "SOFFSET",
+ /* 135 */ "WHERE",
+ /* 136 */ "RESET",
+ /* 137 */ "QUERY",
+ /* 138 */ "SYNCDB",
+ /* 139 */ "ADD",
+ /* 140 */ "COLUMN",
+ /* 141 */ "MODIFY",
+ /* 142 */ "TAG",
+ /* 143 */ "CHANGE",
+ /* 144 */ "SET",
+ /* 145 */ "KILL",
+ /* 146 */ "CONNECTION",
+ /* 147 */ "STREAM",
+ /* 148 */ "COLON",
+ /* 149 */ "ABORT",
+ /* 150 */ "AFTER",
+ /* 151 */ "ATTACH",
+ /* 152 */ "BEFORE",
+ /* 153 */ "BEGIN",
+ /* 154 */ "CASCADE",
+ /* 155 */ "CLUSTER",
+ /* 156 */ "CONFLICT",
+ /* 157 */ "COPY",
+ /* 158 */ "DEFERRED",
+ /* 159 */ "DELIMITERS",
+ /* 160 */ "DETACH",
+ /* 161 */ "EACH",
+ /* 162 */ "END",
+ /* 163 */ "EXPLAIN",
+ /* 164 */ "FAIL",
+ /* 165 */ "FOR",
+ /* 166 */ "IGNORE",
+ /* 167 */ "IMMEDIATE",
+ /* 168 */ "INITIALLY",
+ /* 169 */ "INSTEAD",
+ /* 170 */ "MATCH",
+ /* 171 */ "KEY",
+ /* 172 */ "OF",
+ /* 173 */ "RAISE",
+ /* 174 */ "REPLACE",
+ /* 175 */ "RESTRICT",
+ /* 176 */ "ROW",
+ /* 177 */ "STATEMENT",
+ /* 178 */ "TRIGGER",
+ /* 179 */ "VIEW",
+ /* 180 */ "SEMI",
+ /* 181 */ "NONE",
+ /* 182 */ "PREV",
+ /* 183 */ "LINEAR",
+ /* 184 */ "IMPORT",
+ /* 185 */ "TBNAME",
+ /* 186 */ "JOIN",
+ /* 187 */ "INSERT",
+ /* 188 */ "INTO",
+ /* 189 */ "VALUES",
+ /* 190 */ "error",
+ /* 191 */ "program",
+ /* 192 */ "cmd",
+ /* 193 */ "dbPrefix",
+ /* 194 */ "ids",
+ /* 195 */ "cpxName",
+ /* 196 */ "ifexists",
+ /* 197 */ "alter_db_optr",
+ /* 198 */ "alter_topic_optr",
+ /* 199 */ "acct_optr",
+ /* 200 */ "exprlist",
+ /* 201 */ "ifnotexists",
+ /* 202 */ "db_optr",
+ /* 203 */ "topic_optr",
+ /* 204 */ "pps",
+ /* 205 */ "tseries",
+ /* 206 */ "dbs",
+ /* 207 */ "streams",
+ /* 208 */ "storage",
+ /* 209 */ "qtime",
+ /* 210 */ "users",
+ /* 211 */ "conns",
+ /* 212 */ "state",
+ /* 213 */ "intitemlist",
+ /* 214 */ "intitem",
+ /* 215 */ "keep",
+ /* 216 */ "cache",
+ /* 217 */ "replica",
+ /* 218 */ "quorum",
+ /* 219 */ "days",
+ /* 220 */ "minrows",
+ /* 221 */ "maxrows",
+ /* 222 */ "blocks",
+ /* 223 */ "ctime",
+ /* 224 */ "wal",
+ /* 225 */ "fsync",
+ /* 226 */ "comp",
+ /* 227 */ "prec",
+ /* 228 */ "update",
+ /* 229 */ "cachelast",
+ /* 230 */ "partitions",
+ /* 231 */ "typename",
+ /* 232 */ "signed",
+ /* 233 */ "create_table_args",
+ /* 234 */ "create_stable_args",
+ /* 235 */ "create_table_list",
+ /* 236 */ "create_from_stable",
+ /* 237 */ "columnlist",
+ /* 238 */ "tagitemlist",
+ /* 239 */ "tagNamelist",
+ /* 240 */ "select",
+ /* 241 */ "column",
+ /* 242 */ "tagitem",
+ /* 243 */ "selcollist",
+ /* 244 */ "from",
+ /* 245 */ "where_opt",
+ /* 246 */ "interval_opt",
+ /* 247 */ "session_option",
+ /* 248 */ "windowstate_option",
+ /* 249 */ "fill_opt",
+ /* 250 */ "sliding_opt",
+ /* 251 */ "groupby_opt",
+ /* 252 */ "having_opt",
+ /* 253 */ "orderby_opt",
+ /* 254 */ "slimit_opt",
+ /* 255 */ "limit_opt",
+ /* 256 */ "union",
+ /* 257 */ "sclp",
+ /* 258 */ "distinct",
+ /* 259 */ "expr",
+ /* 260 */ "as",
+ /* 261 */ "tablelist",
+ /* 262 */ "sub",
+ /* 263 */ "tmvar",
+ /* 264 */ "sortlist",
+ /* 265 */ "sortitem",
+ /* 266 */ "item",
+ /* 267 */ "sortorder",
+ /* 268 */ "grouplist",
+ /* 269 */ "expritem",
+>>>>>>> dev
};
#endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */
@@ -1073,6 +1589,7 @@ static const char *const yyRuleName[] = {
/* 0 */ "program ::= cmd",
/* 1 */ "cmd ::= SHOW DATABASES",
/* 2 */ "cmd ::= SHOW TOPICS",
+<<<<<<< HEAD
/* 3 */ "cmd ::= SHOW FUNCTIONS",
/* 4 */ "cmd ::= SHOW MNODES",
/* 5 */ "cmd ::= SHOW DNODES",
@@ -1361,6 +1878,288 @@ static const char *const yyRuleName[] = {
/* 288 */ "cmd ::= KILL CONNECTION INTEGER",
/* 289 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
/* 290 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
+=======
+ /* 3 */ "cmd ::= SHOW MNODES",
+ /* 4 */ "cmd ::= SHOW DNODES",
+ /* 5 */ "cmd ::= SHOW ACCOUNTS",
+ /* 6 */ "cmd ::= SHOW USERS",
+ /* 7 */ "cmd ::= SHOW MODULES",
+ /* 8 */ "cmd ::= SHOW QUERIES",
+ /* 9 */ "cmd ::= SHOW CONNECTIONS",
+ /* 10 */ "cmd ::= SHOW STREAMS",
+ /* 11 */ "cmd ::= SHOW VARIABLES",
+ /* 12 */ "cmd ::= SHOW SCORES",
+ /* 13 */ "cmd ::= SHOW GRANTS",
+ /* 14 */ "cmd ::= SHOW VNODES",
+ /* 15 */ "cmd ::= SHOW VNODES IPTOKEN",
+ /* 16 */ "dbPrefix ::=",
+ /* 17 */ "dbPrefix ::= ids DOT",
+ /* 18 */ "cpxName ::=",
+ /* 19 */ "cpxName ::= DOT ids",
+ /* 20 */ "cmd ::= SHOW CREATE TABLE ids cpxName",
+ /* 21 */ "cmd ::= SHOW CREATE STABLE ids cpxName",
+ /* 22 */ "cmd ::= SHOW CREATE DATABASE ids",
+ /* 23 */ "cmd ::= SHOW dbPrefix TABLES",
+ /* 24 */ "cmd ::= SHOW dbPrefix TABLES LIKE ids",
+ /* 25 */ "cmd ::= SHOW dbPrefix STABLES",
+ /* 26 */ "cmd ::= SHOW dbPrefix STABLES LIKE ids",
+ /* 27 */ "cmd ::= SHOW dbPrefix VGROUPS",
+ /* 28 */ "cmd ::= SHOW dbPrefix VGROUPS ids",
+ /* 29 */ "cmd ::= DROP TABLE ifexists ids cpxName",
+ /* 30 */ "cmd ::= DROP STABLE ifexists ids cpxName",
+ /* 31 */ "cmd ::= DROP DATABASE ifexists ids",
+ /* 32 */ "cmd ::= DROP TOPIC ifexists ids",
+ /* 33 */ "cmd ::= DROP DNODE ids",
+ /* 34 */ "cmd ::= DROP USER ids",
+ /* 35 */ "cmd ::= DROP ACCOUNT ids",
+ /* 36 */ "cmd ::= USE ids",
+ /* 37 */ "cmd ::= DESCRIBE ids cpxName",
+ /* 38 */ "cmd ::= ALTER USER ids PASS ids",
+ /* 39 */ "cmd ::= ALTER USER ids PRIVILEGE ids",
+ /* 40 */ "cmd ::= ALTER DNODE ids ids",
+ /* 41 */ "cmd ::= ALTER DNODE ids ids ids",
+ /* 42 */ "cmd ::= ALTER LOCAL ids",
+ /* 43 */ "cmd ::= ALTER LOCAL ids ids",
+ /* 44 */ "cmd ::= ALTER DATABASE ids alter_db_optr",
+ /* 45 */ "cmd ::= ALTER TOPIC ids alter_topic_optr",
+ /* 46 */ "cmd ::= ALTER ACCOUNT ids acct_optr",
+ /* 47 */ "cmd ::= ALTER ACCOUNT ids PASS ids acct_optr",
+ /* 48 */ "cmd ::= COMPACT VNODES IN LP exprlist RP",
+ /* 49 */ "ids ::= ID",
+ /* 50 */ "ids ::= STRING",
+ /* 51 */ "ifexists ::= IF EXISTS",
+ /* 52 */ "ifexists ::=",
+ /* 53 */ "ifnotexists ::= IF NOT EXISTS",
+ /* 54 */ "ifnotexists ::=",
+ /* 55 */ "cmd ::= CREATE DNODE ids",
+ /* 56 */ "cmd ::= CREATE ACCOUNT ids PASS ids acct_optr",
+ /* 57 */ "cmd ::= CREATE DATABASE ifnotexists ids db_optr",
+ /* 58 */ "cmd ::= CREATE TOPIC ifnotexists ids topic_optr",
+ /* 59 */ "cmd ::= CREATE USER ids PASS ids",
+ /* 60 */ "pps ::=",
+ /* 61 */ "pps ::= PPS INTEGER",
+ /* 62 */ "tseries ::=",
+ /* 63 */ "tseries ::= TSERIES INTEGER",
+ /* 64 */ "dbs ::=",
+ /* 65 */ "dbs ::= DBS INTEGER",
+ /* 66 */ "streams ::=",
+ /* 67 */ "streams ::= STREAMS INTEGER",
+ /* 68 */ "storage ::=",
+ /* 69 */ "storage ::= STORAGE INTEGER",
+ /* 70 */ "qtime ::=",
+ /* 71 */ "qtime ::= QTIME INTEGER",
+ /* 72 */ "users ::=",
+ /* 73 */ "users ::= USERS INTEGER",
+ /* 74 */ "conns ::=",
+ /* 75 */ "conns ::= CONNS INTEGER",
+ /* 76 */ "state ::=",
+ /* 77 */ "state ::= STATE ids",
+ /* 78 */ "acct_optr ::= pps tseries storage streams qtime dbs users conns state",
+ /* 79 */ "intitemlist ::= intitemlist COMMA intitem",
+ /* 80 */ "intitemlist ::= intitem",
+ /* 81 */ "intitem ::= INTEGER",
+ /* 82 */ "keep ::= KEEP intitemlist",
+ /* 83 */ "cache ::= CACHE INTEGER",
+ /* 84 */ "replica ::= REPLICA INTEGER",
+ /* 85 */ "quorum ::= QUORUM INTEGER",
+ /* 86 */ "days ::= DAYS INTEGER",
+ /* 87 */ "minrows ::= MINROWS INTEGER",
+ /* 88 */ "maxrows ::= MAXROWS INTEGER",
+ /* 89 */ "blocks ::= BLOCKS INTEGER",
+ /* 90 */ "ctime ::= CTIME INTEGER",
+ /* 91 */ "wal ::= WAL INTEGER",
+ /* 92 */ "fsync ::= FSYNC INTEGER",
+ /* 93 */ "comp ::= COMP INTEGER",
+ /* 94 */ "prec ::= PRECISION STRING",
+ /* 95 */ "update ::= UPDATE INTEGER",
+ /* 96 */ "cachelast ::= CACHELAST INTEGER",
+ /* 97 */ "partitions ::= PARTITIONS INTEGER",
+ /* 98 */ "db_optr ::=",
+ /* 99 */ "db_optr ::= db_optr cache",
+ /* 100 */ "db_optr ::= db_optr replica",
+ /* 101 */ "db_optr ::= db_optr quorum",
+ /* 102 */ "db_optr ::= db_optr days",
+ /* 103 */ "db_optr ::= db_optr minrows",
+ /* 104 */ "db_optr ::= db_optr maxrows",
+ /* 105 */ "db_optr ::= db_optr blocks",
+ /* 106 */ "db_optr ::= db_optr ctime",
+ /* 107 */ "db_optr ::= db_optr wal",
+ /* 108 */ "db_optr ::= db_optr fsync",
+ /* 109 */ "db_optr ::= db_optr comp",
+ /* 110 */ "db_optr ::= db_optr prec",
+ /* 111 */ "db_optr ::= db_optr keep",
+ /* 112 */ "db_optr ::= db_optr update",
+ /* 113 */ "db_optr ::= db_optr cachelast",
+ /* 114 */ "topic_optr ::= db_optr",
+ /* 115 */ "topic_optr ::= topic_optr partitions",
+ /* 116 */ "alter_db_optr ::=",
+ /* 117 */ "alter_db_optr ::= alter_db_optr replica",
+ /* 118 */ "alter_db_optr ::= alter_db_optr quorum",
+ /* 119 */ "alter_db_optr ::= alter_db_optr keep",
+ /* 120 */ "alter_db_optr ::= alter_db_optr blocks",
+ /* 121 */ "alter_db_optr ::= alter_db_optr comp",
+ /* 122 */ "alter_db_optr ::= alter_db_optr update",
+ /* 123 */ "alter_db_optr ::= alter_db_optr cachelast",
+ /* 124 */ "alter_topic_optr ::= alter_db_optr",
+ /* 125 */ "alter_topic_optr ::= alter_topic_optr partitions",
+ /* 126 */ "typename ::= ids",
+ /* 127 */ "typename ::= ids LP signed RP",
+ /* 128 */ "typename ::= ids UNSIGNED",
+ /* 129 */ "signed ::= INTEGER",
+ /* 130 */ "signed ::= PLUS INTEGER",
+ /* 131 */ "signed ::= MINUS INTEGER",
+ /* 132 */ "cmd ::= CREATE TABLE create_table_args",
+ /* 133 */ "cmd ::= CREATE TABLE create_stable_args",
+ /* 134 */ "cmd ::= CREATE STABLE create_stable_args",
+ /* 135 */ "cmd ::= CREATE TABLE create_table_list",
+ /* 136 */ "create_table_list ::= create_from_stable",
+ /* 137 */ "create_table_list ::= create_table_list create_from_stable",
+ /* 138 */ "create_table_args ::= ifnotexists ids cpxName LP columnlist RP",
+ /* 139 */ "create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP",
+ /* 140 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP",
+ /* 141 */ "create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP",
+ /* 142 */ "tagNamelist ::= tagNamelist COMMA ids",
+ /* 143 */ "tagNamelist ::= ids",
+ /* 144 */ "create_table_args ::= ifnotexists ids cpxName AS select",
+ /* 145 */ "columnlist ::= columnlist COMMA column",
+ /* 146 */ "columnlist ::= column",
+ /* 147 */ "column ::= ids typename",
+ /* 148 */ "tagitemlist ::= tagitemlist COMMA tagitem",
+ /* 149 */ "tagitemlist ::= tagitem",
+ /* 150 */ "tagitem ::= INTEGER",
+ /* 151 */ "tagitem ::= FLOAT",
+ /* 152 */ "tagitem ::= STRING",
+ /* 153 */ "tagitem ::= BOOL",
+ /* 154 */ "tagitem ::= NULL",
+ /* 155 */ "tagitem ::= NOW",
+ /* 156 */ "tagitem ::= MINUS INTEGER",
+ /* 157 */ "tagitem ::= MINUS FLOAT",
+ /* 158 */ "tagitem ::= PLUS INTEGER",
+ /* 159 */ "tagitem ::= PLUS FLOAT",
+ /* 160 */ "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",
+ /* 161 */ "select ::= LP select RP",
+ /* 162 */ "union ::= select",
+ /* 163 */ "union ::= union UNION ALL select",
+ /* 164 */ "cmd ::= union",
+ /* 165 */ "select ::= SELECT selcollist",
+ /* 166 */ "sclp ::= selcollist COMMA",
+ /* 167 */ "sclp ::=",
+ /* 168 */ "selcollist ::= sclp distinct expr as",
+ /* 169 */ "selcollist ::= sclp STAR",
+ /* 170 */ "as ::= AS ids",
+ /* 171 */ "as ::= ids",
+ /* 172 */ "as ::=",
+ /* 173 */ "distinct ::= DISTINCT",
+ /* 174 */ "distinct ::=",
+ /* 175 */ "from ::= FROM tablelist",
+ /* 176 */ "from ::= FROM sub",
+ /* 177 */ "sub ::= LP union RP",
+ /* 178 */ "sub ::= LP union RP ids",
+ /* 179 */ "sub ::= sub COMMA LP union RP ids",
+ /* 180 */ "tablelist ::= ids cpxName",
+ /* 181 */ "tablelist ::= ids cpxName ids",
+ /* 182 */ "tablelist ::= tablelist COMMA ids cpxName",
+ /* 183 */ "tablelist ::= tablelist COMMA ids cpxName ids",
+ /* 184 */ "tmvar ::= VARIABLE",
+ /* 185 */ "interval_opt ::= INTERVAL LP tmvar RP",
+ /* 186 */ "interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP",
+ /* 187 */ "interval_opt ::=",
+ /* 188 */ "session_option ::=",
+ /* 189 */ "session_option ::= SESSION LP ids cpxName COMMA tmvar RP",
+ /* 190 */ "windowstate_option ::=",
+ /* 191 */ "windowstate_option ::= STATE_WINDOW LP ids RP",
+ /* 192 */ "fill_opt ::=",
+ /* 193 */ "fill_opt ::= FILL LP ID COMMA tagitemlist RP",
+ /* 194 */ "fill_opt ::= FILL LP ID RP",
+ /* 195 */ "sliding_opt ::= SLIDING LP tmvar RP",
+ /* 196 */ "sliding_opt ::=",
+ /* 197 */ "orderby_opt ::=",
+ /* 198 */ "orderby_opt ::= ORDER BY sortlist",
+ /* 199 */ "sortlist ::= sortlist COMMA item sortorder",
+ /* 200 */ "sortlist ::= item sortorder",
+ /* 201 */ "item ::= ids cpxName",
+ /* 202 */ "sortorder ::= ASC",
+ /* 203 */ "sortorder ::= DESC",
+ /* 204 */ "sortorder ::=",
+ /* 205 */ "groupby_opt ::=",
+ /* 206 */ "groupby_opt ::= GROUP BY grouplist",
+ /* 207 */ "grouplist ::= grouplist COMMA item",
+ /* 208 */ "grouplist ::= item",
+ /* 209 */ "having_opt ::=",
+ /* 210 */ "having_opt ::= HAVING expr",
+ /* 211 */ "limit_opt ::=",
+ /* 212 */ "limit_opt ::= LIMIT signed",
+ /* 213 */ "limit_opt ::= LIMIT signed OFFSET signed",
+ /* 214 */ "limit_opt ::= LIMIT signed COMMA signed",
+ /* 215 */ "slimit_opt ::=",
+ /* 216 */ "slimit_opt ::= SLIMIT signed",
+ /* 217 */ "slimit_opt ::= SLIMIT signed SOFFSET signed",
+ /* 218 */ "slimit_opt ::= SLIMIT signed COMMA signed",
+ /* 219 */ "where_opt ::=",
+ /* 220 */ "where_opt ::= WHERE expr",
+ /* 221 */ "expr ::= LP expr RP",
+ /* 222 */ "expr ::= ID",
+ /* 223 */ "expr ::= ID DOT ID",
+ /* 224 */ "expr ::= ID DOT STAR",
+ /* 225 */ "expr ::= INTEGER",
+ /* 226 */ "expr ::= MINUS INTEGER",
+ /* 227 */ "expr ::= PLUS INTEGER",
+ /* 228 */ "expr ::= FLOAT",
+ /* 229 */ "expr ::= MINUS FLOAT",
+ /* 230 */ "expr ::= PLUS FLOAT",
+ /* 231 */ "expr ::= STRING",
+ /* 232 */ "expr ::= NOW",
+ /* 233 */ "expr ::= VARIABLE",
+ /* 234 */ "expr ::= PLUS VARIABLE",
+ /* 235 */ "expr ::= MINUS VARIABLE",
+ /* 236 */ "expr ::= BOOL",
+ /* 237 */ "expr ::= NULL",
+ /* 238 */ "expr ::= ID LP exprlist RP",
+ /* 239 */ "expr ::= ID LP STAR RP",
+ /* 240 */ "expr ::= expr IS NULL",
+ /* 241 */ "expr ::= expr IS NOT NULL",
+ /* 242 */ "expr ::= expr LT expr",
+ /* 243 */ "expr ::= expr GT expr",
+ /* 244 */ "expr ::= expr LE expr",
+ /* 245 */ "expr ::= expr GE expr",
+ /* 246 */ "expr ::= expr NE expr",
+ /* 247 */ "expr ::= expr EQ expr",
+ /* 248 */ "expr ::= expr BETWEEN expr AND expr",
+ /* 249 */ "expr ::= expr AND expr",
+ /* 250 */ "expr ::= expr OR expr",
+ /* 251 */ "expr ::= expr PLUS expr",
+ /* 252 */ "expr ::= expr MINUS expr",
+ /* 253 */ "expr ::= expr STAR expr",
+ /* 254 */ "expr ::= expr SLASH expr",
+ /* 255 */ "expr ::= expr REM expr",
+ /* 256 */ "expr ::= expr LIKE expr",
+ /* 257 */ "expr ::= expr IN LP exprlist RP",
+ /* 258 */ "exprlist ::= exprlist COMMA expritem",
+ /* 259 */ "exprlist ::= expritem",
+ /* 260 */ "expritem ::= expr",
+ /* 261 */ "expritem ::=",
+ /* 262 */ "cmd ::= RESET QUERY CACHE",
+ /* 263 */ "cmd ::= SYNCDB ids REPLICA",
+ /* 264 */ "cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist",
+ /* 265 */ "cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids",
+ /* 266 */ "cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist",
+ /* 267 */ "cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist",
+ /* 268 */ "cmd ::= ALTER TABLE ids cpxName DROP TAG ids",
+ /* 269 */ "cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids",
+ /* 270 */ "cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem",
+ /* 271 */ "cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist",
+ /* 272 */ "cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist",
+ /* 273 */ "cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids",
+ /* 274 */ "cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist",
+ /* 275 */ "cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist",
+ /* 276 */ "cmd ::= ALTER STABLE ids cpxName DROP TAG ids",
+ /* 277 */ "cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids",
+ /* 278 */ "cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem",
+ /* 279 */ "cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist",
+ /* 280 */ "cmd ::= KILL CONNECTION INTEGER",
+ /* 281 */ "cmd ::= KILL STREAM INTEGER COLON INTEGER",
+ /* 282 */ "cmd ::= KILL QUERY INTEGER COLON INTEGER",
+>>>>>>> dev
};
#endif /* NDEBUG */
@@ -1488,6 +2287,7 @@ static void yy_destructor(
tSqlExprListDestroy((yypminor->yy525));
}
break;
+<<<<<<< HEAD
case 220: /* intitemlist */
case 222: /* keep */
case 243: /* columnlist */
@@ -1500,6 +2300,20 @@ tSqlExprListDestroy((yypminor->yy525));
case 274: /* grouplist */
{
taosArrayDestroy((yypminor->yy525));
+=======
+ case 213: /* intitemlist */
+ case 215: /* keep */
+ case 237: /* columnlist */
+ case 238: /* tagitemlist */
+ case 239: /* tagNamelist */
+ case 249: /* fill_opt */
+ case 251: /* groupby_opt */
+ case 253: /* orderby_opt */
+ case 264: /* sortlist */
+ case 268: /* grouplist */
+{
+taosArrayDestroy((yypminor->yy441));
+>>>>>>> dev
}
break;
case 241: /* create_table_list */
@@ -1519,10 +2333,17 @@ destroySqlNode((yypminor->yy464));
destroyRelationInfo((yypminor->yy412));
}
break;
+<<<<<<< HEAD
case 251: /* where_opt */
case 258: /* having_opt */
case 265: /* expr */
case 275: /* expritem */
+=======
+ case 245: /* where_opt */
+ case 252: /* having_opt */
+ case 259: /* expr */
+ case 269: /* expritem */
+>>>>>>> dev
{
tSqlExprDestroy((yypminor->yy370));
}
@@ -1828,6 +2649,7 @@ static const struct {
YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
+<<<<<<< HEAD
{ 196, -1 }, /* (0) program ::= cmd */
{ 197, -2 }, /* (1) cmd ::= SHOW DATABASES */
{ 197, -2 }, /* (2) cmd ::= SHOW TOPICS */
@@ -2119,6 +2941,291 @@ static const struct {
{ 197, -3 }, /* (288) cmd ::= KILL CONNECTION INTEGER */
{ 197, -5 }, /* (289) cmd ::= KILL STREAM INTEGER COLON INTEGER */
{ 197, -5 }, /* (290) cmd ::= KILL QUERY INTEGER COLON INTEGER */
+=======
+ { 191, -1 }, /* (0) program ::= cmd */
+ { 192, -2 }, /* (1) cmd ::= SHOW DATABASES */
+ { 192, -2 }, /* (2) cmd ::= SHOW TOPICS */
+ { 192, -2 }, /* (3) cmd ::= SHOW MNODES */
+ { 192, -2 }, /* (4) cmd ::= SHOW DNODES */
+ { 192, -2 }, /* (5) cmd ::= SHOW ACCOUNTS */
+ { 192, -2 }, /* (6) cmd ::= SHOW USERS */
+ { 192, -2 }, /* (7) cmd ::= SHOW MODULES */
+ { 192, -2 }, /* (8) cmd ::= SHOW QUERIES */
+ { 192, -2 }, /* (9) cmd ::= SHOW CONNECTIONS */
+ { 192, -2 }, /* (10) cmd ::= SHOW STREAMS */
+ { 192, -2 }, /* (11) cmd ::= SHOW VARIABLES */
+ { 192, -2 }, /* (12) cmd ::= SHOW SCORES */
+ { 192, -2 }, /* (13) cmd ::= SHOW GRANTS */
+ { 192, -2 }, /* (14) cmd ::= SHOW VNODES */
+ { 192, -3 }, /* (15) cmd ::= SHOW VNODES IPTOKEN */
+ { 193, 0 }, /* (16) dbPrefix ::= */
+ { 193, -2 }, /* (17) dbPrefix ::= ids DOT */
+ { 195, 0 }, /* (18) cpxName ::= */
+ { 195, -2 }, /* (19) cpxName ::= DOT ids */
+ { 192, -5 }, /* (20) cmd ::= SHOW CREATE TABLE ids cpxName */
+ { 192, -5 }, /* (21) cmd ::= SHOW CREATE STABLE ids cpxName */
+ { 192, -4 }, /* (22) cmd ::= SHOW CREATE DATABASE ids */
+ { 192, -3 }, /* (23) cmd ::= SHOW dbPrefix TABLES */
+ { 192, -5 }, /* (24) cmd ::= SHOW dbPrefix TABLES LIKE ids */
+ { 192, -3 }, /* (25) cmd ::= SHOW dbPrefix STABLES */
+ { 192, -5 }, /* (26) cmd ::= SHOW dbPrefix STABLES LIKE ids */
+ { 192, -3 }, /* (27) cmd ::= SHOW dbPrefix VGROUPS */
+ { 192, -4 }, /* (28) cmd ::= SHOW dbPrefix VGROUPS ids */
+ { 192, -5 }, /* (29) cmd ::= DROP TABLE ifexists ids cpxName */
+ { 192, -5 }, /* (30) cmd ::= DROP STABLE ifexists ids cpxName */
+ { 192, -4 }, /* (31) cmd ::= DROP DATABASE ifexists ids */
+ { 192, -4 }, /* (32) cmd ::= DROP TOPIC ifexists ids */
+ { 192, -3 }, /* (33) cmd ::= DROP DNODE ids */
+ { 192, -3 }, /* (34) cmd ::= DROP USER ids */
+ { 192, -3 }, /* (35) cmd ::= DROP ACCOUNT ids */
+ { 192, -2 }, /* (36) cmd ::= USE ids */
+ { 192, -3 }, /* (37) cmd ::= DESCRIBE ids cpxName */
+ { 192, -5 }, /* (38) cmd ::= ALTER USER ids PASS ids */
+ { 192, -5 }, /* (39) cmd ::= ALTER USER ids PRIVILEGE ids */
+ { 192, -4 }, /* (40) cmd ::= ALTER DNODE ids ids */
+ { 192, -5 }, /* (41) cmd ::= ALTER DNODE ids ids ids */
+ { 192, -3 }, /* (42) cmd ::= ALTER LOCAL ids */
+ { 192, -4 }, /* (43) cmd ::= ALTER LOCAL ids ids */
+ { 192, -4 }, /* (44) cmd ::= ALTER DATABASE ids alter_db_optr */
+ { 192, -4 }, /* (45) cmd ::= ALTER TOPIC ids alter_topic_optr */
+ { 192, -4 }, /* (46) cmd ::= ALTER ACCOUNT ids acct_optr */
+ { 192, -6 }, /* (47) cmd ::= ALTER ACCOUNT ids PASS ids acct_optr */
+ { 192, -6 }, /* (48) cmd ::= COMPACT VNODES IN LP exprlist RP */
+ { 194, -1 }, /* (49) ids ::= ID */
+ { 194, -1 }, /* (50) ids ::= STRING */
+ { 196, -2 }, /* (51) ifexists ::= IF EXISTS */
+ { 196, 0 }, /* (52) ifexists ::= */
+ { 201, -3 }, /* (53) ifnotexists ::= IF NOT EXISTS */
+ { 201, 0 }, /* (54) ifnotexists ::= */
+ { 192, -3 }, /* (55) cmd ::= CREATE DNODE ids */
+ { 192, -6 }, /* (56) cmd ::= CREATE ACCOUNT ids PASS ids acct_optr */
+ { 192, -5 }, /* (57) cmd ::= CREATE DATABASE ifnotexists ids db_optr */
+ { 192, -5 }, /* (58) cmd ::= CREATE TOPIC ifnotexists ids topic_optr */
+ { 192, -5 }, /* (59) cmd ::= CREATE USER ids PASS ids */
+ { 204, 0 }, /* (60) pps ::= */
+ { 204, -2 }, /* (61) pps ::= PPS INTEGER */
+ { 205, 0 }, /* (62) tseries ::= */
+ { 205, -2 }, /* (63) tseries ::= TSERIES INTEGER */
+ { 206, 0 }, /* (64) dbs ::= */
+ { 206, -2 }, /* (65) dbs ::= DBS INTEGER */
+ { 207, 0 }, /* (66) streams ::= */
+ { 207, -2 }, /* (67) streams ::= STREAMS INTEGER */
+ { 208, 0 }, /* (68) storage ::= */
+ { 208, -2 }, /* (69) storage ::= STORAGE INTEGER */
+ { 209, 0 }, /* (70) qtime ::= */
+ { 209, -2 }, /* (71) qtime ::= QTIME INTEGER */
+ { 210, 0 }, /* (72) users ::= */
+ { 210, -2 }, /* (73) users ::= USERS INTEGER */
+ { 211, 0 }, /* (74) conns ::= */
+ { 211, -2 }, /* (75) conns ::= CONNS INTEGER */
+ { 212, 0 }, /* (76) state ::= */
+ { 212, -2 }, /* (77) state ::= STATE ids */
+ { 199, -9 }, /* (78) acct_optr ::= pps tseries storage streams qtime dbs users conns state */
+ { 213, -3 }, /* (79) intitemlist ::= intitemlist COMMA intitem */
+ { 213, -1 }, /* (80) intitemlist ::= intitem */
+ { 214, -1 }, /* (81) intitem ::= INTEGER */
+ { 215, -2 }, /* (82) keep ::= KEEP intitemlist */
+ { 216, -2 }, /* (83) cache ::= CACHE INTEGER */
+ { 217, -2 }, /* (84) replica ::= REPLICA INTEGER */
+ { 218, -2 }, /* (85) quorum ::= QUORUM INTEGER */
+ { 219, -2 }, /* (86) days ::= DAYS INTEGER */
+ { 220, -2 }, /* (87) minrows ::= MINROWS INTEGER */
+ { 221, -2 }, /* (88) maxrows ::= MAXROWS INTEGER */
+ { 222, -2 }, /* (89) blocks ::= BLOCKS INTEGER */
+ { 223, -2 }, /* (90) ctime ::= CTIME INTEGER */
+ { 224, -2 }, /* (91) wal ::= WAL INTEGER */
+ { 225, -2 }, /* (92) fsync ::= FSYNC INTEGER */
+ { 226, -2 }, /* (93) comp ::= COMP INTEGER */
+ { 227, -2 }, /* (94) prec ::= PRECISION STRING */
+ { 228, -2 }, /* (95) update ::= UPDATE INTEGER */
+ { 229, -2 }, /* (96) cachelast ::= CACHELAST INTEGER */
+ { 230, -2 }, /* (97) partitions ::= PARTITIONS INTEGER */
+ { 202, 0 }, /* (98) db_optr ::= */
+ { 202, -2 }, /* (99) db_optr ::= db_optr cache */
+ { 202, -2 }, /* (100) db_optr ::= db_optr replica */
+ { 202, -2 }, /* (101) db_optr ::= db_optr quorum */
+ { 202, -2 }, /* (102) db_optr ::= db_optr days */
+ { 202, -2 }, /* (103) db_optr ::= db_optr minrows */
+ { 202, -2 }, /* (104) db_optr ::= db_optr maxrows */
+ { 202, -2 }, /* (105) db_optr ::= db_optr blocks */
+ { 202, -2 }, /* (106) db_optr ::= db_optr ctime */
+ { 202, -2 }, /* (107) db_optr ::= db_optr wal */
+ { 202, -2 }, /* (108) db_optr ::= db_optr fsync */
+ { 202, -2 }, /* (109) db_optr ::= db_optr comp */
+ { 202, -2 }, /* (110) db_optr ::= db_optr prec */
+ { 202, -2 }, /* (111) db_optr ::= db_optr keep */
+ { 202, -2 }, /* (112) db_optr ::= db_optr update */
+ { 202, -2 }, /* (113) db_optr ::= db_optr cachelast */
+ { 203, -1 }, /* (114) topic_optr ::= db_optr */
+ { 203, -2 }, /* (115) topic_optr ::= topic_optr partitions */
+ { 197, 0 }, /* (116) alter_db_optr ::= */
+ { 197, -2 }, /* (117) alter_db_optr ::= alter_db_optr replica */
+ { 197, -2 }, /* (118) alter_db_optr ::= alter_db_optr quorum */
+ { 197, -2 }, /* (119) alter_db_optr ::= alter_db_optr keep */
+ { 197, -2 }, /* (120) alter_db_optr ::= alter_db_optr blocks */
+ { 197, -2 }, /* (121) alter_db_optr ::= alter_db_optr comp */
+ { 197, -2 }, /* (122) alter_db_optr ::= alter_db_optr update */
+ { 197, -2 }, /* (123) alter_db_optr ::= alter_db_optr cachelast */
+ { 198, -1 }, /* (124) alter_topic_optr ::= alter_db_optr */
+ { 198, -2 }, /* (125) alter_topic_optr ::= alter_topic_optr partitions */
+ { 231, -1 }, /* (126) typename ::= ids */
+ { 231, -4 }, /* (127) typename ::= ids LP signed RP */
+ { 231, -2 }, /* (128) typename ::= ids UNSIGNED */
+ { 232, -1 }, /* (129) signed ::= INTEGER */
+ { 232, -2 }, /* (130) signed ::= PLUS INTEGER */
+ { 232, -2 }, /* (131) signed ::= MINUS INTEGER */
+ { 192, -3 }, /* (132) cmd ::= CREATE TABLE create_table_args */
+ { 192, -3 }, /* (133) cmd ::= CREATE TABLE create_stable_args */
+ { 192, -3 }, /* (134) cmd ::= CREATE STABLE create_stable_args */
+ { 192, -3 }, /* (135) cmd ::= CREATE TABLE create_table_list */
+ { 235, -1 }, /* (136) create_table_list ::= create_from_stable */
+ { 235, -2 }, /* (137) create_table_list ::= create_table_list create_from_stable */
+ { 233, -6 }, /* (138) create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
+ { 234, -10 }, /* (139) create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
+ { 236, -10 }, /* (140) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
+ { 236, -13 }, /* (141) create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
+ { 239, -3 }, /* (142) tagNamelist ::= tagNamelist COMMA ids */
+ { 239, -1 }, /* (143) tagNamelist ::= ids */
+ { 233, -5 }, /* (144) create_table_args ::= ifnotexists ids cpxName AS select */
+ { 237, -3 }, /* (145) columnlist ::= columnlist COMMA column */
+ { 237, -1 }, /* (146) columnlist ::= column */
+ { 241, -2 }, /* (147) column ::= ids typename */
+ { 238, -3 }, /* (148) tagitemlist ::= tagitemlist COMMA tagitem */
+ { 238, -1 }, /* (149) tagitemlist ::= tagitem */
+ { 242, -1 }, /* (150) tagitem ::= INTEGER */
+ { 242, -1 }, /* (151) tagitem ::= FLOAT */
+ { 242, -1 }, /* (152) tagitem ::= STRING */
+ { 242, -1 }, /* (153) tagitem ::= BOOL */
+ { 242, -1 }, /* (154) tagitem ::= NULL */
+ { 242, -1 }, /* (155) tagitem ::= NOW */
+ { 242, -2 }, /* (156) tagitem ::= MINUS INTEGER */
+ { 242, -2 }, /* (157) tagitem ::= MINUS FLOAT */
+ { 242, -2 }, /* (158) tagitem ::= PLUS INTEGER */
+ { 242, -2 }, /* (159) tagitem ::= PLUS FLOAT */
+ { 240, -14 }, /* (160) 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 */
+ { 240, -3 }, /* (161) select ::= LP select RP */
+ { 256, -1 }, /* (162) union ::= select */
+ { 256, -4 }, /* (163) union ::= union UNION ALL select */
+ { 192, -1 }, /* (164) cmd ::= union */
+ { 240, -2 }, /* (165) select ::= SELECT selcollist */
+ { 257, -2 }, /* (166) sclp ::= selcollist COMMA */
+ { 257, 0 }, /* (167) sclp ::= */
+ { 243, -4 }, /* (168) selcollist ::= sclp distinct expr as */
+ { 243, -2 }, /* (169) selcollist ::= sclp STAR */
+ { 260, -2 }, /* (170) as ::= AS ids */
+ { 260, -1 }, /* (171) as ::= ids */
+ { 260, 0 }, /* (172) as ::= */
+ { 258, -1 }, /* (173) distinct ::= DISTINCT */
+ { 258, 0 }, /* (174) distinct ::= */
+ { 244, -2 }, /* (175) from ::= FROM tablelist */
+ { 244, -2 }, /* (176) from ::= FROM sub */
+ { 262, -3 }, /* (177) sub ::= LP union RP */
+ { 262, -4 }, /* (178) sub ::= LP union RP ids */
+ { 262, -6 }, /* (179) sub ::= sub COMMA LP union RP ids */
+ { 261, -2 }, /* (180) tablelist ::= ids cpxName */
+ { 261, -3 }, /* (181) tablelist ::= ids cpxName ids */
+ { 261, -4 }, /* (182) tablelist ::= tablelist COMMA ids cpxName */
+ { 261, -5 }, /* (183) tablelist ::= tablelist COMMA ids cpxName ids */
+ { 263, -1 }, /* (184) tmvar ::= VARIABLE */
+ { 246, -4 }, /* (185) interval_opt ::= INTERVAL LP tmvar RP */
+ { 246, -6 }, /* (186) interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
+ { 246, 0 }, /* (187) interval_opt ::= */
+ { 247, 0 }, /* (188) session_option ::= */
+ { 247, -7 }, /* (189) session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
+ { 248, 0 }, /* (190) windowstate_option ::= */
+ { 248, -4 }, /* (191) windowstate_option ::= STATE_WINDOW LP ids RP */
+ { 249, 0 }, /* (192) fill_opt ::= */
+ { 249, -6 }, /* (193) fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+ { 249, -4 }, /* (194) fill_opt ::= FILL LP ID RP */
+ { 250, -4 }, /* (195) sliding_opt ::= SLIDING LP tmvar RP */
+ { 250, 0 }, /* (196) sliding_opt ::= */
+ { 253, 0 }, /* (197) orderby_opt ::= */
+ { 253, -3 }, /* (198) orderby_opt ::= ORDER BY sortlist */
+ { 264, -4 }, /* (199) sortlist ::= sortlist COMMA item sortorder */
+ { 264, -2 }, /* (200) sortlist ::= item sortorder */
+ { 266, -2 }, /* (201) item ::= ids cpxName */
+ { 267, -1 }, /* (202) sortorder ::= ASC */
+ { 267, -1 }, /* (203) sortorder ::= DESC */
+ { 267, 0 }, /* (204) sortorder ::= */
+ { 251, 0 }, /* (205) groupby_opt ::= */
+ { 251, -3 }, /* (206) groupby_opt ::= GROUP BY grouplist */
+ { 268, -3 }, /* (207) grouplist ::= grouplist COMMA item */
+ { 268, -1 }, /* (208) grouplist ::= item */
+ { 252, 0 }, /* (209) having_opt ::= */
+ { 252, -2 }, /* (210) having_opt ::= HAVING expr */
+ { 255, 0 }, /* (211) limit_opt ::= */
+ { 255, -2 }, /* (212) limit_opt ::= LIMIT signed */
+ { 255, -4 }, /* (213) limit_opt ::= LIMIT signed OFFSET signed */
+ { 255, -4 }, /* (214) limit_opt ::= LIMIT signed COMMA signed */
+ { 254, 0 }, /* (215) slimit_opt ::= */
+ { 254, -2 }, /* (216) slimit_opt ::= SLIMIT signed */
+ { 254, -4 }, /* (217) slimit_opt ::= SLIMIT signed SOFFSET signed */
+ { 254, -4 }, /* (218) slimit_opt ::= SLIMIT signed COMMA signed */
+ { 245, 0 }, /* (219) where_opt ::= */
+ { 245, -2 }, /* (220) where_opt ::= WHERE expr */
+ { 259, -3 }, /* (221) expr ::= LP expr RP */
+ { 259, -1 }, /* (222) expr ::= ID */
+ { 259, -3 }, /* (223) expr ::= ID DOT ID */
+ { 259, -3 }, /* (224) expr ::= ID DOT STAR */
+ { 259, -1 }, /* (225) expr ::= INTEGER */
+ { 259, -2 }, /* (226) expr ::= MINUS INTEGER */
+ { 259, -2 }, /* (227) expr ::= PLUS INTEGER */
+ { 259, -1 }, /* (228) expr ::= FLOAT */
+ { 259, -2 }, /* (229) expr ::= MINUS FLOAT */
+ { 259, -2 }, /* (230) expr ::= PLUS FLOAT */
+ { 259, -1 }, /* (231) expr ::= STRING */
+ { 259, -1 }, /* (232) expr ::= NOW */
+ { 259, -1 }, /* (233) expr ::= VARIABLE */
+ { 259, -2 }, /* (234) expr ::= PLUS VARIABLE */
+ { 259, -2 }, /* (235) expr ::= MINUS VARIABLE */
+ { 259, -1 }, /* (236) expr ::= BOOL */
+ { 259, -1 }, /* (237) expr ::= NULL */
+ { 259, -4 }, /* (238) expr ::= ID LP exprlist RP */
+ { 259, -4 }, /* (239) expr ::= ID LP STAR RP */
+ { 259, -3 }, /* (240) expr ::= expr IS NULL */
+ { 259, -4 }, /* (241) expr ::= expr IS NOT NULL */
+ { 259, -3 }, /* (242) expr ::= expr LT expr */
+ { 259, -3 }, /* (243) expr ::= expr GT expr */
+ { 259, -3 }, /* (244) expr ::= expr LE expr */
+ { 259, -3 }, /* (245) expr ::= expr GE expr */
+ { 259, -3 }, /* (246) expr ::= expr NE expr */
+ { 259, -3 }, /* (247) expr ::= expr EQ expr */
+ { 259, -5 }, /* (248) expr ::= expr BETWEEN expr AND expr */
+ { 259, -3 }, /* (249) expr ::= expr AND expr */
+ { 259, -3 }, /* (250) expr ::= expr OR expr */
+ { 259, -3 }, /* (251) expr ::= expr PLUS expr */
+ { 259, -3 }, /* (252) expr ::= expr MINUS expr */
+ { 259, -3 }, /* (253) expr ::= expr STAR expr */
+ { 259, -3 }, /* (254) expr ::= expr SLASH expr */
+ { 259, -3 }, /* (255) expr ::= expr REM expr */
+ { 259, -3 }, /* (256) expr ::= expr LIKE expr */
+ { 259, -5 }, /* (257) expr ::= expr IN LP exprlist RP */
+ { 200, -3 }, /* (258) exprlist ::= exprlist COMMA expritem */
+ { 200, -1 }, /* (259) exprlist ::= expritem */
+ { 269, -1 }, /* (260) expritem ::= expr */
+ { 269, 0 }, /* (261) expritem ::= */
+ { 192, -3 }, /* (262) cmd ::= RESET QUERY CACHE */
+ { 192, -3 }, /* (263) cmd ::= SYNCDB ids REPLICA */
+ { 192, -7 }, /* (264) cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+ { 192, -7 }, /* (265) cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+ { 192, -7 }, /* (266) cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
+ { 192, -7 }, /* (267) cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+ { 192, -7 }, /* (268) cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+ { 192, -8 }, /* (269) cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+ { 192, -9 }, /* (270) cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+ { 192, -7 }, /* (271) cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
+ { 192, -7 }, /* (272) cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+ { 192, -7 }, /* (273) cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+ { 192, -7 }, /* (274) cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
+ { 192, -7 }, /* (275) cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+ { 192, -7 }, /* (276) cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+ { 192, -8 }, /* (277) cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+ { 192, -9 }, /* (278) cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
+ { 192, -7 }, /* (279) cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
+ { 192, -3 }, /* (280) cmd ::= KILL CONNECTION INTEGER */
+ { 192, -5 }, /* (281) cmd ::= KILL STREAM INTEGER COLON INTEGER */
+ { 192, -5 }, /* (282) cmd ::= KILL QUERY INTEGER COLON INTEGER */
+>>>>>>> dev
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -2199,9 +3306,15 @@ static void yy_reduce(
/********** Begin reduce actions **********************************************/
YYMINORTYPE yylhsminor;
case 0: /* program ::= cmd */
+<<<<<<< HEAD
case 140: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==140);
case 141: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==141);
case 142: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==142);
+=======
+ case 132: /* cmd ::= CREATE TABLE create_table_args */ yytestcase(yyruleno==132);
+ case 133: /* cmd ::= CREATE TABLE create_stable_args */ yytestcase(yyruleno==133);
+ case 134: /* cmd ::= CREATE STABLE create_stable_args */ yytestcase(yyruleno==134);
+>>>>>>> dev
{}
break;
case 1: /* cmd ::= SHOW DATABASES */
@@ -2396,9 +3509,15 @@ static void yy_reduce(
case 53: /* ifexists ::= IF EXISTS */
{ yymsp[-1].minor.yy0.n = 1;}
break;
+<<<<<<< HEAD
case 54: /* ifexists ::= */
case 56: /* ifnotexists ::= */ yytestcase(yyruleno==56);
case 182: /* distinct ::= */ yytestcase(yyruleno==182);
+=======
+ case 52: /* ifexists ::= */
+ case 54: /* ifnotexists ::= */ yytestcase(yyruleno==54);
+ case 174: /* distinct ::= */ yytestcase(yyruleno==174);
+>>>>>>> dev
{ yymsp[1].minor.yy0.n = 0;}
break;
case 55: /* ifnotexists ::= IF NOT EXISTS */
@@ -2447,6 +3566,7 @@ static void yy_reduce(
case 83: /* state ::= STATE ids */ yytestcase(yyruleno==83);
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
+<<<<<<< HEAD
case 84: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
{
yylhsminor.yy547.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
@@ -2476,6 +3596,37 @@ static void yy_reduce(
case 159: /* tagitem ::= FLOAT */ yytestcase(yyruleno==159);
case 160: /* tagitem ::= STRING */ yytestcase(yyruleno==160);
case 161: /* tagitem ::= BOOL */ yytestcase(yyruleno==161);
+=======
+ case 78: /* acct_optr ::= pps tseries storage streams qtime dbs users conns state */
+{
+ yylhsminor.yy151.maxUsers = (yymsp[-2].minor.yy0.n>0)?atoi(yymsp[-2].minor.yy0.z):-1;
+ yylhsminor.yy151.maxDbs = (yymsp[-3].minor.yy0.n>0)?atoi(yymsp[-3].minor.yy0.z):-1;
+ yylhsminor.yy151.maxTimeSeries = (yymsp[-7].minor.yy0.n>0)?atoi(yymsp[-7].minor.yy0.z):-1;
+ yylhsminor.yy151.maxStreams = (yymsp[-5].minor.yy0.n>0)?atoi(yymsp[-5].minor.yy0.z):-1;
+ yylhsminor.yy151.maxPointsPerSecond = (yymsp[-8].minor.yy0.n>0)?atoi(yymsp[-8].minor.yy0.z):-1;
+ yylhsminor.yy151.maxStorage = (yymsp[-6].minor.yy0.n>0)?strtoll(yymsp[-6].minor.yy0.z, NULL, 10):-1;
+ yylhsminor.yy151.maxQueryTime = (yymsp[-4].minor.yy0.n>0)?strtoll(yymsp[-4].minor.yy0.z, NULL, 10):-1;
+ yylhsminor.yy151.maxConnections = (yymsp[-1].minor.yy0.n>0)?atoi(yymsp[-1].minor.yy0.z):-1;
+ yylhsminor.yy151.stat = yymsp[0].minor.yy0;
+}
+ yymsp[-8].minor.yy151 = yylhsminor.yy151;
+ break;
+ case 79: /* intitemlist ::= intitemlist COMMA intitem */
+ case 148: /* tagitemlist ::= tagitemlist COMMA tagitem */ yytestcase(yyruleno==148);
+{ yylhsminor.yy441 = tVariantListAppend(yymsp[-2].minor.yy441, &yymsp[0].minor.yy506, -1); }
+ yymsp[-2].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 80: /* intitemlist ::= intitem */
+ case 149: /* tagitemlist ::= tagitem */ yytestcase(yyruleno==149);
+{ yylhsminor.yy441 = tVariantListAppend(NULL, &yymsp[0].minor.yy506, -1); }
+ yymsp[0].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 81: /* intitem ::= INTEGER */
+ case 150: /* tagitem ::= INTEGER */ yytestcase(yyruleno==150);
+ case 151: /* tagitem ::= FLOAT */ yytestcase(yyruleno==151);
+ case 152: /* tagitem ::= STRING */ yytestcase(yyruleno==152);
+ case 153: /* tagitem ::= BOOL */ yytestcase(yyruleno==153);
+>>>>>>> dev
{ toTSDBType(yymsp[0].minor.yy0.type); tVariantCreate(&yylhsminor.yy506, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy506 = yylhsminor.yy506;
break;
@@ -2499,6 +3650,7 @@ static void yy_reduce(
case 103: /* partitions ::= PARTITIONS INTEGER */ yytestcase(yyruleno==103);
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
+<<<<<<< HEAD
case 104: /* db_optr ::= */
{setDefaultCreateDbOption(&yymsp[1].minor.yy214); yymsp[1].minor.yy214.dbType = TSDB_DB_TYPE_DEFAULT;}
break;
@@ -2585,13 +3737,103 @@ static void yy_reduce(
{ setDefaultCreateDbOption(&yymsp[1].minor.yy214); yymsp[1].minor.yy214.dbType = TSDB_DB_TYPE_DEFAULT;}
break;
case 134: /* typename ::= ids */
+=======
+ case 98: /* db_optr ::= */
+{setDefaultCreateDbOption(&yymsp[1].minor.yy382); yymsp[1].minor.yy382.dbType = TSDB_DB_TYPE_DEFAULT;}
+ break;
+ case 99: /* db_optr ::= db_optr cache */
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.cacheBlockSize = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 100: /* db_optr ::= db_optr replica */
+ case 117: /* alter_db_optr ::= alter_db_optr replica */ yytestcase(yyruleno==117);
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.replica = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 101: /* db_optr ::= db_optr quorum */
+ case 118: /* alter_db_optr ::= alter_db_optr quorum */ yytestcase(yyruleno==118);
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.quorum = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 102: /* db_optr ::= db_optr days */
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.daysPerFile = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 103: /* db_optr ::= db_optr minrows */
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.minRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 104: /* db_optr ::= db_optr maxrows */
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.maxRowsPerBlock = strtod(yymsp[0].minor.yy0.z, NULL); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 105: /* db_optr ::= db_optr blocks */
+ case 120: /* alter_db_optr ::= alter_db_optr blocks */ yytestcase(yyruleno==120);
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.numOfBlocks = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 106: /* db_optr ::= db_optr ctime */
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.commitTime = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 107: /* db_optr ::= db_optr wal */
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.walLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 108: /* db_optr ::= db_optr fsync */
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.fsyncPeriod = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 109: /* db_optr ::= db_optr comp */
+ case 121: /* alter_db_optr ::= alter_db_optr comp */ yytestcase(yyruleno==121);
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.compressionLevel = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 110: /* db_optr ::= db_optr prec */
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.precision = yymsp[0].minor.yy0; }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 111: /* db_optr ::= db_optr keep */
+ case 119: /* alter_db_optr ::= alter_db_optr keep */ yytestcase(yyruleno==119);
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.keep = yymsp[0].minor.yy441; }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 112: /* db_optr ::= db_optr update */
+ case 122: /* alter_db_optr ::= alter_db_optr update */ yytestcase(yyruleno==122);
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.update = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 113: /* db_optr ::= db_optr cachelast */
+ case 123: /* alter_db_optr ::= alter_db_optr cachelast */ yytestcase(yyruleno==123);
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.cachelast = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 114: /* topic_optr ::= db_optr */
+ case 124: /* alter_topic_optr ::= alter_db_optr */ yytestcase(yyruleno==124);
+{ yylhsminor.yy382 = yymsp[0].minor.yy382; yylhsminor.yy382.dbType = TSDB_DB_TYPE_TOPIC; }
+ yymsp[0].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 115: /* topic_optr ::= topic_optr partitions */
+ case 125: /* alter_topic_optr ::= alter_topic_optr partitions */ yytestcase(yyruleno==125);
+{ yylhsminor.yy382 = yymsp[-1].minor.yy382; yylhsminor.yy382.partitions = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[-1].minor.yy382 = yylhsminor.yy382;
+ break;
+ case 116: /* alter_db_optr ::= */
+{ setDefaultCreateDbOption(&yymsp[1].minor.yy382); yymsp[1].minor.yy382.dbType = TSDB_DB_TYPE_DEFAULT;}
+ break;
+ case 126: /* typename ::= ids */
+>>>>>>> dev
{
yymsp[0].minor.yy0.type = 0;
tSetColumnType (&yylhsminor.yy31, &yymsp[0].minor.yy0);
}
yymsp[0].minor.yy31 = yylhsminor.yy31;
break;
+<<<<<<< HEAD
case 135: /* typename ::= ids LP signed RP */
+=======
+ case 127: /* typename ::= ids LP signed RP */
+>>>>>>> dev
{
if (yymsp[-1].minor.yy501 <= 0) {
yymsp[-3].minor.yy0.type = 0;
@@ -2603,7 +3845,11 @@ static void yy_reduce(
}
yymsp[-3].minor.yy31 = yylhsminor.yy31;
break;
+<<<<<<< HEAD
case 136: /* typename ::= ids UNSIGNED */
+=======
+ case 128: /* typename ::= ids UNSIGNED */
+>>>>>>> dev
{
yymsp[-1].minor.yy0.type = 0;
yymsp[-1].minor.yy0.n = ((yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z);
@@ -2611,6 +3857,7 @@ static void yy_reduce(
}
yymsp[-1].minor.yy31 = yylhsminor.yy31;
break;
+<<<<<<< HEAD
case 137: /* signed ::= INTEGER */
{ yylhsminor.yy501 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
yymsp[0].minor.yy501 = yylhsminor.yy501;
@@ -2625,6 +3872,22 @@ static void yy_reduce(
{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy158;}
break;
case 144: /* create_table_list ::= create_from_stable */
+=======
+ case 129: /* signed ::= INTEGER */
+{ yylhsminor.yy369 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ yymsp[0].minor.yy369 = yylhsminor.yy369;
+ break;
+ case 130: /* signed ::= PLUS INTEGER */
+{ yymsp[-1].minor.yy369 = strtol(yymsp[0].minor.yy0.z, NULL, 10); }
+ break;
+ case 131: /* signed ::= MINUS INTEGER */
+{ yymsp[-1].minor.yy369 = -strtol(yymsp[0].minor.yy0.z, NULL, 10);}
+ break;
+ case 135: /* cmd ::= CREATE TABLE create_table_list */
+{ pInfo->type = TSDB_SQL_CREATE_TABLE; pInfo->pCreateTableInfo = yymsp[0].minor.yy182;}
+ break;
+ case 136: /* create_table_list ::= create_from_stable */
+>>>>>>> dev
{
SCreateTableSql* pCreateTable = calloc(1, sizeof(SCreateTableSql));
pCreateTable->childTableInfo = taosArrayInit(4, sizeof(SCreatedTableInfo));
@@ -2635,14 +3898,22 @@ static void yy_reduce(
}
yymsp[0].minor.yy158 = yylhsminor.yy158;
break;
+<<<<<<< HEAD
case 145: /* create_table_list ::= create_table_list create_from_stable */
+=======
+ case 137: /* create_table_list ::= create_table_list create_from_stable */
+>>>>>>> dev
{
taosArrayPush(yymsp[-1].minor.yy158->childTableInfo, &yymsp[0].minor.yy432);
yylhsminor.yy158 = yymsp[-1].minor.yy158;
}
yymsp[-1].minor.yy158 = yylhsminor.yy158;
break;
+<<<<<<< HEAD
case 146: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
+=======
+ case 138: /* create_table_args ::= ifnotexists ids cpxName LP columnlist RP */
+>>>>>>> dev
{
yylhsminor.yy158 = tSetCreateTableInfo(yymsp[-1].minor.yy525, NULL, NULL, TSQL_CREATE_TABLE);
setSqlInfo(pInfo, yylhsminor.yy158, NULL, TSDB_SQL_CREATE_TABLE);
@@ -2652,7 +3923,11 @@ static void yy_reduce(
}
yymsp[-5].minor.yy158 = yylhsminor.yy158;
break;
+<<<<<<< HEAD
case 147: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
+=======
+ case 139: /* create_stable_args ::= ifnotexists ids cpxName LP columnlist RP TAGS LP columnlist RP */
+>>>>>>> dev
{
yylhsminor.yy158 = tSetCreateTableInfo(yymsp[-5].minor.yy525, yymsp[-1].minor.yy525, NULL, TSQL_CREATE_STABLE);
setSqlInfo(pInfo, yylhsminor.yy158, NULL, TSDB_SQL_CREATE_TABLE);
@@ -2662,7 +3937,11 @@ static void yy_reduce(
}
yymsp[-9].minor.yy158 = yylhsminor.yy158;
break;
+<<<<<<< HEAD
case 148: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
+=======
+ case 140: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName TAGS LP tagitemlist RP */
+>>>>>>> dev
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
@@ -2670,7 +3949,11 @@ static void yy_reduce(
}
yymsp[-9].minor.yy432 = yylhsminor.yy432;
break;
+<<<<<<< HEAD
case 149: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
+=======
+ case 141: /* create_from_stable ::= ifnotexists ids cpxName USING ids cpxName LP tagNamelist RP TAGS LP tagitemlist RP */
+>>>>>>> dev
{
yymsp[-8].minor.yy0.n += yymsp[-7].minor.yy0.n;
yymsp[-11].minor.yy0.n += yymsp[-10].minor.yy0.n;
@@ -2678,6 +3961,7 @@ static void yy_reduce(
}
yymsp[-12].minor.yy432 = yylhsminor.yy432;
break;
+<<<<<<< HEAD
case 150: /* tagNamelist ::= tagNamelist COMMA ids */
{taosArrayPush(yymsp[-2].minor.yy525, &yymsp[0].minor.yy0); yylhsminor.yy525 = yymsp[-2].minor.yy525; }
yymsp[-2].minor.yy525 = yylhsminor.yy525;
@@ -2687,6 +3971,17 @@ static void yy_reduce(
yymsp[0].minor.yy525 = yylhsminor.yy525;
break;
case 152: /* create_table_args ::= ifnotexists ids cpxName AS select */
+=======
+ case 142: /* tagNamelist ::= tagNamelist COMMA ids */
+{taosArrayPush(yymsp[-2].minor.yy441, &yymsp[0].minor.yy0); yylhsminor.yy441 = yymsp[-2].minor.yy441; }
+ yymsp[-2].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 143: /* tagNamelist ::= ids */
+{yylhsminor.yy441 = taosArrayInit(4, sizeof(SStrToken)); taosArrayPush(yylhsminor.yy441, &yymsp[0].minor.yy0);}
+ yymsp[0].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 144: /* create_table_args ::= ifnotexists ids cpxName AS select */
+>>>>>>> dev
{
yylhsminor.yy158 = tSetCreateTableInfo(NULL, NULL, yymsp[0].minor.yy464, TSQL_CREATE_STREAM);
setSqlInfo(pInfo, yylhsminor.yy158, NULL, TSDB_SQL_CREATE_TABLE);
@@ -2696,6 +3991,7 @@ static void yy_reduce(
}
yymsp[-4].minor.yy158 = yylhsminor.yy158;
break;
+<<<<<<< HEAD
case 153: /* columnlist ::= columnlist COMMA column */
{taosArrayPush(yymsp[-2].minor.yy525, &yymsp[0].minor.yy31); yylhsminor.yy525 = yymsp[-2].minor.yy525; }
yymsp[-2].minor.yy525 = yylhsminor.yy525;
@@ -2705,11 +4001,23 @@ static void yy_reduce(
yymsp[0].minor.yy525 = yylhsminor.yy525;
break;
case 155: /* column ::= ids typename */
+=======
+ case 145: /* columnlist ::= columnlist COMMA column */
+{taosArrayPush(yymsp[-2].minor.yy441, &yymsp[0].minor.yy343); yylhsminor.yy441 = yymsp[-2].minor.yy441; }
+ yymsp[-2].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 146: /* columnlist ::= column */
+{yylhsminor.yy441 = taosArrayInit(4, sizeof(TAOS_FIELD)); taosArrayPush(yylhsminor.yy441, &yymsp[0].minor.yy343);}
+ yymsp[0].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 147: /* column ::= ids typename */
+>>>>>>> dev
{
tSetColumnInfo(&yylhsminor.yy31, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy31);
}
yymsp[-1].minor.yy31 = yylhsminor.yy31;
break;
+<<<<<<< HEAD
case 162: /* tagitem ::= NULL */
{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy506, &yymsp[0].minor.yy0); }
yymsp[0].minor.yy506 = yylhsminor.yy506;
@@ -2722,6 +4030,20 @@ static void yy_reduce(
case 165: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==165);
case 166: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==166);
case 167: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==167);
+=======
+ case 154: /* tagitem ::= NULL */
+{ yymsp[0].minor.yy0.type = 0; tVariantCreate(&yylhsminor.yy506, &yymsp[0].minor.yy0); }
+ yymsp[0].minor.yy506 = yylhsminor.yy506;
+ break;
+ case 155: /* tagitem ::= NOW */
+{ yymsp[0].minor.yy0.type = TSDB_DATA_TYPE_TIMESTAMP; tVariantCreate(&yylhsminor.yy506, &yymsp[0].minor.yy0);}
+ yymsp[0].minor.yy506 = yylhsminor.yy506;
+ break;
+ case 156: /* tagitem ::= MINUS INTEGER */
+ case 157: /* tagitem ::= MINUS FLOAT */ yytestcase(yyruleno==157);
+ case 158: /* tagitem ::= PLUS INTEGER */ yytestcase(yyruleno==158);
+ case 159: /* tagitem ::= PLUS FLOAT */ yytestcase(yyruleno==159);
+>>>>>>> dev
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yymsp[-1].minor.yy0.type = yymsp[0].minor.yy0.type;
@@ -2730,12 +4052,19 @@ static void yy_reduce(
}
yymsp[-1].minor.yy506 = yylhsminor.yy506;
break;
+<<<<<<< HEAD
case 168: /* 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 */
{
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);
+=======
+ case 160: /* 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 */
+{
+ yylhsminor.yy236 = tSetQuerySqlNode(&yymsp[-13].minor.yy0, yymsp[-12].minor.yy441, yymsp[-11].minor.yy244, yymsp[-10].minor.yy166, yymsp[-4].minor.yy441, yymsp[-2].minor.yy441, &yymsp[-9].minor.yy340, &yymsp[-8].minor.yy259, &yymsp[-7].minor.yy348, &yymsp[-5].minor.yy0, yymsp[-6].minor.yy441, &yymsp[0].minor.yy414, &yymsp[-1].minor.yy414, yymsp[-3].minor.yy166);
+>>>>>>> dev
}
yymsp[-13].minor.yy464 = yylhsminor.yy464;
break;
+<<<<<<< HEAD
case 169: /* select ::= LP select RP */
{yymsp[-2].minor.yy464 = yymsp[-1].minor.yy464;}
break;
@@ -2751,11 +4080,29 @@ static void yy_reduce(
{ setSqlInfo(pInfo, yymsp[0].minor.yy525, NULL, TSDB_SQL_SELECT); }
break;
case 173: /* select ::= SELECT selcollist */
+=======
+ case 161: /* select ::= LP select RP */
+{yymsp[-2].minor.yy236 = yymsp[-1].minor.yy236;}
+ break;
+ case 162: /* union ::= select */
+{ yylhsminor.yy441 = setSubclause(NULL, yymsp[0].minor.yy236); }
+ yymsp[0].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 163: /* union ::= union UNION ALL select */
+{ yylhsminor.yy441 = appendSelectClause(yymsp[-3].minor.yy441, yymsp[0].minor.yy236); }
+ yymsp[-3].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 164: /* cmd ::= union */
+{ setSqlInfo(pInfo, yymsp[0].minor.yy441, NULL, TSDB_SQL_SELECT); }
+ break;
+ case 165: /* select ::= SELECT selcollist */
+>>>>>>> dev
{
yylhsminor.yy464 = tSetQuerySqlNode(&yymsp[-1].minor.yy0, yymsp[0].minor.yy525, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
}
yymsp[-1].minor.yy464 = yylhsminor.yy464;
break;
+<<<<<<< HEAD
case 174: /* sclp ::= selcollist COMMA */
{yylhsminor.yy525 = yymsp[-1].minor.yy525;}
yymsp[-1].minor.yy525 = yylhsminor.yy525;
@@ -2765,18 +4112,34 @@ static void yy_reduce(
{yymsp[1].minor.yy525 = 0;}
break;
case 176: /* selcollist ::= sclp distinct expr as */
+=======
+ case 166: /* sclp ::= selcollist COMMA */
+{yylhsminor.yy441 = yymsp[-1].minor.yy441;}
+ yymsp[-1].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 167: /* sclp ::= */
+ case 197: /* orderby_opt ::= */ yytestcase(yyruleno==197);
+{yymsp[1].minor.yy441 = 0;}
+ break;
+ case 168: /* selcollist ::= sclp distinct expr as */
+>>>>>>> dev
{
yylhsminor.yy525 = tSqlExprListAppend(yymsp[-3].minor.yy525, yymsp[-1].minor.yy370, yymsp[-2].minor.yy0.n? &yymsp[-2].minor.yy0:0, yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
}
yymsp[-3].minor.yy525 = yylhsminor.yy525;
break;
+<<<<<<< HEAD
case 177: /* selcollist ::= sclp STAR */
+=======
+ case 169: /* selcollist ::= sclp STAR */
+>>>>>>> dev
{
tSqlExpr *pNode = tSqlExprCreateIdValue(NULL, TK_ALL);
yylhsminor.yy525 = tSqlExprListAppend(yymsp[-1].minor.yy525, pNode, 0, 0);
}
yymsp[-1].minor.yy525 = yylhsminor.yy525;
break;
+<<<<<<< HEAD
case 178: /* as ::= AS ids */
{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
break;
@@ -2806,33 +4169,77 @@ static void yy_reduce(
yymsp[-5].minor.yy412 = yylhsminor.yy412;
break;
case 188: /* tablelist ::= ids cpxName */
+=======
+ case 170: /* as ::= AS ids */
+{ yymsp[-1].minor.yy0 = yymsp[0].minor.yy0; }
+ break;
+ case 171: /* as ::= ids */
+{ yylhsminor.yy0 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy0 = yylhsminor.yy0;
+ break;
+ case 172: /* as ::= */
+{ yymsp[1].minor.yy0.n = 0; }
+ break;
+ case 173: /* distinct ::= DISTINCT */
+{ yylhsminor.yy0 = yymsp[0].minor.yy0; }
+ yymsp[0].minor.yy0 = yylhsminor.yy0;
+ break;
+ case 175: /* from ::= FROM tablelist */
+ case 176: /* from ::= FROM sub */ yytestcase(yyruleno==176);
+{yymsp[-1].minor.yy244 = yymsp[0].minor.yy244;}
+ break;
+ case 177: /* sub ::= LP union RP */
+{yymsp[-2].minor.yy244 = addSubqueryElem(NULL, yymsp[-1].minor.yy441, NULL);}
+ break;
+ case 178: /* sub ::= LP union RP ids */
+{yymsp[-3].minor.yy244 = addSubqueryElem(NULL, yymsp[-2].minor.yy441, &yymsp[0].minor.yy0);}
+ break;
+ case 179: /* sub ::= sub COMMA LP union RP ids */
+{yylhsminor.yy244 = addSubqueryElem(yymsp[-5].minor.yy244, yymsp[-2].minor.yy441, &yymsp[0].minor.yy0);}
+ yymsp[-5].minor.yy244 = yylhsminor.yy244;
+ break;
+ case 180: /* tablelist ::= ids cpxName */
+>>>>>>> dev
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy412 = setTableNameList(NULL, &yymsp[-1].minor.yy0, NULL);
}
yymsp[-1].minor.yy412 = yylhsminor.yy412;
break;
+<<<<<<< HEAD
case 189: /* tablelist ::= ids cpxName ids */
+=======
+ case 181: /* tablelist ::= ids cpxName ids */
+>>>>>>> dev
{
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy412 = setTableNameList(NULL, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
yymsp[-2].minor.yy412 = yylhsminor.yy412;
break;
+<<<<<<< HEAD
case 190: /* tablelist ::= tablelist COMMA ids cpxName */
+=======
+ case 182: /* tablelist ::= tablelist COMMA ids cpxName */
+>>>>>>> dev
{
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
yylhsminor.yy412 = setTableNameList(yymsp[-3].minor.yy412, &yymsp[-1].minor.yy0, NULL);
}
yymsp[-3].minor.yy412 = yylhsminor.yy412;
break;
+<<<<<<< HEAD
case 191: /* tablelist ::= tablelist COMMA ids cpxName ids */
+=======
+ case 183: /* tablelist ::= tablelist COMMA ids cpxName ids */
+>>>>>>> dev
{
yymsp[-2].minor.yy0.n += yymsp[-1].minor.yy0.n;
yylhsminor.yy412 = setTableNameList(yymsp[-4].minor.yy412, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
yymsp[-4].minor.yy412 = yylhsminor.yy412;
break;
+<<<<<<< HEAD
case 192: /* tmvar ::= VARIABLE */
{yylhsminor.yy0 = yymsp[0].minor.yy0;}
yymsp[0].minor.yy0 = yylhsminor.yy0;
@@ -2850,12 +4257,32 @@ static void yy_reduce(
{yymsp[1].minor.yy259.col.n = 0; yymsp[1].minor.yy259.gap.n = 0;}
break;
case 197: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
+=======
+ case 184: /* tmvar ::= VARIABLE */
+{yylhsminor.yy0 = yymsp[0].minor.yy0;}
+ yymsp[0].minor.yy0 = yylhsminor.yy0;
+ break;
+ case 185: /* interval_opt ::= INTERVAL LP tmvar RP */
+{yymsp[-3].minor.yy340.interval = yymsp[-1].minor.yy0; yymsp[-3].minor.yy340.offset.n = 0;}
+ break;
+ case 186: /* interval_opt ::= INTERVAL LP tmvar COMMA tmvar RP */
+{yymsp[-5].minor.yy340.interval = yymsp[-3].minor.yy0; yymsp[-5].minor.yy340.offset = yymsp[-1].minor.yy0;}
+ break;
+ case 187: /* interval_opt ::= */
+{memset(&yymsp[1].minor.yy340, 0, sizeof(yymsp[1].minor.yy340));}
+ break;
+ case 188: /* session_option ::= */
+{yymsp[1].minor.yy259.col.n = 0; yymsp[1].minor.yy259.gap.n = 0;}
+ break;
+ case 189: /* session_option ::= SESSION LP ids cpxName COMMA tmvar RP */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
yymsp[-6].minor.yy259.col = yymsp[-4].minor.yy0;
yymsp[-6].minor.yy259.gap = yymsp[-1].minor.yy0;
}
break;
+<<<<<<< HEAD
case 198: /* windowstate_option ::= */
{ yymsp[1].minor.yy144.col.n = 0; yymsp[1].minor.yy144.col.z = NULL;}
break;
@@ -2866,6 +4293,18 @@ static void yy_reduce(
{ yymsp[1].minor.yy525 = 0; }
break;
case 201: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+=======
+ case 190: /* windowstate_option ::= */
+{ yymsp[1].minor.yy348.col.n = 0; yymsp[1].minor.yy348.col.z = NULL;}
+ break;
+ case 191: /* windowstate_option ::= STATE_WINDOW LP ids RP */
+{ yymsp[-3].minor.yy348.col = yymsp[-1].minor.yy0; }
+ break;
+ case 192: /* fill_opt ::= */
+{ yymsp[1].minor.yy441 = 0; }
+ break;
+ case 193: /* fill_opt ::= FILL LP ID COMMA tagitemlist RP */
+>>>>>>> dev
{
tVariant A = {0};
toTSDBType(yymsp[-3].minor.yy0.type);
@@ -2875,12 +4314,17 @@ static void yy_reduce(
yymsp[-5].minor.yy525 = yymsp[-1].minor.yy525;
}
break;
+<<<<<<< HEAD
case 202: /* fill_opt ::= FILL LP ID RP */
+=======
+ case 194: /* fill_opt ::= FILL LP ID RP */
+>>>>>>> dev
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-3].minor.yy525 = tVariantListAppendToken(NULL, &yymsp[-1].minor.yy0, -1);
}
break;
+<<<<<<< HEAD
case 203: /* sliding_opt ::= SLIDING LP tmvar RP */
{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; }
break;
@@ -2891,18 +4335,38 @@ static void yy_reduce(
{yymsp[-2].minor.yy525 = yymsp[0].minor.yy525;}
break;
case 207: /* sortlist ::= sortlist COMMA item sortorder */
+=======
+ case 195: /* sliding_opt ::= SLIDING LP tmvar RP */
+{yymsp[-3].minor.yy0 = yymsp[-1].minor.yy0; }
+ break;
+ case 196: /* sliding_opt ::= */
+{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = NULL; yymsp[1].minor.yy0.type = 0; }
+ break;
+ case 198: /* orderby_opt ::= ORDER BY sortlist */
+{yymsp[-2].minor.yy441 = yymsp[0].minor.yy441;}
+ break;
+ case 199: /* sortlist ::= sortlist COMMA item sortorder */
+>>>>>>> dev
{
yylhsminor.yy525 = tVariantListAppend(yymsp[-3].minor.yy525, &yymsp[-1].minor.yy506, yymsp[0].minor.yy52);
}
yymsp[-3].minor.yy525 = yylhsminor.yy525;
break;
+<<<<<<< HEAD
case 208: /* sortlist ::= item sortorder */
+=======
+ case 200: /* sortlist ::= item sortorder */
+>>>>>>> dev
{
yylhsminor.yy525 = tVariantListAppend(NULL, &yymsp[-1].minor.yy506, yymsp[0].minor.yy52);
}
yymsp[-1].minor.yy525 = yylhsminor.yy525;
break;
+<<<<<<< HEAD
case 209: /* item ::= ids cpxName */
+=======
+ case 201: /* item ::= ids cpxName */
+>>>>>>> dev
{
toTSDBType(yymsp[-1].minor.yy0.type);
yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n;
@@ -2911,6 +4375,7 @@ static void yy_reduce(
}
yymsp[-1].minor.yy506 = yylhsminor.yy506;
break;
+<<<<<<< HEAD
case 210: /* sortorder ::= ASC */
{ yymsp[0].minor.yy52 = TSDB_ORDER_ASC; }
break;
@@ -2927,17 +4392,40 @@ static void yy_reduce(
{ yymsp[-2].minor.yy525 = yymsp[0].minor.yy525;}
break;
case 215: /* grouplist ::= grouplist COMMA item */
+=======
+ case 202: /* sortorder ::= ASC */
+{ yymsp[0].minor.yy112 = TSDB_ORDER_ASC; }
+ break;
+ case 203: /* sortorder ::= DESC */
+{ yymsp[0].minor.yy112 = TSDB_ORDER_DESC;}
+ break;
+ case 204: /* sortorder ::= */
+{ yymsp[1].minor.yy112 = TSDB_ORDER_ASC; }
+ break;
+ case 205: /* groupby_opt ::= */
+{ yymsp[1].minor.yy441 = 0;}
+ break;
+ case 206: /* groupby_opt ::= GROUP BY grouplist */
+{ yymsp[-2].minor.yy441 = yymsp[0].minor.yy441;}
+ break;
+ case 207: /* grouplist ::= grouplist COMMA item */
+>>>>>>> dev
{
yylhsminor.yy525 = tVariantListAppend(yymsp[-2].minor.yy525, &yymsp[0].minor.yy506, -1);
}
yymsp[-2].minor.yy525 = yylhsminor.yy525;
break;
+<<<<<<< HEAD
case 216: /* grouplist ::= item */
+=======
+ case 208: /* grouplist ::= item */
+>>>>>>> dev
{
yylhsminor.yy525 = tVariantListAppend(NULL, &yymsp[0].minor.yy506, -1);
}
yymsp[0].minor.yy525 = yylhsminor.yy525;
break;
+<<<<<<< HEAD
case 217: /* having_opt ::= */
case 227: /* where_opt ::= */ yytestcase(yyruleno==227);
case 269: /* expritem ::= */ yytestcase(yyruleno==269);
@@ -3125,13 +4613,206 @@ static void yy_reduce(
{ setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);}
break;
case 272: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+=======
+ case 209: /* having_opt ::= */
+ case 219: /* where_opt ::= */ yytestcase(yyruleno==219);
+ case 261: /* expritem ::= */ yytestcase(yyruleno==261);
+{yymsp[1].minor.yy166 = 0;}
+ break;
+ case 210: /* having_opt ::= HAVING expr */
+ case 220: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==220);
+{yymsp[-1].minor.yy166 = yymsp[0].minor.yy166;}
+ break;
+ case 211: /* limit_opt ::= */
+ case 215: /* slimit_opt ::= */ yytestcase(yyruleno==215);
+{yymsp[1].minor.yy414.limit = -1; yymsp[1].minor.yy414.offset = 0;}
+ break;
+ case 212: /* limit_opt ::= LIMIT signed */
+ case 216: /* slimit_opt ::= SLIMIT signed */ yytestcase(yyruleno==216);
+{yymsp[-1].minor.yy414.limit = yymsp[0].minor.yy369; yymsp[-1].minor.yy414.offset = 0;}
+ break;
+ case 213: /* limit_opt ::= LIMIT signed OFFSET signed */
+{ yymsp[-3].minor.yy414.limit = yymsp[-2].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[0].minor.yy369;}
+ break;
+ case 214: /* limit_opt ::= LIMIT signed COMMA signed */
+{ yymsp[-3].minor.yy414.limit = yymsp[0].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[-2].minor.yy369;}
+ break;
+ case 217: /* slimit_opt ::= SLIMIT signed SOFFSET signed */
+{yymsp[-3].minor.yy414.limit = yymsp[-2].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[0].minor.yy369;}
+ break;
+ case 218: /* slimit_opt ::= SLIMIT signed COMMA signed */
+{yymsp[-3].minor.yy414.limit = yymsp[0].minor.yy369; yymsp[-3].minor.yy414.offset = yymsp[-2].minor.yy369;}
+ break;
+ case 221: /* expr ::= LP expr RP */
+{yylhsminor.yy166 = yymsp[-1].minor.yy166; yylhsminor.yy166->exprToken.z = yymsp[-2].minor.yy0.z; yylhsminor.yy166->exprToken.n = (yymsp[0].minor.yy0.z - yymsp[-2].minor.yy0.z + 1);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 222: /* expr ::= ID */
+{ yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_ID);}
+ yymsp[0].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 223: /* expr ::= ID DOT ID */
+{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ID);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 224: /* expr ::= ID DOT STAR */
+{ yymsp[-2].minor.yy0.n += (1+yymsp[0].minor.yy0.n); yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-2].minor.yy0, TK_ALL);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 225: /* expr ::= INTEGER */
+{ yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_INTEGER);}
+ yymsp[0].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 226: /* expr ::= MINUS INTEGER */
+ case 227: /* expr ::= PLUS INTEGER */ yytestcase(yyruleno==227);
+{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_INTEGER; yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_INTEGER);}
+ yymsp[-1].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 228: /* expr ::= FLOAT */
+{ yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_FLOAT);}
+ yymsp[0].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 229: /* expr ::= MINUS FLOAT */
+ case 230: /* expr ::= PLUS FLOAT */ yytestcase(yyruleno==230);
+{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_FLOAT; yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_FLOAT);}
+ yymsp[-1].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 231: /* expr ::= STRING */
+{ yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_STRING);}
+ yymsp[0].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 232: /* expr ::= NOW */
+{ yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NOW); }
+ yymsp[0].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 233: /* expr ::= VARIABLE */
+{ yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_VARIABLE);}
+ yymsp[0].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 234: /* expr ::= PLUS VARIABLE */
+ case 235: /* expr ::= MINUS VARIABLE */ yytestcase(yyruleno==235);
+{ yymsp[-1].minor.yy0.n += yymsp[0].minor.yy0.n; yymsp[-1].minor.yy0.type = TK_VARIABLE; yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[-1].minor.yy0, TK_VARIABLE);}
+ yymsp[-1].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 236: /* expr ::= BOOL */
+{ yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_BOOL);}
+ yymsp[0].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 237: /* expr ::= NULL */
+{ yylhsminor.yy166 = tSqlExprCreateIdValue(&yymsp[0].minor.yy0, TK_NULL);}
+ yymsp[0].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 238: /* expr ::= ID LP exprlist RP */
+{ yylhsminor.yy166 = tSqlExprCreateFunction(yymsp[-1].minor.yy441, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
+ yymsp[-3].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 239: /* expr ::= ID LP STAR RP */
+{ yylhsminor.yy166 = tSqlExprCreateFunction(NULL, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0, yymsp[-3].minor.yy0.type); }
+ yymsp[-3].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 240: /* expr ::= expr IS NULL */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, NULL, TK_ISNULL);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 241: /* expr ::= expr IS NOT NULL */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-3].minor.yy166, NULL, TK_NOTNULL);}
+ yymsp[-3].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 242: /* expr ::= expr LT expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_LT);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 243: /* expr ::= expr GT expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_GT);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 244: /* expr ::= expr LE expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_LE);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 245: /* expr ::= expr GE expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_GE);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 246: /* expr ::= expr NE expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_NE);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 247: /* expr ::= expr EQ expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_EQ);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 248: /* expr ::= expr BETWEEN expr AND expr */
+{ tSqlExpr* X2 = tSqlExprClone(yymsp[-4].minor.yy166); yylhsminor.yy166 = tSqlExprCreate(tSqlExprCreate(yymsp[-4].minor.yy166, yymsp[-2].minor.yy166, TK_GE), tSqlExprCreate(X2, yymsp[0].minor.yy166, TK_LE), TK_AND);}
+ yymsp[-4].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 249: /* expr ::= expr AND expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_AND);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 250: /* expr ::= expr OR expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_OR); }
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 251: /* expr ::= expr PLUS expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_PLUS); }
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 252: /* expr ::= expr MINUS expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_MINUS); }
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 253: /* expr ::= expr STAR expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_STAR); }
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 254: /* expr ::= expr SLASH expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_DIVIDE);}
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 255: /* expr ::= expr REM expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_REM); }
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 256: /* expr ::= expr LIKE expr */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-2].minor.yy166, yymsp[0].minor.yy166, TK_LIKE); }
+ yymsp[-2].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 257: /* expr ::= expr IN LP exprlist RP */
+{yylhsminor.yy166 = tSqlExprCreate(yymsp[-4].minor.yy166, (tSqlExpr*)yymsp[-1].minor.yy441, TK_IN); }
+ yymsp[-4].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 258: /* exprlist ::= exprlist COMMA expritem */
+{yylhsminor.yy441 = tSqlExprListAppend(yymsp[-2].minor.yy441,yymsp[0].minor.yy166,0, 0);}
+ yymsp[-2].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 259: /* exprlist ::= expritem */
+{yylhsminor.yy441 = tSqlExprListAppend(0,yymsp[0].minor.yy166,0, 0);}
+ yymsp[0].minor.yy441 = yylhsminor.yy441;
+ break;
+ case 260: /* expritem ::= expr */
+{yylhsminor.yy166 = yymsp[0].minor.yy166;}
+ yymsp[0].minor.yy166 = yylhsminor.yy166;
+ break;
+ case 262: /* cmd ::= RESET QUERY CACHE */
+{ setDCLSqlElems(pInfo, TSDB_SQL_RESET_CACHE, 0);}
+ break;
+ case 263: /* cmd ::= SYNCDB ids REPLICA */
+{ setDCLSqlElems(pInfo, TSDB_SQL_SYNC_DB_REPLICA, 1, &yymsp[-1].minor.yy0);}
+ break;
+ case 264: /* cmd ::= ALTER TABLE ids cpxName ADD COLUMN columnlist */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy525, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 273: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+=======
+ case 265: /* cmd ::= ALTER TABLE ids cpxName DROP COLUMN ids */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3142,21 +4823,33 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 274: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
+=======
+ case 266: /* cmd ::= ALTER TABLE ids cpxName MODIFY COLUMN columnlist */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy525, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 275: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+=======
+ case 267: /* cmd ::= ALTER TABLE ids cpxName ADD TAG columnlist */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy525, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 276: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+=======
+ case 268: /* cmd ::= ALTER TABLE ids cpxName DROP TAG ids */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3167,7 +4860,11 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 277: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+=======
+ case 269: /* cmd ::= ALTER TABLE ids cpxName CHANGE TAG ids ids */
+>>>>>>> dev
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
@@ -3181,7 +4878,11 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 278: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+=======
+ case 270: /* cmd ::= ALTER TABLE ids cpxName SET TAG ids EQ tagitem */
+>>>>>>> dev
{
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
@@ -3193,21 +4894,33 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 279: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
+=======
+ case 271: /* cmd ::= ALTER TABLE ids cpxName MODIFY TAG columnlist */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy525, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, -1);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 280: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+=======
+ case 272: /* cmd ::= ALTER STABLE ids cpxName ADD COLUMN columnlist */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy525, NULL, TSDB_ALTER_TABLE_ADD_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 281: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+=======
+ case 273: /* cmd ::= ALTER STABLE ids cpxName DROP COLUMN ids */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3218,21 +4931,33 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 282: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
+=======
+ case 274: /* cmd ::= ALTER STABLE ids cpxName MODIFY COLUMN columnlist */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy525, NULL, TSDB_ALTER_TABLE_CHANGE_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 283: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+=======
+ case 275: /* cmd ::= ALTER STABLE ids cpxName ADD TAG columnlist */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy525, NULL, TSDB_ALTER_TABLE_ADD_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 284: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+=======
+ case 276: /* cmd ::= ALTER STABLE ids cpxName DROP TAG ids */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
@@ -3243,7 +4968,11 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 285: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+=======
+ case 277: /* cmd ::= ALTER STABLE ids cpxName CHANGE TAG ids ids */
+>>>>>>> dev
{
yymsp[-5].minor.yy0.n += yymsp[-4].minor.yy0.n;
@@ -3257,7 +4986,11 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 286: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
+=======
+ case 278: /* cmd ::= ALTER STABLE ids cpxName SET TAG ids EQ tagitem */
+>>>>>>> dev
{
yymsp[-6].minor.yy0.n += yymsp[-5].minor.yy0.n;
@@ -3269,13 +5002,18 @@ static void yy_reduce(
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 287: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
+=======
+ case 279: /* cmd ::= ALTER STABLE ids cpxName MODIFY TAG columnlist */
+>>>>>>> dev
{
yymsp[-4].minor.yy0.n += yymsp[-3].minor.yy0.n;
SAlterTableInfo* pAlterTable = tSetAlterTableInfo(&yymsp[-4].minor.yy0, yymsp[0].minor.yy525, NULL, TSDB_ALTER_TABLE_MODIFY_TAG_COLUMN, TSDB_SUPER_TABLE);
setSqlInfo(pInfo, pAlterTable, NULL, TSDB_SQL_ALTER_TABLE);
}
break;
+<<<<<<< HEAD
case 288: /* cmd ::= KILL CONNECTION INTEGER */
{setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
break;
@@ -3283,6 +5021,15 @@ static void yy_reduce(
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);}
break;
case 290: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
+=======
+ case 280: /* cmd ::= KILL CONNECTION INTEGER */
+{setKillSql(pInfo, TSDB_SQL_KILL_CONNECTION, &yymsp[0].minor.yy0);}
+ break;
+ case 281: /* cmd ::= KILL STREAM INTEGER COLON INTEGER */
+{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_STREAM, &yymsp[-2].minor.yy0);}
+ break;
+ case 282: /* cmd ::= KILL QUERY INTEGER COLON INTEGER */
+>>>>>>> dev
{yymsp[-2].minor.yy0.n += (yymsp[-1].minor.yy0.n + yymsp[0].minor.yy0.n); setKillSql(pInfo, TSDB_SQL_KILL_QUERY, &yymsp[-2].minor.yy0);}
break;
default:
diff --git a/tests/pytest/fulltest.sh b/tests/pytest/fulltest.sh
index c9a91e1688..1f45cab13a 100755
--- a/tests/pytest/fulltest.sh
+++ b/tests/pytest/fulltest.sh
@@ -236,9 +236,10 @@ python3 ./test.py -f query/queryTscomputWithNow.py
python3 ./test.py -f query/computeErrorinWhere.py
python3 ./test.py -f query/queryTsisNull.py
python3 ./test.py -f query/subqueryFilter.py
-# python3 ./test.py -f query/nestedQuery/queryInterval.py
+python3 ./test.py -f query/nestedQuery/queryInterval.py
python3 ./test.py -f query/queryStateWindow.py
python3 ./test.py -f query/nestedQuery/queryWithOrderLimit.py
+python3 ./test.py -f query/nestquery_last_row.py
#stream
diff --git a/tests/pytest/functions/function_irate.py b/tests/pytest/functions/function_irate.py
index 2c85e1bbdd..4e876cc270 100644
--- a/tests/pytest/functions/function_irate.py
+++ b/tests/pytest/functions/function_irate.py
@@ -27,6 +27,7 @@ class TDTestCase:
self.rowNum = 100
self.ts = 1537146000000
self.ts1 = 1537146000000000
+ self.ts2 = 1597146000000
def run(self):
@@ -35,6 +36,8 @@ class TDTestCase:
tdSql.execute('''create table test(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double,
col7 bool, col8 binary(20), col9 nchar(20), col11 tinyint unsigned, col12 smallint unsigned, col13 int unsigned, col14 bigint unsigned) tags(loc nchar(20), tag1 int)''')
tdSql.execute("create table test1 using test tags('beijing', 10)")
+ tdSql.execute("create table test2 using test tags('tianjing', 20)")
+ tdSql.execute("create table test3 using test tags('shanghai', 20)")
tdSql.execute("create table gtest1 (ts timestamp, col1 float)")
tdSql.execute("create table gtest2 (ts timestamp, col1 tinyint)")
tdSql.execute("create table gtest3 (ts timestamp, col1 tinyint)")
@@ -48,6 +51,10 @@ class TDTestCase:
for i in range(self.rowNum):
tdSql.execute("insert into test1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
% (self.ts + i*1000, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
+ tdSql.execute("insert into test2 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
+ % (self.ts2 + i*1000, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
+ tdSql.execute("insert into test3 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)"
+ % (self.ts2 + i*1000, i + 1, i + 1, i + 1, i + 1, i + 0.1, i + 0.1, i % 2, i + 1, i + 1, i + 1, i + 1, i + 1, i + 1))
tdSql.execute("insert into gtest1 values(1537146000000,0);")
tdSql.execute("insert into gtest1 values(1537146001100,1.2);")
@@ -69,7 +76,7 @@ class TDTestCase:
tdSql.execute("insert into gtest8 values(1537146000002,4);")
tdSql.execute("insert into gtest8 values(1537146002202,4);")
- # irate verifacation
+ # irate verifacation --child table'query
tdSql.query("select irate(col1) from test1;")
tdSql.checkData(0, 0, 1)
tdSql.query("select irate(col1) from test1 interval(10s);")
@@ -99,6 +106,32 @@ class TDTestCase:
tdSql.query("select irate(col2) from test1;")
tdSql.checkData(0, 0, 1)
+ # irate verifacation --super table'query
+ tdSql.query("select irate(col1) from test group by tbname,loc,tag1;")
+ tdSql.checkData(0, 0, 1)
+ tdSql.checkData(1, 1, "test2")
+ tdSql.checkData(2, 2, "shanghai")
+
+ # add function testcase of twa: query from super table
+ tdSql.query("select twa(col1) from test group by tbname,loc,tag1;")
+ tdSql.checkData(0, 0, 50.5)
+ tdSql.checkData(1, 1, "test2")
+ tdSql.checkData(2, 2, "shanghai")
+
+ # error: function of irate and twa has invalid operation
+ tdSql.error("select irate(col7) from test group by tbname,loc,tag1;")
+ tdSql.error("select irate(col7) from test group by tbname;")
+ tdSql.error("select irate(col1) from test group by loc,tbname,tag1;")
+ # tdSql.error("select irate(col1) from test group by tbname,col7;")
+ tdSql.error("select irate(col1) from test group by col7,tbname;")
+ tdSql.error("select twa(col7) from test group by tbname,loc,tag1;")
+ tdSql.error("select twa(col7) from test group by tbname;")
+ tdSql.error("select twa(col1) from test group by loc,tbname,tag1;")
+ # tdSql.error("select twa(col1) from test group by tbname,col7;")
+ tdSql.error("select twa(col1) from test group by col7,tbname;")
+
+
+ # general table'query
tdSql.query("select irate(col1) from gtest1;")
tdSql.checkData(0, 0, 1.2/1.1)
tdSql.query("select irate(col1) from gtest2;")
diff --git a/tests/pytest/query/nestquery_last_row.py b/tests/pytest/query/nestquery_last_row.py
new file mode 100644
index 0000000000..a04cb173af
--- /dev/null
+++ b/tests/pytest/query/nestquery_last_row.py
@@ -0,0 +1,263 @@
+###################################################################
+# 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
+
+
+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-4735
+
+ 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 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')''')
+ #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 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))
+
+ 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("=======last_row(*)========")
+ sql = '''select last_row(*) from stable_1;'''
+ tdSql.query(sql)
+ tdSql.checkData(0,1,self.num-1)
+ sql = '''select last_row(*) from regular_table_1;'''
+ tdSql.query(sql)
+ tdSql.checkData(0,1,self.num-1)
+
+ sql = '''select * from stable_1
+ where loc = 'table_0';'''
+ tdSql.query(sql)
+ tdSql.checkRows(self.num)
+ sql = '''select last_row(*) from
+ (select * from stable_1
+ where loc = 'table_0');'''
+ tdSql.query(sql)
+ tdSql.checkRows(1)
+ sql = '''select last_row(*) from
+ (select * from stable_1);'''
+ tdSql.query(sql)
+ tdSql.checkData(0,1,self.num-1)
+ tdSql.checkData(0,2,self.num-1)
+ tdSql.checkData(0,3,self.num-1)
+ tdSql.checkData(0,4,self.num-1)
+ tdSql.checkData(0,5,'False')
+ tdSql.checkData(0,6,'binary5.9')
+ tdSql.checkData(0,7,'nchar5.9')
+ tdSql.checkData(0,8,9.00000)
+ tdSql.checkData(0,9,9.000000000)
+ tdSql.checkData(0,10,'2020-09-13 20:26:40.009')
+ tdSql.checkData(0,11,'table_5')
+ tdSql.checkData(0,12,5)
+ tdSql.checkData(0,13,5)
+ tdSql.checkData(0,14,5)
+ tdSql.checkData(0,15,5)
+ tdSql.checkData(0,16,'True')
+ tdSql.checkData(0,17,'binary5')
+ tdSql.checkData(0,18,'nchar5')
+ tdSql.checkData(0,21,'1970-01-01 08:00:00.000')
+
+ 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)
+ tdSql.checkData(0,2,self.num-1)
+ tdSql.checkData(0,3,self.num-1)
+ tdSql.checkData(0,4,self.num-1)
+ tdSql.checkData(0,5,'False')
+ tdSql.checkData(0,6,'binary5.9')
+ tdSql.checkData(0,7,'nchar5.9')
+ tdSql.checkData(0,8,9.00000)
+ tdSql.checkData(0,9,9.000000000)
+ tdSql.checkData(0,10,'2020-09-13 20:26:40.009')
+
+ sql = '''select last_row(*) from
+ ((select * from table_0) union all
+ (select * from table_1) union all
+ (select * from table_2));'''
+ tdSql.query(sql)
+ tdSql.checkRows(1)
+ tdSql.checkData(0,1,self.num-1)
+ tdSql.checkData(0,2,self.num-1)
+ tdSql.checkData(0,3,self.num-1)
+ tdSql.checkData(0,4,self.num-1)
+ tdSql.checkData(0,5,'False')
+ tdSql.checkData(0,6,'binary.9')
+ tdSql.checkData(0,7,'nchar.9')
+ tdSql.checkData(0,8,9.00000)
+ tdSql.checkData(0,9,9.000000000)
+ tdSql.checkData(0,10,'2020-09-13 20:26:40.009')
+
+ # bug 5055
+ # sql = '''select last_row(*) from
+ # ((select * from stable_1) union all
+ # (select * from table_1) union all
+ # (select * from regular_table_1));'''
+ # tdSql.query(sql)
+ # tdSql.checkData(0,1,self.num-1)
+
+ 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.query(sql)
+ tdSql.checkRows(1)
+ tdSql.checkData(0,1,self.num-1)
+ tdSql.checkData(0,2,self.num-1)
+ tdSql.checkData(0,3,self.num-1)
+ tdSql.checkData(0,4,self.num-1)
+ tdSql.checkData(0,5,'False')
+ tdSql.checkData(0,6,'binary.9')
+ tdSql.checkData(0,7,'nchar.9')
+ tdSql.checkData(0,8,9.00000)
+ tdSql.checkData(0,9,9.000000000)
+ tdSql.checkData(0,10,'2020-09-13 20:26:40.009')
+
+ # bug 5055
+ # sql = '''select last_row(*) from
+ # ((select last_row(*) from stable_1) union all
+ # (select last_row(*) from table_1) union all
+ # (select last_row(*) from regular_table_1));'''
+ # tdSql.query(sql)
+ # tdSql.checkData(0,1,self.num-1)
+
+ 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.query(sql)
+ tdSql.checkRows(1)
+ tdSql.checkData(0,1,self.num-1)
+ tdSql.checkData(0,2,self.num-1)
+ tdSql.checkData(0,3,self.num-1)
+ tdSql.checkData(0,4,self.num-1)
+ tdSql.checkData(0,5,'False')
+ tdSql.checkData(0,6,'binary.9')
+ tdSql.checkData(0,7,'nchar.9')
+ tdSql.checkData(0,8,9.00000)
+ tdSql.checkData(0,9,9.000000000)
+ tdSql.checkData(0,10,'2020-09-13 20:26:40.009')
+
+
+ sql = '''select last_row(*) from
+ (select * from stable_1)
+ having q_int>5;'''
+ tdLog.info(sql)
+ tdSql.error(sql)
+ try:
+ tdSql.execute(sql)
+ tdLog.exit(" having only works with group by")
+ except Exception as e:
+ tdLog.info(repr(e))
+ tdLog.info("invalid operation: having only works with group by")
+
+ #bug 5057
+ # sql = '''select last_row(*) from
+ # (select * from (select * from stable_1))'''
+ # tdLog.info(sql)
+ # tdSql.error(sql)
+ # try:
+ # tdSql.execute(sql)
+ # tdLog.exit(" core dumped")
+ # except Exception as e:
+ # tdLog.info(repr(e))
+ # tdLog.info("core dumped")
+
+
+
+ def stop(self):
+ tdSql.close()
+ tdLog.success("%s successfully executed" % __file__)
+
+
+tdCases.addWindows(__file__, TDTestCase())
+tdCases.addLinux(__file__, TDTestCase())
\ No newline at end of file
diff --git a/tests/pytest/tools/taosdemoTest.py b/tests/pytest/tools/taosdemoTest.py
index fec69bed64..4cae8dfd3c 100644
--- a/tests/pytest/tools/taosdemoTest.py
+++ b/tests/pytest/tools/taosdemoTest.py
@@ -51,7 +51,7 @@ class TDTestCase:
else:
tdLog.info("taosdemo found in %s" % buildPath)
binPath = buildPath + "/build/bin/"
- os.system("%staosdemo -y -t %d -n %d" %
+ os.system("%staosdemo -y -t %d -n %d -b INT,INT,INT,INT" %
(binPath, self.numberOfTables, self.numberOfRecords))
tdSql.execute("use test")
diff --git a/tests/pytest/tools/taosdemoTestTblAlt.py b/tests/pytest/tools/taosdemoTestTblAlt.py
index 9aa131624e..56c535916a 100644
--- a/tests/pytest/tools/taosdemoTestTblAlt.py
+++ b/tests/pytest/tools/taosdemoTestTblAlt.py
@@ -54,7 +54,7 @@ class TDTestCase:
binPath = buildPath + "/build/bin/"
if(threadID == 0):
- os.system("%staosdemo -y -t %d -n %d" %
+ os.system("%staosdemo -y -t %d -n %d -b INT,INT,INT,INT -m t" %
(binPath, self.numberOfTables, self.numberOfRecords))
if(threadID == 1):
time.sleep(2)
diff --git a/tests/pytest/tools/taosdemoTestWithoutMetric.py b/tests/pytest/tools/taosdemoTestWithoutMetric.py
index 9687600563..01e19355d9 100644
--- a/tests/pytest/tools/taosdemoTestWithoutMetric.py
+++ b/tests/pytest/tools/taosdemoTestWithoutMetric.py
@@ -60,7 +60,7 @@ class TDTestCase:
tdSql.execute("use test")
tdSql.query(
- "select count(*) from test.t%d" % (self.numberOfTables -1))
+ "select count(*) from test.d%d" % (self.numberOfTables -1))
tdSql.checkData(0, 0, self.numberOfRecords)
def stop(self):
diff --git a/tests/pytest/wal/sdbComp.py b/tests/pytest/wal/sdbComp.py
index c0ac02610f..56b18c49eb 100644
--- a/tests/pytest/wal/sdbComp.py
+++ b/tests/pytest/wal/sdbComp.py
@@ -28,6 +28,7 @@ class TDTestCase:
tdSql.init(conn.cursor(), logSql)
def getBuildPath(self):
+ global selfPath
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
@@ -53,7 +54,7 @@ class TDTestCase:
tdLog.info("taosd found in %s" % buildPath)
binPath = buildPath+ "/build/bin/"
- testPath = buildPath[:buildPath.find("debug")]
+ testPath = selfPath+ "/../../../"
walFilePath = testPath + "/sim/dnode1/data/mnode_bak/wal/"
#new db and insert data
diff --git a/tests/pytest/wal/sdbCompClusterReplica2.py b/tests/pytest/wal/sdbCompClusterReplica2.py
index 117da8ca2f..e364145e19 100644
--- a/tests/pytest/wal/sdbCompClusterReplica2.py
+++ b/tests/pytest/wal/sdbCompClusterReplica2.py
@@ -86,6 +86,18 @@ class TwoClients:
tdSql.execute("alter table stb2_0 add column col2 binary(4)")
tdSql.execute("alter table stb2_0 drop column col1")
tdSql.execute("insert into stb2_0 values(1614218422000,8638,'R')")
+ tdSql.execute("drop dnode 10")
+ sleep(10)
+ os.system("rm -rf /var/lib/taos/*")
+ print("clear dnode chenhaoran02'data files")
+ os.system("nohup /usr/bin/taosd > /dev/null 2>&1 &")
+ print("start taosd")
+ sleep(10)
+ tdSql.execute("reset query cache ;")
+ tdSql.execute("create dnode chenhaoran02 ;")
+
+
+
# stop taosd and compact wal file
diff --git a/tests/script/general/db/alter_option.sim b/tests/script/general/db/alter_option.sim
index c20a96fd1b..36f4c0e7dc 100644
--- a/tests/script/general/db/alter_option.sim
+++ b/tests/script/general/db/alter_option.sim
@@ -198,29 +198,25 @@ if $data12_db != 1 then
return -1
endi
-sql alter database db wal 1
-sql show databases
-print wal $data12_db
-if $data12_db != 1 then
- return -1
-endi
+sql_error alter database db wal 1
-sql alter database db wal 1
-sql alter database db wal 2
-sql alter database db wal 1
-sql alter database db wal 2
-sql alter database db wal 0
+
+sql_error alter database db wal 1
+sql_error alter database db wal 2
+sql_error alter database db wal 1
+sql_error alter database db wal 2
+sql_error alter database db wal 0
sql_error alter database db wal 3
sql_error alter database db wal 4
sql_error alter database db wal -1
sql_error alter database db wal 1000
print ============== step fsync
-sql alter database db fsync 0
-sql alter database db fsync 1
-sql alter database db fsync 3600
-sql alter database db fsync 18000
-sql alter database db fsync 180000
+sql_error alter database db fsync 0
+sql_error alter database db fsync 1
+sql_error alter database db fsync 3600
+sql_error alter database db fsync 18000
+sql_error alter database db fsync 180000
sql_error alter database db fsync 180001
sql_error alter database db fsync -1
diff --git a/tests/script/general/db/topic1.sim b/tests/script/general/db/topic1.sim
index 4939e5a0e2..1639973120 100644
--- a/tests/script/general/db/topic1.sim
+++ b/tests/script/general/db/topic1.sim
@@ -495,18 +495,13 @@ if $data12_db != 1 then
endi
sql_error alter topic db wal 1
-sql alter database db wal 1
-sql show databases
-print wal $data12_db
-if $data12_db != 1 then
- return -1
-endi
+sql_error alter database db wal 1
-sql alter database db wal 1
-sql alter database db wal 2
-sql alter database db wal 1
-sql alter database db wal 2
-sql alter database db wal 0
+sql_error alter database db wal 1
+sql_error alter database db wal 2
+sql_error alter database db wal 1
+sql_error alter database db wal 2
+sql_error alter database db wal 0
sql_error alter database db wal 3
sql_error alter database db wal 4
sql_error alter database db wal -1
@@ -523,11 +518,11 @@ sql_error alter topic db wal -1
sql_error alter topic db wal 1000
print ============== step fsync
-sql alter database db fsync 0
-sql alter database db fsync 1
-sql alter database db fsync 3600
-sql alter database db fsync 18000
-sql alter database db fsync 180000
+sql_error alter database db fsync 0
+sql_error alter database db fsync 1
+sql_error alter database db fsync 3600
+sql_error alter database db fsync 18000
+sql_error alter database db fsync 180000
sql_error alter database db fsync 180001
sql_error alter database db fsync -1
@@ -615,17 +610,6 @@ if $rows != 1 then
return -1
endi
-sql alter database d1 fsync 0
-sql show topics;
-if $rows != 0 then
- return -1
-endi
-
-sql show databases;
-if $rows != 1 then
- return -1
-endi
-
sql drop database d1
sql show topics;
if $rows != 0 then
@@ -649,17 +633,6 @@ if $rows != 1 then
return -1
endi
-sql alter database d1 fsync 0
-sql show topics;
-if $rows != 1 then
- return -1
-endi
-
-sql show databases;
-if $rows != 1 then
- return -1
-endi
-
sql drop database d1
sql show topics;
if $rows != 0 then
diff --git a/tests/script/general/parser/create_db.sim b/tests/script/general/parser/create_db.sim
index 7881060ad1..a62a45e023 100644
--- a/tests/script/general/parser/create_db.sim
+++ b/tests/script/general/parser/create_db.sim
@@ -237,7 +237,42 @@ sql_error create database $db ctime 29
sql_error create database $db ctime 40961
# wal {0, 2}
-#sql_error create database $db wal 0
+sql create database testwal wal 0
+sql show databases
+if $rows != 1 then
+ return -1
+endi
+
+sql show databases
+print wallevel $data12_testwal
+if $data12_testwal != 0 then
+ return -1
+endi
+sql drop database testwal
+
+sql create database testwal wal 1
+sql show databases
+if $rows != 1 then
+ return -1
+endi
+sql show databases
+print wallevel $data12_testwal
+if $data12_testwal != 1 then
+ return -1
+endi
+sql drop database testwal
+
+sql create database testwal wal 2
+sql show databases
+if $rows != 1 then
+ return -1
+endi
+print wallevel $data12_testwal
+if $data12_testwal != 2 then
+ return -1
+endi
+sql drop database testwal
+
sql_error create database $db wal -1
sql_error create database $db wal 3