diff --git a/.gitignore b/.gitignore index d7fcb019ae..80fd850cd4 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,8 @@ pysim/ *.out *DS_Store tests/script/api/batchprepare +taosadapter +taosadapter-debug # Doxygen Generated files html/ diff --git a/.gitmodules b/.gitmodules index 31c211bf89..07e4bb2b9c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,12 +13,3 @@ [submodule "examples/rust"] path = examples/rust url = https://github.com/songtianyi/tdengine-rust-bindings.git -[submodule "tools/taos-tools"] - path = tools/taos-tools - url = https://github.com/taosdata/taos-tools -[submodule "tools/taosadapter"] - path = tools/taosadapter - url = https://github.com/taosdata/taosadapter.git -[submodule "tools/taosws-rs"] - path = tools/taosws-rs - url = https://github.com/taosdata/taosws-rs diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 1b04e40f2a..83fa1479dc 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -113,6 +113,12 @@ def pre_test(){ echo "unmatched reposiotry ${CHANGE_URL}" ''' } + sh ''' + cd ${WKC} + git rm --cached tools/taos-tools 2>/dev/null || : + git rm --cached tools/taosadapter 2>/dev/null || : + git rm --cached tools/taosws-rs 2>/dev/null || : + ''' sh ''' cd ${WKC} git submodule update --init --recursive @@ -258,6 +264,13 @@ def pre_test_win(){ git branch git log -5 ''' + bat ''' + cd %WIN_COMMUNITY_ROOT% + git rm --cached tools/taos-tools 2>nul + git rm --cached tools/taosadapter 2>nul + git rm --cached tools/taosws-rs 2>nul + exit 0 + ''' bat ''' cd %WIN_COMMUNITY_ROOT% git submodule update --init --recursive diff --git a/cmake/taosadapter_CMakeLists.txt.in b/cmake/taosadapter_CMakeLists.txt.in new file mode 100644 index 0000000000..af3b5af4a6 --- /dev/null +++ b/cmake/taosadapter_CMakeLists.txt.in @@ -0,0 +1,13 @@ + +# zlib +ExternalProject_Add(taosadapter + GIT_REPOSITORY https://github.com/taosdata/taosadapter.git + GIT_TAG df8678f + SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosadapter" + BINARY_DIR "" + #BUILD_IN_SOURCE TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in new file mode 100644 index 0000000000..dfebcd2956 --- /dev/null +++ b/cmake/taostools_CMakeLists.txt.in @@ -0,0 +1,13 @@ + +# zlib +ExternalProject_Add(taos-tools + GIT_REPOSITORY https://github.com/taosdata/taos-tools.git + GIT_TAG 817cb6a + SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" + BINARY_DIR "" + #BUILD_IN_SOURCE TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) diff --git a/cmake/taosws_CMakeLists.txt.in b/cmake/taosws_CMakeLists.txt.in new file mode 100644 index 0000000000..4b7c264472 --- /dev/null +++ b/cmake/taosws_CMakeLists.txt.in @@ -0,0 +1,13 @@ + +# zlib +ExternalProject_Add(taosws-rs + GIT_REPOSITORY https://github.com/taosdata/taosws-rs.git + GIT_TAG 9de599d + SOURCE_DIR "${TD_SOURCE_DIR}/tools/taosws-rs" + BINARY_DIR "" + #BUILD_IN_SOURCE TRUE + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index e80e7e4110..1887ba5365 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -9,6 +9,24 @@ endfunction(cat IN_FILE OUT_FILE) set(CONTRIB_TMP_FILE "${CMAKE_BINARY_DIR}/deps_tmp_CMakeLists.txt.in") configure_file("${TD_SUPPORT_DIR}/deps_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) +# taos-tools +if(${BUILD_TOOLS}) + cat("${TD_SUPPORT_DIR}/taostools_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) +endif() + +# taosws-rs +if(${WEBSOCKET}) + cat("${TD_SUPPORT_DIR}/taosws_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) +endif() + +# taosadapter +if(${BUILD_HTTP}) + MESSAGE("BUILD_HTTP is on") +else () + MESSAGE("BUILD_HTTP is off, use taosAdapter") + cat("${TD_SUPPORT_DIR}/taosadapter_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) +endif() + # pthread if(${BUILD_PTHREAD}) cat("${TD_SUPPORT_DIR}/pthread_CMakeLists.txt.in" ${CONTRIB_TMP_FILE}) diff --git a/docs/zh/07-develop/06-continuous-query.mdx b/docs/zh/07-develop/06-stream.md similarity index 100% rename from docs/zh/07-develop/06-continuous-query.mdx rename to docs/zh/07-develop/06-stream.md diff --git a/docs/zh/07-develop/07-subscribe.md b/docs/zh/07-develop/07-tmq.md similarity index 100% rename from docs/zh/07-develop/07-subscribe.md rename to docs/zh/07-develop/07-tmq.md diff --git a/docs/zh/12-taos-sql/02-database.md b/docs/zh/12-taos-sql/02-database.md index 38119dfb44..839b1e2015 100644 --- a/docs/zh/12-taos-sql/02-database.md +++ b/docs/zh/12-taos-sql/02-database.md @@ -18,7 +18,7 @@ database_option: { | CACHESIZE value | COMP {0 | 1 | 2} | DURATION value - | FSYNC value + | WAL_FSYNC_PERIOD value | MAXROWS value | MINROWS value | KEEP value @@ -28,7 +28,7 @@ database_option: { | REPLICA value | RETENTIONS ingestion_duration:keep_duration ... | STRICT {'off' | 'on'} - | WAL {1 | 2} + | WAL_LEVEL {1 | 2} | VGROUPS value | SINGLE_STABLE {0 | 1} | WAL_RETENTION_PERIOD value @@ -39,41 +39,42 @@ database_option: { ``` ### 参数说明 -- buffer: 一个 VNODE 写入内存池大小,单位为MB,默认为96,最小为3,最大为16384。 -- CACHEMODEL:表示是否在内存中缓存子表的最近数据。默认为none。 - - none:表示不缓存。 - - last_row:表示缓存子表最近一行数据。这将显著改善 LAST_ROW 函数的性能表现。 - - last_value:表示缓存子表每一列的最近的非 NULL 值。这将显著改善无特殊影响(WHERE、ORDER BY、GROUP BY、INTERVAL)下的 LAST 函数的性能表现。 - - both:表示同时打开缓存最近行和列功能。 -- CACHESIZE:表示缓存子表最近数据的内存大小。默认为 1 ,范围是[1, 65536],单位是 MB。 + +- BUFFER: 一个 VNODE 写入内存池大小,单位为 MB,默认为 96,最小为 3,最大为 16384。 +- CACHEMODEL:表示是否在内存中缓存子表的最近数据。默认为 none。 + - none:表示不缓存。 + - last_row:表示缓存子表最近一行数据。这将显著改善 LAST_ROW 函数的性能表现。 + - last_value:表示缓存子表每一列的最近的非 NULL 值。这将显著改善无特殊影响(WHERE、ORDER BY、GROUP BY、INTERVAL)下的 LAST 函数的性能表现。 + - both:表示同时打开缓存最近行和列功能。 +- CACHESIZE:表示每个 vnode 中用于缓存子表最近数据的内存大小。默认为 1 ,范围是[1, 65536],单位是 MB。 - COMP:表示数据库文件压缩标志位,缺省值为 2,取值范围为 [0, 2]。 - - 0:表示不压缩。 - - 1:表示一阶段压缩。 - - 2:表示两阶段压缩。 -- DURATION:数据文件存储数据的时间跨度。可以使用加单位的表示形式,如 DURATION 100h、DURATION 10d等,支持 m(分钟)、h(小时)和 d(天)三个单位。不加时间单位时默认单位为天,如 DURATION 50 表示 50 天。 -- FSYNC:当 WAL 参数设置为2时,落盘的周期。默认为3000,单位毫秒。最小为0,表示每次写入立即落盘;最大为180000,即三分钟。 -- MAXROWS:文件块中记录的最大条数,默认为4096条。 -- MINROWS:文件块中记录的最小条数,默认为100条。 -- KEEP:表示数据文件保存的天数,缺省值为 3650,取值范围 [1, 365000],且必须大于或等于 DURATION 参数值。数据库会自动删除保存时间超过KEEP值的数据。KEEP 可以使用加单位的表示形式,如 KEEP 100h、KEEP 10d 等,支持m(分钟)、h(小时)和 d(天)三个单位。也可以不写单位,如 KEEP 50,此时默认单位为天。 -- PAGES:一个 VNODE 中元数据存储引擎的缓存页个数,默认为256,最小64。一个 VNODE 元数据存储占用 PAGESIZE * PAGES,默认情况下为1MB内存。 -- PAGESIZE:一个 VNODE 中元数据存储引擎的页大小,单位为KB,默认为4 KB。范围为1到16384,即1 KB到16 MB。 -- PRECISION:数据库的时间戳精度。ms表示毫秒,us表示微秒,ns表示纳秒,默认ms毫秒。 -- REPLICA:表示数据库副本数,取值为1或3,默认为1。在集群中使用,副本数必须小于或等于 DNODE 的数目。 -- RETENTIONS:表示数据的聚合周期和保存时长,如RETENTIONS 15s:7d,1m:21d,15m:50d表示数据原始采集周期为15秒,原始数据保存7天;按1分钟聚合的数据保存21天;按15分钟聚合的数据保存50天。目前支持且只支持三级存储周期。 -- STRICT:表示数据同步的一致性要求,默认为off。 - - on 表示强一致,即运行标准的 raft 协议,半数提交返回成功。 - - off表示弱一致,本地提交即返回成功。 -- WAL:WAL级别,默认为1。 - - 1:写WAL,但不执行fsync。 - - 2:写WAL,而且执行fsync。 -- VGROUPS:数据库中初始vgroup的数目。 + - 0:表示不压缩。 + - 1:表示一阶段压缩。 + - 2:表示两阶段压缩。 +- DURATION:数据文件存储数据的时间跨度。可以使用加单位的表示形式,如 DURATION 100h、DURATION 10d 等,支持 m(分钟)、h(小时)和 d(天)三个单位。不加时间单位时默认单位为天,如 DURATION 50 表示 50 天。 +- WAL_FSYNC_PERIOD:当 WAL 参数设置为 2 时,落盘的周期。默认为 3000,单位毫秒。最小为 0,表示每次写入立即落盘;最大为 180000,即三分钟。 +- MAXROWS:文件块中记录的最大条数,默认为 4096 条。 +- MINROWS:文件块中记录的最小条数,默认为 100 条。 +- KEEP:表示数据文件保存的天数,缺省值为 3650,取值范围 [1, 365000],且必须大于或等于 DURATION 参数值。数据库会自动删除保存时间超过 KEEP 值的数据。KEEP 可以使用加单位的表示形式,如 KEEP 100h、KEEP 10d 等,支持 m(分钟)、h(小时)和 d(天)三个单位。也可以不写单位,如 KEEP 50,此时默认单位为天。 +- PAGES:一个 VNODE 中元数据存储引擎的缓存页个数,默认为 256,最小 64。一个 VNODE 元数据存储占用 PAGESIZE \* PAGES,默认情况下为 1MB 内存。 +- PAGESIZE:一个 VNODE 中元数据存储引擎的页大小,单位为 KB,默认为 4 KB。范围为 1 到 16384,即 1 KB 到 16 MB。 +- PRECISION:数据库的时间戳精度。ms 表示毫秒,us 表示微秒,ns 表示纳秒,默认 ms 毫秒。 +- REPLICA:表示数据库副本数,取值为 1 或 3,默认为 1。在集群中使用,副本数必须小于或等于 DNODE 的数目。 +- RETENTIONS:表示数据的聚合周期和保存时长,如 RETENTIONS 15s:7d,1m:21d,15m:50d 表示数据原始采集周期为 15 秒,原始数据保存 7 天;按 1 分钟聚合的数据保存 21 天;按 15 分钟聚合的数据保存 50 天。目前支持且只支持三级存储周期。 +- STRICT:表示数据同步的一致性要求,默认为 off。 + - on 表示强一致,即运行标准的 raft 协议,半数提交返回成功。 + - off 表示弱一致,本地提交即返回成功。 +- WAL_LEVEL:WAL 级别,默认为 1。 + - 1:写 WAL,但不执行 fsync。 + - 2:写 WAL,而且执行 fsync。 +- VGROUPS:数据库中初始 vgroup 的数目。 - SINGLE_STABLE:表示此数据库中是否只可以创建一个超级表,用于超级表列非常多的情况。 - - 0:表示可以创建多张超级表。 - - 1:表示只可以创建一张超级表。 -- WAL_RETENTION_PERIOD:wal文件的额外保留策略,用于数据订阅。wal的保存时长,单位为s。默认为0,即落盘后立即删除。-1表示不删除。 -- WAL_RETENTION_SIZE:wal文件的额外保留策略,用于数据订阅。wal的保存的最大上限,单位为KB。默认为0,即落盘后立即删除。-1表示不删除。 -- WAL_ROLL_PERIOD:wal文件切换时长,单位为s。当wal文件创建并写入后,经过该时间,会自动创建一个新的wal文件。默认为0,即仅在落盘时创建新文件。 -- WAL_SEGMENT_SIZE:wal单个文件大小,单位为KB。当前写入文件大小超过上限后会自动创建一个新的wal文件。默认为0,即仅在落盘时创建新文件。 + - 0:表示可以创建多张超级表。 + - 1:表示只可以创建一张超级表。 +- WAL_RETENTION_PERIOD:wal 文件的额外保留策略,用于数据订阅。wal 的保存时长,单位为 s。默认为 0,即落盘后立即删除。-1 表示不删除。 +- WAL_RETENTION_SIZE:wal 文件的额外保留策略,用于数据订阅。wal 的保存的最大上限,单位为 KB。默认为 0,即落盘后立即删除。-1 表示不删除。 +- WAL_ROLL_PERIOD:wal 文件切换时长,单位为 s。当 wal 文件创建并写入后,经过该时间,会自动创建一个新的 wal 文件。默认为 0,即仅在落盘时创建新文件。 +- WAL_SEGMENT_SIZE:wal 单个文件大小,单位为 KB。当前写入文件大小超过上限后会自动创建一个新的 wal 文件。默认为 0,即仅在落盘时创建新文件。 ### 创建数据库示例 @@ -104,10 +105,10 @@ DROP DATABASE [IF EXISTS] db_name ```sql ALTER DATABASE db_name [alter_database_options] - + alter_database_options: alter_database_option ... - + alter_database_option: { CACHEMODEL {'none' | 'last_row' | 'last_value' | 'both'} | CACHESIZE value @@ -118,7 +119,7 @@ alter_database_option: { ``` :::note -其它参数在3.0.0.0中暂不支持修改 +其它参数在 3.0.0.0 中暂不支持修改 ::: @@ -139,3 +140,17 @@ SHOW CREATE DATABASE db_name; 常用于数据库迁移。对一个已经存在的数据库,返回其创建语句;在另一个集群中执行该语句,就能得到一个设置完全相同的 Database。 ### 查看数据库参数 + +```sql +SHOW DATABASES \G; +``` + +会列出系统中所有数据库的配置参数,并且每行只显示一个参数。 + +## 删除过期数据 + +```sql +TRIM DATABASE db_name; +``` + +删除过期数据,并根据多级存储的配置归整数据。 diff --git a/docs/zh/12-taos-sql/03-table.md b/docs/zh/12-taos-sql/03-table.md index 9f3586ce6d..1e20f73541 100644 --- a/docs/zh/12-taos-sql/03-table.md +++ b/docs/zh/12-taos-sql/03-table.md @@ -139,6 +139,7 @@ ALTER TABLE tb_name RENAME COLUMN old_col_name new_col_name ## 修改子表 +```sql ALTER TABLE [db_name.]tb_name alter_table_clause alter_table_clause: { @@ -153,6 +154,7 @@ alter_table_option: { TTL value | COMMENT 'string_value' } +``` **使用说明** 1. 对子表的列和标签的修改,除了更改标签值以外,都要通过超级表才能进行。 @@ -192,5 +194,5 @@ SHOW CREATE TABLE tb_name; ### 获取表结构信息 ``` -DESCRIBE tb_name; +DESCRIBE [db_name.]tb_name; ``` \ No newline at end of file diff --git a/docs/zh/12-taos-sql/04-stable.md b/docs/zh/12-taos-sql/04-stable.md index 4d0f5e4765..59d9657694 100644 --- a/docs/zh/12-taos-sql/04-stable.md +++ b/docs/zh/12-taos-sql/04-stable.md @@ -46,7 +46,7 @@ SHOW CREATE STABLE stb_name; ### 获取超级表的结构信息 ``` -DESCRIBE stb_name; +DESCRIBE [db_name.]stb_name; ``` ## 删除超级表 diff --git a/docs/zh/12-taos-sql/06-select.md b/docs/zh/12-taos-sql/06-select.md index 16f1997d5a..84fcda232d 100644 --- a/docs/zh/12-taos-sql/06-select.md +++ b/docs/zh/12-taos-sql/06-select.md @@ -218,7 +218,7 @@ GROUP BY 子句中的表达式可以包含表或视图中的任何列,这些 PARTITION BY 子句是 TDengine 特色语法,按 part_list 对数据进行切分,在每个切分的分片中进行计算。 -详见 [TDengine 特色查询](taos-sql/distinguished) +详见 [TDengine 特色查询](./distinguished) ## ORDER BY diff --git a/docs/zh/12-taos-sql/10-function.md b/docs/zh/12-taos-sql/10-function.md index 7674967f09..876aaa553e 100644 --- a/docs/zh/12-taos-sql/10-function.md +++ b/docs/zh/12-taos-sql/10-function.md @@ -13,7 +13,7 @@ toc_max_heading_level: 4 #### ABS ```sql - SELECT ABS(field_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT ABS(field_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列的绝对值 @@ -31,7 +31,7 @@ toc_max_heading_level: 4 #### ACOS ```sql - SELECT ACOS(field_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT ACOS(field_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列的反余弦结果 @@ -49,7 +49,7 @@ toc_max_heading_level: 4 #### ASIN ```sql - SELECT ASIN(field_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT ASIN(field_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列的反正弦结果 @@ -68,7 +68,7 @@ toc_max_heading_level: 4 #### ATAN ```sql - SELECT ATAN(field_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT ATAN(field_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列的反正切结果 @@ -86,7 +86,7 @@ toc_max_heading_level: 4 #### CEIL -``` +```sql SELECT CEIL(field_name) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -108,7 +108,7 @@ SELECT CEIL(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### COS ```sql - SELECT COS(field_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT COS(field_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列的余弦结果 @@ -125,7 +125,7 @@ SELECT CEIL(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### FLOOR -``` +```sql SELECT FLOOR(field_name) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -135,7 +135,7 @@ SELECT FLOOR(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### LOG ```sql - SELECT LOG(field_name, base) FROM { tb_name | stb_name } [WHERE clause] +SELECT LOG(field_name, base) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列对于底数 base 的对数 @@ -154,7 +154,7 @@ SELECT FLOOR(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### POW ```sql - SELECT POW(field_name, power) FROM { tb_name | stb_name } [WHERE clause] +SELECT POW(field_name, power) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列的指数为 power 的幂 @@ -172,7 +172,7 @@ SELECT FLOOR(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### ROUND -``` +```sql SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -183,7 +183,7 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### SIN ```sql - SELECT SIN(field_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT SIN(field_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列的正弦结果 @@ -201,7 +201,7 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### SQRT ```sql - SELECT SQRT(field_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT SQRT(field_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列的平方根 @@ -219,7 +219,7 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### TAN ```sql - SELECT TAN(field_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT TAN(field_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:获得指定列的正切结果 @@ -240,8 +240,8 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### CHAR_LENGTH -``` - SELECT CHAR_LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] +```sql +SELECT CHAR_LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:以字符计数的字符串长度。 @@ -257,7 +257,7 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### CONCAT ```sql - SELECT CONCAT(str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHERE clause] +SELECT CONCAT(str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:字符串连接函数。 @@ -273,8 +273,8 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### CONCAT_WS -``` - SELECT CONCAT_WS(separator, str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHERE clause] +```sql +SELECT CONCAT_WS(separator, str1|column1, str2|column2, ...) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:带分隔符的字符串连接函数。 @@ -290,8 +290,8 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### LENGTH -``` - SELECT LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] +```sql +SELECT LENGTH(str|column) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:以字节计数的字符串长度。 @@ -307,8 +307,8 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### LOWER -``` - SELECT LOWER(str|column) FROM { tb_name | stb_name } [WHERE clause] +```sql +SELECT LOWER(str|column) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:将字符串参数值转换为全小写字母。 @@ -324,8 +324,8 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### LTRIM -``` - SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] +```sql +SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:返回清除左边空格后的字符串。 @@ -341,8 +341,8 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### RTRIM -``` - SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] +```sql +SELECT LTRIM(str|column) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:返回清除右边空格后的字符串。 @@ -358,8 +358,8 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### SUBSTR -``` - SELECT SUBSTR(str,pos[,len]) FROM { tb_name | stb_name } [WHERE clause] +```sql +SELECT SUBSTR(str,pos[,len]) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:从源字符串 str 中的指定位置 pos 开始取一个长度为 len 的子串并返回。 @@ -375,8 +375,8 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### UPPER -``` - SELECT UPPER(str|column) FROM { tb_name | stb_name } [WHERE clause] +```sql +SELECT UPPER(str|column) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:将字符串参数值转换为全大写字母。 @@ -397,7 +397,7 @@ SELECT ROUND(field_name) FROM { tb_name | stb_name } [WHERE clause]; #### CAST ```sql - SELECT CAST(expression AS type_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT CAST(expression AS type_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:数据类型转换函数,输入参数 expression 支持普通列、常量、标量函数及它们之间的四则运算,只适用于 select 子句中。 @@ -587,7 +587,7 @@ TDengine 支持针对数据的聚合查询。提供如下聚合函数。 ### AVG -``` +```sql SELECT AVG(field_name) FROM tb_name [WHERE clause]; ``` @@ -602,7 +602,7 @@ SELECT AVG(field_name) FROM tb_name [WHERE clause]; ### COUNT -``` +```sql SELECT COUNT([*|field_name]) FROM tb_name [WHERE clause]; ``` @@ -623,7 +623,7 @@ SELECT COUNT([*|field_name]) FROM tb_name [WHERE clause]; ### ELAPSED -```mysql +```sql SELECT ELAPSED(ts_primary_key [, time_unit]) FROM { tb_name | stb_name } [WHERE clause] [INTERVAL(interval [, offset]) [SLIDING sliding]]; ``` @@ -649,7 +649,7 @@ SELECT ELAPSED(ts_primary_key [, time_unit]) FROM { tb_name | stb_name } [WHERE ### LEASTSQUARES -``` +```sql SELECT LEASTSQUARES(field_name, start_val, step_val) FROM tb_name [WHERE clause]; ``` @@ -664,7 +664,7 @@ SELECT LEASTSQUARES(field_name, start_val, step_val) FROM tb_name [WHERE clause] ### MODE -``` +```sql SELECT MODE(field_name) FROM tb_name [WHERE clause]; ``` @@ -679,7 +679,7 @@ SELECT MODE(field_name) FROM tb_name [WHERE clause]; ### SPREAD -``` +```sql SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -694,7 +694,7 @@ SELECT SPREAD(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### STDDEV -``` +```sql SELECT STDDEV(field_name) FROM tb_name [WHERE clause]; ``` @@ -709,7 +709,7 @@ SELECT STDDEV(field_name) FROM tb_name [WHERE clause]; ### SUM -``` +```sql SELECT SUM(field_name) FROM tb_name [WHERE clause]; ``` @@ -724,7 +724,7 @@ SELECT SUM(field_name) FROM tb_name [WHERE clause]; ### HYPERLOGLOG -``` +```sql SELECT HYPERLOGLOG(field_name) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -741,7 +741,7 @@ SELECT HYPERLOGLOG(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### HISTOGRAM -``` +```sql SELECT HISTOGRAM(field_name,bin_type, bin_description, normalized) FROM tb_name [WHERE clause]; ``` @@ -775,7 +775,7 @@ SELECT HISTOGRAM(field_name,bin_type, bin_description, normalized) FROM tb_nam ### APERCENTILE -``` +```sql SELECT APERCENTILE(field_name, P[, algo_type]) FROM { tb_name | stb_name } [WHERE clause] ``` @@ -790,7 +790,7 @@ FROM { tb_name | stb_name } [WHERE clause] ### BOTTOM -``` +```sql SELECT BOTTOM(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -810,7 +810,7 @@ SELECT BOTTOM(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; ### FIRST -``` +```sql SELECT FIRST(field_name) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -830,7 +830,7 @@ SELECT FIRST(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### INTERP -``` +```sql SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] [ RANGE(timestamp1,timestamp2) ] [EVERY(interval)] [FILL ({ VALUE | PREV | NULL | LINEAR | NEXT})]; ``` @@ -854,7 +854,7 @@ SELECT INTERP(field_name) FROM { tb_name | stb_name } [WHERE where_condition] [ ### LAST -``` +```sql SELECT LAST(field_name) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -875,7 +875,7 @@ SELECT LAST(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### LAST_ROW -``` +```sql SELECT LAST_ROW(field_name) FROM { tb_name | stb_name }; ``` @@ -894,7 +894,7 @@ SELECT LAST_ROW(field_name) FROM { tb_name | stb_name }; ### MAX -``` +```sql SELECT MAX(field_name) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -909,7 +909,7 @@ SELECT MAX(field_name) FROM { tb_name | stb_name } [WHERE clause]; ### MIN -``` +```sql SELECT MIN(field_name) FROM {tb_name | stb_name} [WHERE clause]; ``` @@ -924,7 +924,7 @@ SELECT MIN(field_name) FROM {tb_name | stb_name} [WHERE clause]; ### PERCENTILE -``` +```sql SELECT PERCENTILE(field_name, P) FROM { tb_name } [WHERE clause]; ``` @@ -941,7 +941,7 @@ SELECT PERCENTILE(field_name, P) FROM { tb_name } [WHERE clause]; ### TAIL -``` +```sql SELECT TAIL(field_name, k, offset_val) FROM {tb_name | stb_name} [WHERE clause]; ``` @@ -958,7 +958,7 @@ SELECT TAIL(field_name, k, offset_val) FROM {tb_name | stb_name} [WHERE clause]; ### TOP -``` +```sql SELECT TOP(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -978,7 +978,7 @@ SELECT TOP(field_name, K) FROM { tb_name | stb_name } [WHERE clause]; ### UNIQUE -``` +```sql SELECT UNIQUE(field_name) FROM {tb_name | stb_name} [WHERE clause]; ``` @@ -998,7 +998,7 @@ SELECT UNIQUE(field_name) FROM {tb_name | stb_name} [WHERE clause]; ### CSUM ```sql - SELECT CSUM(field_name) FROM { tb_name | stb_name } [WHERE clause] +SELECT CSUM(field_name) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**:累加和(Cumulative sum),输出行与输入行数相同。 @@ -1020,7 +1020,7 @@ SELECT UNIQUE(field_name) FROM {tb_name | stb_name} [WHERE clause]; ### DERIVATIVE -``` +```sql SELECT DERIVATIVE(field_name, time_interval, ignore_negative) FROM tb_name [WHERE clause]; ``` @@ -1037,9 +1037,9 @@ SELECT DERIVATIVE(field_name, time_interval, ignore_negative) FROM tb_name [WHER ### DIFF - ```sql - SELECT {DIFF(field_name, ignore_negative) | DIFF(field_name)} FROM tb_name [WHERE clause]; - ``` +```sql +SELECT {DIFF(field_name, ignore_negative) | DIFF(field_name)} FROM tb_name [WHERE clause]; +``` **功能说明**:统计表中某列的值与前一行对应值的差。 ignore_negative 取值为 0|1 , 可以不填,默认值为 0. 不忽略负值。ignore_negative 为 1 时表示忽略负数。 @@ -1054,7 +1054,7 @@ SELECT DERIVATIVE(field_name, time_interval, ignore_negative) FROM tb_name [WHER ### IRATE -``` +```sql SELECT IRATE(field_name) FROM tb_name WHERE clause; ``` @@ -1069,7 +1069,7 @@ SELECT IRATE(field_name) FROM tb_name WHERE clause; ### MAVG ```sql - SELECT MAVG(field_name, K) FROM { tb_name | stb_name } [WHERE clause] +SELECT MAVG(field_name, K) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**: 计算连续 k 个值的移动平均数(moving average)。如果输入行数小于 k,则无结果输出。参数 k 的合法输入范围是 1≤ k ≤ 1000。 @@ -1091,7 +1091,7 @@ SELECT IRATE(field_name) FROM tb_name WHERE clause; ### SAMPLE ```sql - SELECT SAMPLE(field_name, K) FROM { tb_name | stb_name } [WHERE clause] +SELECT SAMPLE(field_name, K) FROM { tb_name | stb_name } [WHERE clause] ``` **功能说明**: 获取数据的 k 个采样值。参数 k 的合法输入范围是 1≤ k ≤ 1000。 @@ -1111,7 +1111,7 @@ SELECT IRATE(field_name) FROM tb_name WHERE clause; ### STATECOUNT -``` +```sql SELECT STATECOUNT(field_name, oper, val) FROM { tb_name | stb_name } [WHERE clause]; ``` @@ -1166,7 +1166,7 @@ SELECT stateDuration(field_name, oper, val, unit) FROM { tb_name | stb_name } [W ### TWA -``` +```sql SELECT TWA(field_name) FROM tb_name WHERE clause; ``` @@ -1185,7 +1185,7 @@ SELECT TWA(field_name) FROM tb_name WHERE clause; ### DATABASE -``` +```sql SELECT DATABASE(); ``` @@ -1194,7 +1194,7 @@ SELECT DATABASE(); ### CLIENT_VERSION -``` +```sql SELECT CLIENT_VERSION(); ``` @@ -1202,7 +1202,7 @@ SELECT CLIENT_VERSION(); ### SERVER_VERSION -``` +```sql SELECT SERVER_VERSION(); ``` @@ -1210,7 +1210,7 @@ SELECT SERVER_VERSION(); ### SERVER_STATUS -``` +```sql SELECT SERVER_VERSION(); ``` diff --git a/docs/zh/12-taos-sql/13-tmq.md b/docs/zh/12-taos-sql/13-tmq.md new file mode 100644 index 0000000000..4d9c475a38 --- /dev/null +++ b/docs/zh/12-taos-sql/13-tmq.md @@ -0,0 +1,66 @@ +--- +sidebar_label: 消息队列 +title: 消息队列 +--- + +TDengine 3.0.0.0 开始对消息队列做了大幅的优化和增强以简化用户的解决方案。 + +## 创建订阅主题 + +```sql +CREATE TOPIC [IF NOT EXISTS] topic_name AS {subquery | DATABASE db_name | STABLE stb_name }; +``` + +订阅主题包括三种:列订阅、超级表订阅和数据库订阅。 + +**列订阅是**用 subquery 描述,支持过滤和标量函数和 UDF 标量函数,不支持 JOIN、GROUP BY、窗口切分子句、聚合函数和 UDF 聚合函数。列订阅规则如下: + +1. TOPIC 一旦创建则返回结果的字段确定 +2. 被订阅或用于计算的列不可被删除、修改 +3. 列可以新增,但新增的列不出现在订阅结果字段中 +4. 对于 select \*,则订阅展开为创建时所有的列(子表、普通表为数据列,超级表为数据列加标签列) + +**超级表订阅和数据库订阅**规则如下: + +1. 被订阅主体的 schema 变更不受限 +2. 返回消息中 schema 是块级别的,每块的 schema 可能不一样 +3. 列变更后写入的数据若未落盘,将以写入时的 schema 返回 +4. 列变更后写入的数据若未已落盘,将以落盘时的 schema 返回 + +## 删除订阅主题 + +```sql +DROP TOPIC [IF EXISTS] topic_name; +``` + +此时如果该订阅主题上存在 consumer,则此 consumer 会收到一个错误。 + +## 查看订阅主题 + +## SHOW TOPICS + +```sql +SHOW TOPICS; +``` + +显示当前数据库下的所有主题的信息。 + +## 创建消费组 + +消费组的创建只能通过 TDengine 客户端驱动或者连接器所提供的 API 创建。 + +## 删除消费组 + +```sql +DROP CONSUMER GROUP [IF EXISTS] cgroup_name ON topic_name; +``` + +删除主题 topic_name 上的消费组 cgroup_name。 + +## 查看消费组 + +```sql +SHOW CONSUMERS; +``` + +显示当前数据库下所有活跃的消费者的信息。 diff --git a/docs/zh/12-taos-sql/19-limit.md b/docs/zh/12-taos-sql/19-limit.md index 95d1837ac6..ff552fc977 100644 --- a/docs/zh/12-taos-sql/19-limit.md +++ b/docs/zh/12-taos-sql/19-limit.md @@ -9,8 +9,8 @@ title: 命名与边界限制 2. 允许英文字符或下划线开头,不允许以数字开头 3. 不区分大小写 4. 转义后表(列)名规则: - 为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`"。可用让表名与关键词不冲突,同时不受限于上述表名称合法性约束检查。 - 转义后的表(列)名同样受到长度限制要求,且长度计算的时候不计算转义符。使用转义字符以后,不再对转义字符中的内容进行大小写统一。 + 为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`"。可用让表名与关键词不冲突,同时不受限于上述表名称合法性约束检查 + 转义后的表(列)名同样受到长度限制要求,且长度计算的时候不计算转义符。使用转义字符以后,不再对转义字符中的内容进行大小写统一 例如:\`aBc\` 和 \`abc\` 是不同的表(列)名,但是 abc 和 aBc 是相同的表(列)名。 需要注意的是转义字符中的内容必须是可打印字符。 @@ -23,28 +23,30 @@ title: 命名与边界限制 ## 一般限制 -- 数据库名最大长度为 32。 +- 数据库名最大长度为 32 - 表名最大长度为 192,不包括数据库名前缀和分隔符 -- 每行数据最大长度 48KB (注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置)。 +- 每行数据最大长度 48KB (注意:数据行内每个 BINARY/NCHAR 类型的列还会额外占用 2 个字节的存储位置) - 列名最大长度为 64 - 最多允许 4096 列,最少需要 2 列,第一列必须是时间戳。 - 标签名最大长度为 64 -- 最多允许 128 个,至少要有 1 个标签,一个表中标签值的总长度不超过 16KB 。 -- SQL 语句最大长度 1048576 个字符,也可通过客户端配置参数 maxSQLLength 修改,取值范围 65480 ~ 1048576。 -- SELECT 语句的查询结果,最多允许返回 4096 列(语句中的函数调用可能也会占用一些列空间),超限时需要显式指定较少的返回数据列,以避免语句执行报错。 -- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制。 +- 最多允许 128 个,至少要有 1 个标签,一个表中标签值的总长度不超过 16KB +- SQL 语句最大长度 1048576 个字符,也可通过客户端配置参数 maxSQLLength 修改,取值范围 65480 ~ 1048576 +- SELECT 语句的查询结果,最多允许返回 4096 列(语句中的函数调用可能也会占用一些列空间),超限时需要显式指定较少的返回数据列,以避免语句执行报错 +- 库的数目,超级表的数目、表的数目,系统不做限制,仅受系统资源限制 - 数据库的副本数只能设置为 1 或 3 - 用户名的最大长度是 23 个字节 - 用户密码的最大长度是 15 个字节 -- 总数据行数取决于可用资源 +- 总数据行数取决于可用资源 - 单个数据库的虚拟结点数上限为 1024 ## 表(列)名合法性说明 ### TDengine 中的表(列)名命名规则如下: + 只能由字母、数字、下划线构成,数字不能在首位,长度不能超过 192 字节,不区分大小写。这里表名称不包括数据库名的前缀和分隔符。 ### 转义后表(列)名规则: + 为了兼容支持更多形式的表(列)名,TDengine 引入新的转义符 "`",可以避免表名与关键词的冲突,同时不受限于上述表名合法性约束检查,转义符不计入表名的长度。 转义后的表(列)名同样受到长度限制要求,且长度计算的时候不计算转义符。使用转义字符以后,不再对转义字符中的内容进行大小写统一。 diff --git a/docs/zh/12-taos-sql/21-node.md b/docs/zh/12-taos-sql/21-node.md new file mode 100644 index 0000000000..4816daf420 --- /dev/null +++ b/docs/zh/12-taos-sql/21-node.md @@ -0,0 +1,154 @@ +--- +sidebar_label: 集群管理 +title: 集群管理 +--- + +组成 TDengine 集群的物理实体是 dnode (data node 的缩写),它是一个运行在操作系统之上的进程。在 dnode 中可以建立负责时序数据存储的 vnode (virtual node),在多节点集群环境下当某个数据库的 replica 为 3 时,该数据库中的每个 vgroup 由 3 个 vnode 组成;当数据库的 replica 为 1 时,该数据库中的每个 vgroup 由 1 个 vnode 组成。如果要想配置某个数据库为多副本,则集群中的 dnode 数量至少为 3。在 dnode 还可以创建 mnode (management node),单个集群中最多可以创建三个 mnode。在 TDengine 3.0.0.0 中为了支持存算分离,引入了一种新的逻辑节点 qnode (query node),qnode 和 vnode 既可以共存在一个 dnode 中,也可以完全分离在不同的 dnode 上。 + +## 创建数据节点 + +```sql +CREATE DNODE {dnode_endpoint | dnode_host_name PORT port_val} +``` + +其中 `dnode_endpoint` 是形成 `hostname:port`的格式。也可以分开指定 hostname 和 port。 + +实际操作中推荐先创建 dnode,再启动相应的 dnode 进程,这样该 dnode 就可以立即根据其配置文件中的 firstEP 加入集群。每个 dnode 在加入成功后都会被分配一个 ID。 + +## 查看数据节点 + +```sql +SHOW DNODES; +``` + +可以列出集群中所有的数据节点,所列出的字段有 dnode 的 ID, endpoint, status。 + +## 删除数据节点 + +```sql +DROP DNODE {dnode_id | dnode_endpoint} +``` + +可以用 dnoe_id 或 endpoint 两种方式从集群中删除一个 dnode。注意删除 dnode 不等于停止相应的进程。实际中推荐先将一个 dnode 删除之后再停止其所对应的进程。 + +## 修改数据节点配置 + +```sql +ALTER DNODE dnode_id dnode_option + +ALTER ALL DNODES dnode_option + +dnode_option: { + 'resetLog' + | 'balance' value + | 'monitor' value + | 'debugFlag' value + | 'monDebugFlag' value + | 'vDebugFlag' value + | 'mDebugFlag' value + | 'cDebugFlag' value + | 'httpDebugFlag' value + | 'qDebugflag' value + | 'sdbDebugFlag' value + | 'uDebugFlag' value + | 'tsdbDebugFlag' value + | 'sDebugflag' value + | 'rpcDebugFlag' value + | 'dDebugFlag' value + | 'mqttDebugFlag' value + | 'wDebugFlag' value + | 'tmrDebugFlag' value + | 'cqDebugFlag' value +} +``` + +上面语法中的这些可修改配置项其配置方式与 dnode 配置文件中的配置方式相同,区别是修改是动态的立即生效,且不需要重启 dnode。 + +## 添加管理节点 + +```sql +CREATE MNODE ON DNODE dnode_id +``` + +系统启动默认在 firstEP 节点上创建一个 MNODE,用户可以使用此语句创建更多的 MNODE 来提高系统可用性。一个集群最多存在三个 MNODE,一个 DNODE 上只能创建一个 MNODE。 + +## 查看管理节点 + +```sql +SHOW MNODES; +``` + +列出集群中所有的管理节点,包括其 ID,所在 DNODE 以及状态。 + +## 删除管理节点 + +```sql +DROP MNODE ON DNODE dnode_id; +``` + +删除 dnode_id 所指定的 DNODE 上的 MNODE。 + +## 创建查询节点 + +```sql +CREATE QNODE ON DNODE dnode_id; +``` + +系统启动默认没有 QNODE,用户可以创建 QNODE 来实现计算和存储的分离。一个 DNODE 上只能创建一个 QNODE。一个 DNODE 的 `supportVnodes` 参数如果不为 0,同时又在其上创建上 QNODE,则在该 dnode 中既有负责存储管理的 vnode 又有负责查询计算的 qnode,如果还在该 dnode 上创建了 mnode,则一个 dnode 上最多三种逻辑节点都可以存在。但通过配置也可以使其彻底分离。将一个 dnode 的`supportVnodes`配置为 0,可以选择在其上创建 mnode 或者 qnode 中的一种,这样可以实现三种逻辑节点在物理上的彻底分离。 + +## 查看查询节点 + +```sql +SHOW QNODES; +``` + +列出集群中所有查询节点,包括 ID,及所在 DNODE。 + +## 删除查询节点 + +```sql +DROP QNODE ON DNODE dnode_id; +``` + +删除 ID 为 dnode_id 的 DNODE 上的 QNODE,但并不会影响该 dnode 的状态。 + +## 修改客户端配置 + +如果将客户端也看作广义的集群的一部分,可以通过如下命令动态修改客户端配置参数。 + +```sql +ALTER LOCAL local_option + +local_option: { + 'resetLog' + | 'rpcDebugFlag' value + | 'tmrDebugFlag' value + | 'cDebugFlag' value + | 'uDebugFlag' value + | 'debugFlag' value +} +``` + +上面语法中的参数与在配置文件中配置客户端的用法相同,但不需要重启客户端,修改后立即生效。 + +## 查看客户端配置 + +```sql +SHOW LOCAL VARIABLES; +``` + +## 合并 vgroup + +```sql +MERGE VGROUP vgroup_no1 vgroup_no2; +``` + +如果在系统实际运行一段时间后,因为不同时间线的数据特征不同导致在 vgroups 之间的数据和负载分布不均衡,可以通过合并或拆分 vgroups 的方式逐步实现负载均衡。 + +## 拆分 vgroup + +```sql +SPLIT VGROUP vgroup_no; +``` + +会创建一个新的 vgroup,并将指定 vgroup 中的数据按照一致性 HASH 迁移一部分到新的 vgroup 中。此过程中,原 vgroup 可以正常提供读写服务。 diff --git a/docs/zh/12-taos-sql/22-meta.md b/docs/zh/12-taos-sql/22-meta.md index 885ffbc635..e5bc800de7 100644 --- a/docs/zh/12-taos-sql/22-meta.md +++ b/docs/zh/12-taos-sql/22-meta.md @@ -3,22 +3,15 @@ sidebar_label: 元数据库 title: 元数据库 --- -TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数据库元数据、数据库系统信息和状态的访问,例如数据库或表的名称,当前执行的 SQL 语句等。 +TDengine 内置了一个名为 `INFORMATION_SCHEMA` 的数据库,提供对数据库元数据、数据库系统信息和状态的访问,例如数据库或表的名称,当前执行的 SQL 语句等。该数据库存储有关 TDengine 维护的所有其他数据库的信息。它包含多个只读表。实际上,这些表都是视图,而不是基表,因此没有与它们关联的文件。所以对这些表只能查询,不能进行 INSERT 等写入操作。`INFORMATION_SCHEMA` 数据库旨在以一种更一致的方式来提供对 TDengine 支持的各种 SHOW 语句(如 SHOW TABLES、SHOW DATABASES)所提供的信息的访问。与 SHOW 语句相比,使用 SELECT ... FROM INFORMATION_SCHEMA.tablename 具有以下优点: -`INFORMATION_SCHEMA` 是 TDengine 启动时自动创建的数据库,该数据库存储有关 TDengine 维护的所有其他数据库的信息。它包含多个只读表。实际上,这些表都是视图,而不是基表,因此没有与它们关联的文件。所以对这些表只能查询,不能进行 INSERT 等写入操作。 +1. 可以使用 USE 语句将 INFORMATION_SCHEMA 设为默认数据库 +2. 可以使用 SELECT 语句熟悉的语法,只需要学习一些表名和列名 +3. 可以对查询结果进行筛选、排序等操作。事实上,可以使用任意 TDengine 支持的 SELECT 语句对 INFORMATION_SCHEMA 中的表进行查询 +4. TDengine 在后续演进中可以灵活的添加已有 INFORMATION_SCHEMA 中表的列,而不用担心对既有业务系统造成影响 +5. 与其他数据库系统更具互操作性。例如,Oracle 数据库用户熟悉查询 Oracle 数据字典中的表 -可以使用 USE 语句将 INFORMATION_SCHEMA 设为默认数据库。 - -INFORMATION_SCHEMA 旨在以一种更一致的方式来提供对 TDengine 支持的各种 SHOW 语句(如 SHOW TABLES、SHOW DATABASES)提供的信息的访问。与 SHOW 语句相比,使用 SELECT ... FROM INFORMATION_SCHEMA.tablename 具有以下优点: - -您可以使用 SELECT 语句熟悉的语法,只需要学习一些表名和列名。 - -您可以对查询结果进行筛选、排序等操作,事实上,您可以使用任意 TDengine 支持的 SELECT 语句对 INFORMATION_SCHEMA 中的表进行查询。 -TDengine 在后续演进中可以灵活的添加已有 INFORMATION_SCHEMA 中表的列,而不用担心对既有业务系统造成影响。 - -此技术与其他数据库系统更具互操作性。例如,Oracle 数据库用户熟悉查询 Oracle 数据字典中的表。 - -由于 SHOW 语句已经被开发者熟悉的和广泛使用,所以它们仍然是可用的。 +Note: 由于 SHOW 语句已经被开发者熟悉和广泛使用,所以它们仍然被保留。 本章将详细介绍 `INFORMATION_SCHEMA` 这个内置元数据库中的表和表结构。 @@ -87,8 +80,8 @@ TODO | 9 | buffer | INT | 每个 vnode 写缓存的内存块大小,单位 MB | | 10 | minrows | INT | 文件块中记录的最大条数 | | 11 | maxrows | INT | 文件块中记录的最小条数 | -| 12 | wallevel | INT | WAL 级别 | -| 13 | fsync | INT | 数据落盘周期 | +| 12 | wal_level | INT | WAL 级别 | +| 13 | walfsync_period | INT | 数据落盘周期 | | 14 | comp | INT | 数据压缩方式 | | 15 | precision | BINARY(2) | 时间分辨率 | | 16 | status | BINARY(10) | 数据库状态 | diff --git a/docs/zh/12-taos-sql/25-grant.md b/docs/zh/12-taos-sql/25-grant.md index 05836bb575..0c290350cc 100644 --- a/docs/zh/12-taos-sql/25-grant.md +++ b/docs/zh/12-taos-sql/25-grant.md @@ -23,6 +23,23 @@ password最长为128字节,合法字符包括"a-zA-Z0-9!?$%^&*()_–+={[}]:;@~ DROP USER user_name; ``` +## 修改用户信息 + +```sql +ALTER USER user_name alter_user_clause + +alter_user_clause: { + PASS 'literal' + | ENABLE value + | SYSINFO value +} +``` + +- PASS:修改用户密码。 +- ENABLE:修改用户是否启用。1表示启用此用户,0表示禁用此用户。 +- SYSINFO:修改用户是否可查看系统信息。1表示可以查看系统信息,0表示不可以查看系统信息。 + + ## 授权 ```sql diff --git a/docs/zh/12-taos-sql/26-udf.md b/docs/zh/12-taos-sql/26-udf.md new file mode 100644 index 0000000000..7b5acbfcad --- /dev/null +++ b/docs/zh/12-taos-sql/26-udf.md @@ -0,0 +1,28 @@ +--- +sidebar_label: 自定义函数 +title: 用户自定义函数 +--- + +除了 TDengine 的内置函数以外,用户还可以编写自己的函数逻辑并加入TDengine系统中。 + +## 创建函数 + +```sql +CREATE [AGGREGATE] FUNCTION func_name AS library_path OUTPUTTYPE type_name [BUFSIZE value] +``` + +语法说明: + +AGGREGATE:标识此函数是标量函数还是聚集函数。 +func_name:函数名,必须与函数实现中udfNormalFunc的实际名称一致。 +library_path:包含UDF函数实现的动态链接库的绝对路径,是在客户端侧主机上的绝对路径。 +OUTPUTTYPE:标识此函数的返回类型。 +BUFSIZE:中间结果的缓冲区大小,单位是字节。不设置则默认为0。最大不可超过512字节。 + +关于如何开发自定义函数,请参考 [UDF使用说明](../develop/udf)。 + +## 删除自定义函数 + +```sql +DROP FUNCTION func_name +``` \ No newline at end of file diff --git a/docs/zh/12-taos-sql/27-index.md b/docs/zh/12-taos-sql/27-index.md new file mode 100644 index 0000000000..2c0907723e --- /dev/null +++ b/docs/zh/12-taos-sql/27-index.md @@ -0,0 +1,47 @@ +--- +sidebar_label: 索引 +title: 使用索引 +--- + +TDengine 从 3.0.0.0 版本开始引入了索引功能,支持 SMA 索引和 FULLTEXT 索引。 + +## 创建索引 + +```sql +CREATE FULLTEXT INDEX index_name ON tb_name (col_name [, col_name] ...) + +CREATE SMA INDEX index_name ON tb_name index_option + +index_option: + FUNCTION(functions) INTERVAL(interval_val [, interval_offset]) [SLIDING(sliding_val)] [WATERMARK(watermark_val)] [MAX_DELAY(max_delay_val)] + +functions: + function [, function] ... +``` + +### SMA 索引 + +对指定列按 INTERVAL 子句定义的时间窗口创建进行预聚合计算,预聚合计算类型由 functions_string 指定。SMA 索引能提升指定时间段的聚合查询的性能。目前,限制一个超级表只能创建一个 SMA INDEX。 + +- 支持的函数包括 MAX、MIN 和 SUM。 +- WATERMARK: 最小单位毫秒,取值范围 [0ms, 900000ms],默认值为 5 秒,只可用于超级表。 +- MAX_DELAY: 最小单位毫秒,取值范围 [1ms, 900000ms],默认值为 interval 的值(但不能超过最大值),只可用于超级表。注:不建议 MAX_DELAY 设置太小,否则会过于频繁的推送结果,影响存储和查询性能,如无特殊需求,取默认值即可。 + +### FULLTEXT 索引 + +对指定列建立文本索引,可以提升含有文本过滤的查询的性能。FULLTEXT 索引不支持 index_option 语法。现阶段只支持对 JSON 类型的标签列创建 FULLTEXT 索引。不支持多列联合索引,但可以为每个列分布创建 FULLTEXT 索引。 + +## 删除索引 + +```sql +DROP INDEX index_name; +``` + +## 查看索引 + +````sql +```sql +SHOW INDEXES FROM tbl_name [FROM db_name]; +```` + +显示在所指定的数据库或表上已创建的索引。 diff --git a/docs/zh/12-taos-sql/28-recovery.md b/docs/zh/12-taos-sql/28-recovery.md new file mode 100644 index 0000000000..72b220b8ff --- /dev/null +++ b/docs/zh/12-taos-sql/28-recovery.md @@ -0,0 +1,38 @@ +--- +sidebar_label: 异常恢复 +title: 异常恢复 +--- + +在一个复杂的应用场景中,连接和查询任务等有可能进入一种错误状态或者耗时过长迟迟无法结束,此时需要有能够终止这些连接或任务的方法。 + +## 终止连接 + +```sql +KILL CONNECTION conn_id; +``` + +conn_id 可以通过 `SHOW CONNECTIONS` 获取。 + +## 终止查询 + +```sql +SHOW QUERY query_id; +``` + +query_id 可以通过 `SHOW QUERIES` 获取。 + +## 终止事务 + +```sql +KILL TRANSACTION trans_id +``` + +trans_id 可以通过 `SHOW TRANSACTIONS` 获取。 + +## 重置客户端缓存 + +```sql +RESET QUERY CACHE; +``` + +如果在多客户端情况下出现元数据不同步的情况,可以用这条命令强制清空客户端缓存,随后客户端会从服务端拉取最新的元数据。 diff --git a/docs/zh/13-operation/06-admin.md b/docs/zh/13-operation/06-admin.md deleted file mode 100644 index 7934d31eaf..0000000000 --- a/docs/zh/13-operation/06-admin.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: 用户管理 ---- - -系统管理员可以在 CLI 界面里添加、删除用户,也可以修改密码。CLI 里 SQL 语法如下: - -```sql -CREATE USER PASS <'password'>; -``` - -创建用户,并指定用户名和密码,密码需要用单引号引起来,单引号为英文半角 - -```sql -DROP USER ; -``` - -删除用户,限 root 用户使用 - -```sql -ALTER USER PASS <'password'>; -``` - -修改用户密码,为避免被转换为小写,密码需要用单引号引用,单引号为英文半角 - -```sql -ALTER USER PRIVILEGE ; -``` - -修改用户权限为:write 或 read,不需要添加单引号 - -说明:系统内共有 super/write/read 三种权限级别,但目前不允许通过 alter 指令把 super 权限赋予用户。 - -```sql -SHOW USERS; -``` - -显示所有用户 - -:::note -SQL 语法中,< >表示需要用户输入的部分,但请不要输入< >本身。 - -::: diff --git a/docs/zh/13-operation/09-status.md b/docs/zh/13-operation/09-status.md deleted file mode 100644 index e7ae78bace..0000000000 --- a/docs/zh/13-operation/09-status.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: 系统连接、任务查询管理 ---- - -系统管理员可以从 CLI 查询系统的连接、正在进行的查询、流式计算,并且可以关闭连接、停止正在进行的查询和流式计算。 - -## 显示数据库的连接 - -```sql -SHOW CONNECTIONS; -``` - -其结果中的一列显示 ip:port, 为连接的 IP 地址和端口号。 - -## 强制关闭数据库连接 - -```sql -KILL CONNECTION ; -``` - -其中的 connection-id 是 SHOW CONNECTIONS 中显示的第一列的数字。 - -## 显示数据查询 - -```sql -SHOW QUERIES; -``` - -其中第一列显示的以冒号隔开的两个数字为 query-id,为发起该 query 应用连接的 connection-id 和查询次数。 - -## 强制关闭数据查询 - -```sql -KILL QUERY ; -``` - -其中 query-id 是 SHOW QUERIES 中显示的 connection-id:query-no 字串,如“105:2”,拷贝粘贴即可。 - -## 显示连续查询 - -```sql -SHOW STREAMS; -``` - -其中第一列显示的以冒号隔开的两个数字为 stream-id, 为启动该 stream 应用连接的 connection-id 和发起 stream 的次数。 - -## 强制关闭连续查询 - -```sql -KILL STREAM ; -``` - -其中的 stream-id 是 SHOW STREAMS 中显示的 connection-id:stream-no 字串,如 103:2,拷贝粘贴即可。 diff --git a/docs/zh/14-reference/14-taosx.md b/docs/zh/14-reference/14-taosx.md new file mode 100644 index 0000000000..ed3f8d488f --- /dev/null +++ b/docs/zh/14-reference/14-taosx.md @@ -0,0 +1,4 @@ +--- +sidebar_label: taosX +title: 使用 taosX 在集群间复制数据 +--- \ No newline at end of file diff --git a/docs/zh/14-reference/_category_.yml b/docs/zh/14-reference/_category_.yml index ae861a15ff..faca32476c 100644 --- a/docs/zh/14-reference/_category_.yml +++ b/docs/zh/14-reference/_category_.yml @@ -1 +1 @@ -label: 参考指南 \ No newline at end of file +label: 参考手册 \ No newline at end of file diff --git a/docs/zh/14-reference/index.md b/docs/zh/14-reference/index.md index f48ce31fce..e9c0c4fe23 100644 --- a/docs/zh/14-reference/index.md +++ b/docs/zh/14-reference/index.md @@ -1,8 +1,8 @@ --- -title: 参考指南 +title: 参考手册 --- -参考指南是对 TDengine 本身、 TDengine 各语言连接器及自带的工具最详细的介绍。 +参考手册是对 TDengine 本身、 TDengine 各语言连接器及自带的工具最详细的介绍。 ```mdx-code-block import DocCardList from '@theme/DocCardList'; diff --git a/docs/zh/13-operation/01-pkg-install.md b/docs/zh/17-operation/01-pkg-install.md similarity index 100% rename from docs/zh/13-operation/01-pkg-install.md rename to docs/zh/17-operation/01-pkg-install.md diff --git a/docs/zh/13-operation/02-planning.mdx b/docs/zh/17-operation/02-planning.mdx similarity index 58% rename from docs/zh/13-operation/02-planning.mdx rename to docs/zh/17-operation/02-planning.mdx index 954ba7ca00..5cf3295288 100644 --- a/docs/zh/13-operation/02-planning.mdx +++ b/docs/zh/17-operation/02-planning.mdx @@ -5,33 +5,29 @@ title: 容量规划 使用 TDengine 来搭建一个物联网大数据平台,计算资源、存储资源需要根据业务场景进行规划。下面分别讨论系统运行所需要的内存、CPU 以及硬盘空间。 -## 内存需求 +## 服务端内存需求 -每个 Database 可以创建固定数目的 vgroup,默认与 CPU 核数相同,可通过 maxVgroupsPerDb 配置;vgroup 中的每个副本会是一个 vnode;每个 vnode 会占用固定大小的内存(大小与数据库的配置参数 blocks 和 cache 有关);每个 Table 会占用与标签总长度有关的内存;此外,系统会有一些固定的内存开销。因此,每个 DB 需要的系统内存可通过如下公式计算: +每个 Database 可以创建固定数目的 vgroup,默认 2 个 vgroup,在创建数据库时可以通过`vgroups `参数来指定,其副本数由参数`replica `指定。vgroup 中的每个副本会是一个 vnode;所以每个数据库占用的内存由以下几个参数决定: + +- vgroups +- replica +- buffer +- pages +- pagesize +- cachesize + +关于这些参数的详细说明请参考 [数据库管理](../taos-sql/database)。 + +一个数据库所需要的内存大小等于 ``` -Database Memory Size = maxVgroupsPerDb * replica * (blocks * cache + 10MB) + numOfTables * (tagSizePerTable + 0.5KB) +vgroups * replica * (buffer + pages * pagesize + cachesize) ``` -示例:假设 maxVgroupPerDB 是缺省值 64,cache 是缺省大小 16M, blocks 是缺省值 6,并且一个 DB 中有 10 万张表,单副本,标签总长度是 256 字节,则这个 DB 总的内存需求为:64 \* 1 \* (16 \* 6 + 10) + 100000 \* (0.25 + 0.5) / 1000 = 6792M。 +但要注意的是这些内存并不需要由单一服务器提供,而是由整个集群中所有数据节点共同负担,相当于由这些数据节点所在的服务器共同负担。如果集群中有不止一个数据库,则所需内存要累加,并由集群中所有服务器共同负担。更复杂的场景是如果集群中的数据节点并非在最初就一次性全部建立,而是随着使用中系统负载的增加逐步增加服务器并增加数据节点,则新创建的数据库会导致新旧数据节点上的负载并不均衡,此时简单的理论计算并不能直接使用,要结合各数据节点的负载情况。 -在实际的系统运维中,我们通常会更关心 TDengine 服务进程(taosd)会占用的内存量。 -``` -taosd 内存总量 = vnode 内存 + mnode 内存 + 查询内存 -``` - -其中: - -1. “vnode 内存”指的是集群中所有的 Database 存储分摊到当前 taosd 节点上所占用的内存资源。可以按上文“Database Memory Size”计算公式估算每个 DB 的内存占用量进行加总,再按集群中总共的 TDengine 节点数做平均(如果设置为多副本,则还需要乘以对应的副本倍数)。 -2. “mnode 内存”指的是集群中管理节点所占用的资源。如果一个 taosd 节点上分布有 mnode 管理节点,则内存消耗还需要增加“0.2KB \* 集群中数据表总数”。 -3. “查询内存”指的是服务端处理查询请求时所需要占用的内存。单条查询语句至少会占用“0.2KB \* 查询涉及的数据表总数”的内存量。 - -注意:以上内存估算方法,主要讲解了系统的“必须内存需求”,而不是“内存总数上限”。在实际运行的生产环境中,由于操作系统缓存、资源管理调度等方面的原因,内存规划应当在估算结果的基础上保留一定冗余,以维持系统状态和系统性能的稳定性。并且,生产环境通常会配置系统资源的监控工具,以便及时发现硬件资源的紧缺情况。 - -最后,如果内存充裕,可以考虑加大 Blocks 的配置,这样更多数据将保存在内存里,提高写入和查询速度。 - -### 客户端内存需求 +## 客户端内存需求 客户端应用采用 taosc 客户端驱动连接服务端,会有内存需求的开销。 @@ -77,5 +73,3 @@ Raw DataSize = numOfTables * rowSizePerTable * rowsPerTable 根据上面的内存、CPU、存储的预估,就可以知道整个系统需要多少核、多少内存、多少存储空间。如果数据副本数不为 1,总需求量需要再乘以副本数。 因为 TDengine 具有很好的水平扩展能力,根据总量,再根据单个物理机或虚拟机的资源,就可以轻松决定需要购置多少台物理机或虚拟机了。 - -**立即计算 CPU、内存、存储,请参见:[资源估算方法](https://www.taosdata.com/config/config.html)。** diff --git a/docs/zh/13-operation/03-tolerance.md b/docs/zh/17-operation/03-tolerance.md similarity index 54% rename from docs/zh/13-operation/03-tolerance.md rename to docs/zh/17-operation/03-tolerance.md index 2c46681962..e2f40778ff 100644 --- a/docs/zh/13-operation/03-tolerance.md +++ b/docs/zh/17-operation/03-tolerance.md @@ -10,19 +10,21 @@ TDengine 接收到应用的请求数据包时,先将请求的原始数据包 涉及的系统配置参数有两个: -- walLevel:WAL 级别,0:不写 WAL; 1:写 WAL, 但不执行 fsync; 2:写 WAL, 而且执行 fsync。 -- fsync:当 walLevel 设置为 2 时,执行 fsync 的周期。设置为 0,表示每次写入,立即执行 fsync。 +- wal_level:WAL 级别,1:写WAL,但不执行fsync。2:写WAL,而且执行fsync。默认值为 1。 +- wal_fsync_period:当 wal_evel 设置为 2 时,执行 fsync 的周期。设置为 0,表示每次写入,立即执行 fsync。 -如果要 100%的保证数据不丢失,需要将 walLevel 设置为 2,fsync 设置为 0。这时写入速度将会下降。但如果应用侧启动的写数据的线程数达到一定的数量(超过 50),那么写入数据的性能也会很不错,只会比 fsync 设置为 3000 毫秒下降 30%左右。 +如果要 100%的保证数据不丢失,需要将 wal_level 设置为 2,fsync 设置为 0。这时写入速度将会下降。但如果应用侧启动的写数据的线程数达到一定的数量(超过 50),那么写入数据的性能也会很不错,只会比 fsync 设置为 3000 毫秒下降 30%左右。 ## 灾备 -TDengine 的集群通过多个副本的机制,来提供系统的高可用性,实现灾备能力。 +TDengine 的集群通过多个副本的机制,来提供系统的高可用性,同时具备一定的灾备能力。 -TDengine 集群是由 mnode 负责管理的,为保证 mnode 的高可靠,可以配置多个 mnode 副本,副本数由系统配置参数 numOfMnodes 决定,为了支持高可靠,需要设置大于 1。为保证元数据的强一致性,mnode 副本之间通过同步方式进行数据复制,保证了元数据的强一致性。 +TDengine 集群是由 mnode 负责管理的,为保证 mnode 的高可靠,可以配置 三个 mnode 副本。为保证元数据的强一致性,mnode 副本之间通过同步方式进行数据复制,保证了元数据的强一致性。 -TDengine 集群中的时序数据的副本数是与数据库关联的,一个集群里可以有多个数据库,每个数据库可以配置不同的副本数。创建数据库时,通过参数 replica 指定副本数。为了支持高可靠,需要设置副本数大于 1。 +TDengine 集群中的时序数据的副本数是与数据库关联的,一个集群里可以有多个数据库,每个数据库可以配置不同的副本数。创建数据库时,通过参数 replica 指定副本数。为了支持高可靠,需要设置副本数为 3。 TDengine 集群的节点数必须大于等于副本数,否则创建表时将报错。 当 TDengine 集群中的节点部署在不同的物理机上,并设置多个副本数时,就实现了系统的高可靠性,无需再使用其他软件或工具。TDengine 企业版还可以将副本部署在不同机房,从而实现异地容灾。 + +另外一种灾备方式是通过 `taosX` 将一个 TDengine 集群的数据同步复制到物理上位于不同数据中心的另一个 TDengine 集群。其详细使用方法请参考 [taosX 参考手册](../reference/taosX) diff --git a/docs/zh/13-operation/07-import.md b/docs/zh/17-operation/07-import.md similarity index 100% rename from docs/zh/13-operation/07-import.md rename to docs/zh/17-operation/07-import.md diff --git a/docs/zh/13-operation/08-export.md b/docs/zh/17-operation/08-export.md similarity index 100% rename from docs/zh/13-operation/08-export.md rename to docs/zh/17-operation/08-export.md diff --git a/docs/zh/13-operation/10-monitor.md b/docs/zh/17-operation/10-monitor.md similarity index 100% rename from docs/zh/13-operation/10-monitor.md rename to docs/zh/17-operation/10-monitor.md diff --git a/docs/zh/13-operation/17-diagnose.md b/docs/zh/17-operation/17-diagnose.md similarity index 100% rename from docs/zh/13-operation/17-diagnose.md rename to docs/zh/17-operation/17-diagnose.md diff --git a/docs/zh/13-operation/_category_.yml b/docs/zh/17-operation/_category_.yml similarity index 100% rename from docs/zh/13-operation/_category_.yml rename to docs/zh/17-operation/_category_.yml diff --git a/docs/zh/13-operation/index.md b/docs/zh/17-operation/index.md similarity index 100% rename from docs/zh/13-operation/index.md rename to docs/zh/17-operation/index.md diff --git a/examples/c/tmq.c b/examples/c/tmq.c index 1d2b26624b..fd1f146618 100644 --- a/examples/c/tmq.c +++ b/examples/c/tmq.c @@ -29,7 +29,7 @@ static void msg_process(TAOS_RES* msg) { printf("vg: %d\n", tmq_get_vgroup_id(msg)); if (tmq_get_res_type(msg) == TMQ_RES_TABLE_META) { tmq_raw_data raw = {0}; - int32_t code = tmq_get_raw_meta(msg, &raw); + int32_t code = tmq_get_raw(msg, &raw); if (code == 0) { TAOS* pConn = taos_connect("192.168.1.86", "root", "taosdata", NULL, 0); if (pConn == NULL) { @@ -50,7 +50,7 @@ static void msg_process(TAOS_RES* msg) { } taos_free_result(pRes); - int32_t ret = taos_write_raw_meta(pConn, raw); + int32_t ret = tmq_write_raw(pConn, raw); printf("write raw data: %s\n", tmq_err2str(ret)); taos_close(pConn); } diff --git a/examples/c/tmq_taosx.c b/examples/c/tmq_taosx.c index 13f3b18e64..d0def44269 100644 --- a/examples/c/tmq_taosx.c +++ b/examples/c/tmq_taosx.c @@ -49,18 +49,25 @@ static void msg_process(TAOS_RES* msg) { printf("meta result: %s\n", result); } tmq_free_json_meta(result); - - - tmq_raw_data raw = {0}; - tmq_get_raw_meta(msg, &raw); - int32_t ret = taos_write_raw_meta(pConn, raw); - printf("write raw meta: %s\n", tmq_err2str(ret)); } - if(tmq_get_res_type(msg) == TMQ_RES_DATA){ - int32_t ret =taos_write_raw_data(pConn, msg); - printf("write raw data: %s\n", tmq_err2str(ret)); - } + tmq_raw_data raw = {0}; + tmq_get_raw(msg, &raw); + int32_t ret = tmq_write_raw(pConn, raw); + printf("write raw data: %s\n", tmq_err2str(ret)); + +// else{ +// while(1){ +// int numOfRows = 0; +// void *pData = NULL; +// taos_fetch_raw_block(msg, &numOfRows, &pData); +// if(numOfRows == 0) break; +// printf("write data: tbname:%s, numOfRows:%d\n", tmq_get_table_name(msg), numOfRows); +// int ret = taos_write_raw_block(pConn, numOfRows, pData, tmq_get_table_name(msg)); +// printf("write raw data: %s\n", tmq_err2str(ret)); +// } +// } + taos_close(pConn); } @@ -121,7 +128,7 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "insert into ct0 values(now, 1, 2, 'a')"); + pRes = taos_query(pConn, "insert into ct0 values(1626006833600, 1, 2, 'a')"); if (taos_errno(pRes) != 0) { printf("failed to insert into ct0, reason:%s\n", taos_errstr(pRes)); return -1; @@ -142,7 +149,7 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "insert into ct1 values(now, 3, 4, 'b')"); + pRes = taos_query(pConn, "insert into ct1 values(1626006833600, 3, 4, 'b')"); if (taos_errno(pRes) != 0) { printf("failed to insert into ct1, reason:%s\n", taos_errstr(pRes)); return -1; @@ -156,7 +163,7 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "insert into ct3 values(now, 5, 6, 'c') ct1 values(now+1s, 2, 3, 'sds') (now+2s, 4, 5, 'ddd') ct0 values(now+1s, 4, 3, 'hwj') ct1 values(now+5s, 23, 32, 's21ds')"); + pRes = taos_query(pConn, "insert into ct3 values(1626006833600, 5, 6, 'c') ct1 values(1626006833601, 2, 3, 'sds') (1626006833602, 4, 5, 'ddd') ct0 values(1626006833602, 4, 3, 'hwj') ct1 values(now+5s, 23, 32, 's21ds')"); if (taos_errno(pRes) != 0) { printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes)); return -1; @@ -177,7 +184,14 @@ int32_t init_env() { } taos_free_result(pRes); - pRes = taos_query(pConn, "insert into ct3 values(now+7s, 53, 63, 'cffffffffffffffffffffffffffff', 8989898899999) (now+9s, 51, 62, 'c333', 940)"); + pRes = taos_query(pConn, "insert into ct3 values(1626006833605, 53, 63, 'cffffffffffffffffffffffffffff', 8989898899999) (1626006833609, 51, 62, 'c333', 940)"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into ct3 select * from ct1"); if (taos_errno(pRes) != 0) { printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes)); return -1; @@ -198,19 +212,26 @@ int32_t init_env() { } taos_free_result(pRes); -// pRes = taos_query(pConn, "drop table ct3 ct1"); -// if (taos_errno(pRes) != 0) { -// printf("failed to drop child table ct3, reason:%s\n", taos_errstr(pRes)); -// return -1; -// } -// taos_free_result(pRes); -// -// pRes = taos_query(pConn, "drop table st1"); -// if (taos_errno(pRes) != 0) { -// printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes)); -// return -1; -// } -// taos_free_result(pRes); + pRes = taos_query(pConn, "delete from abc1 .ct3 where ts < 1626006833606"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "drop table ct3 ct1"); + if (taos_errno(pRes) != 0) { + printf("failed to drop child table ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "drop table st1"); + if (taos_errno(pRes) != 0) { + printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); pRes = taos_query(pConn, "create table if not exists n1(ts timestamp, c1 int, c2 nchar(4))"); if (taos_errno(pRes) != 0) { @@ -261,12 +282,12 @@ int32_t init_env() { } taos_free_result(pRes); -// pRes = taos_query(pConn, "drop table n1"); -// if (taos_errno(pRes) != 0) { -// printf("failed to drop normal table n1, reason:%s\n", taos_errstr(pRes)); -// return -1; -// } -// taos_free_result(pRes); + pRes = taos_query(pConn, "drop table n1"); + if (taos_errno(pRes) != 0) { + printf("failed to drop normal table n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); pRes = taos_query(pConn, "create table jt(ts timestamp, i int) tags(t json)"); if (taos_errno(pRes) != 0) { @@ -289,21 +310,21 @@ int32_t init_env() { } taos_free_result(pRes); -// pRes = taos_query(pConn, -// "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 " -// "nchar(8), t4 bool)"); -// if (taos_errno(pRes) != 0) { -// printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes)); -// return -1; -// } -// taos_free_result(pRes); -// -// pRes = taos_query(pConn, "drop table st1"); -// if (taos_errno(pRes) != 0) { -// printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes)); -// return -1; -// } -// taos_free_result(pRes); + pRes = taos_query(pConn, + "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 " + "nchar(8), t4 bool)"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "drop table st1"); + if (taos_errno(pRes) != 0) { + printf("failed to drop super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); taos_close(pConn); return 0; diff --git a/include/client/taos.h b/include/client/taos.h index 5f147bb07c..6f3244ea82 100644 --- a/include/client/taos.h +++ b/include/client/taos.h @@ -260,17 +260,20 @@ enum tmq_res_t { }; typedef struct tmq_raw_data{ - void* raw_meta; - uint32_t raw_meta_len; - uint16_t raw_meta_type; + void* raw; + uint32_t raw_len; + uint16_t raw_type; } tmq_raw_data; typedef enum tmq_res_t tmq_res_t; DLL_EXPORT tmq_res_t tmq_get_res_type(TAOS_RES *res); -DLL_EXPORT int32_t tmq_get_raw_meta(TAOS_RES *res, tmq_raw_data *raw_meta); -DLL_EXPORT int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data raw_meta); -DLL_EXPORT int32_t taos_write_raw_data(TAOS *taos, TAOS_RES *res); +DLL_EXPORT int32_t tmq_get_raw(TAOS_RES *res, tmq_raw_data *raw); +DLL_EXPORT int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw); +DLL_EXPORT int taos_write_raw_block(TAOS *taos, int numOfRows, char *pData, const char* tbname); + + +DLL_EXPORT void tmq_free_raw(tmq_raw_data raw); DLL_EXPORT char *tmq_get_json_meta(TAOS_RES *res); // Returning null means error. Returned result need to be freed by tmq_free_json_meta DLL_EXPORT void tmq_free_json_meta(char* jsonMeta); DLL_EXPORT const char *tmq_get_topic_name(TAOS_RES *res); diff --git a/include/common/tcommon.h b/include/common/tcommon.h index e1aadd4486..c5404085bb 100644 --- a/include/common/tcommon.h +++ b/include/common/tcommon.h @@ -40,6 +40,7 @@ enum { || x == TDMT_VND_CREATE_TABLE \ || x == TDMT_VND_ALTER_TABLE \ || x == TDMT_VND_DROP_TABLE \ + || x == TDMT_VND_DELETE \ ) // clang-format on diff --git a/include/common/tmsg.h b/include/common/tmsg.h index 2daa0ae53c..5d6d9178ed 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -3044,11 +3044,41 @@ typedef struct SDeleteRes { int64_t skey; int64_t ekey; int64_t affectedRows; + char tableFName[TSDB_TABLE_NAME_LEN]; + char tsColName[TSDB_COL_NAME_LEN]; } SDeleteRes; int32_t tEncodeDeleteRes(SEncoder* pCoder, const SDeleteRes* pRes); int32_t tDecodeDeleteRes(SDecoder* pCoder, SDeleteRes* pRes); +typedef struct { + int32_t msgType; + int32_t msgLen; + void* msg; +} SBatchMsg; + +typedef struct { + SMsgHead header; + int32_t msgNum; + SBatchMsg msg[]; +} SBatchReq; + +typedef struct { + int32_t reqType; + int32_t msgLen; + int32_t rspCode; + void* msg; +} SBatchRsp; + +static FORCE_INLINE void tFreeSBatchRsp(void *p) { + if (NULL == p) { + return; + } + + SBatchRsp* pRsp = (SBatchRsp*)p; + taosMemoryFree(pRsp->msg); +} + #pragma pack(pop) #ifdef __cplusplus diff --git a/include/common/tmsgdef.h b/include/common/tmsgdef.h index 56e0935ce1..20dc04631e 100644 --- a/include/common/tmsgdef.h +++ b/include/common/tmsgdef.h @@ -136,6 +136,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_MND_DROP_INDEX, "drop-index", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_GET_INDEX, "get-index", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_GET_TABLE_INDEX, "get-table-index", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_MND_BATCH_META, "batch-meta", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_TABLE_CFG, "table-cfg", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_MND_CREATE_TOPIC, "create-topic", SMCreateTopicReq, SMCreateTopicRsp) TD_DEF_MSG_TYPE(TDMT_MND_ALTER_TOPIC, "alter-topic", NULL, NULL) @@ -180,6 +181,7 @@ enum { TD_DEF_MSG_TYPE(TDMT_VND_TABLE_META, "vnode-table-meta", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_TABLES_META, "vnode-tables-meta", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_TABLE_CFG, "vnode-table-cfg", NULL, NULL) + TD_DEF_MSG_TYPE(TDMT_VND_BATCH_META, "vnode-batch-meta", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_CREATE_STB, "vnode-create-stb", SVCreateStbReq, NULL) TD_DEF_MSG_TYPE(TDMT_VND_ALTER_STB, "vnode-alter-stb", NULL, NULL) TD_DEF_MSG_TYPE(TDMT_VND_DROP_STB, "vnode-drop-stb", SVDropStbReq, NULL) diff --git a/include/common/ttokendef.h b/include/common/ttokendef.h index 3d9eabaa9e..401cb3214b 100644 --- a/include/common/ttokendef.h +++ b/include/common/ttokendef.h @@ -84,20 +84,20 @@ #define TK_COMP 66 #define TK_DURATION 67 #define TK_NK_VARIABLE 68 -#define TK_FSYNC 69 -#define TK_MAXROWS 70 -#define TK_MINROWS 71 -#define TK_KEEP 72 -#define TK_PAGES 73 -#define TK_PAGESIZE 74 -#define TK_PRECISION 75 -#define TK_REPLICA 76 -#define TK_STRICT 77 -#define TK_WAL 78 -#define TK_VGROUPS 79 -#define TK_SINGLE_STABLE 80 -#define TK_RETENTIONS 81 -#define TK_SCHEMALESS 82 +#define TK_MAXROWS 69 +#define TK_MINROWS 70 +#define TK_KEEP 71 +#define TK_PAGES 72 +#define TK_PAGESIZE 73 +#define TK_PRECISION 74 +#define TK_REPLICA 75 +#define TK_STRICT 76 +#define TK_VGROUPS 77 +#define TK_SINGLE_STABLE 78 +#define TK_RETENTIONS 79 +#define TK_SCHEMALESS 80 +#define TK_WAL_LEVEL 81 +#define TK_WAL_FSYNC_PERIOD 82 #define TK_WAL_RETENTION_PERIOD 83 #define TK_WAL_RETENTION_SIZE 84 #define TK_WAL_ROLL_PERIOD 85 @@ -188,93 +188,90 @@ #define TK_NK_BOOL 170 #define TK_RATIO 171 #define TK_NK_FLOAT 172 -#define TK_COMPACT 173 -#define TK_VNODES 174 -#define TK_IN 175 -#define TK_OUTPUTTYPE 176 -#define TK_AGGREGATE 177 -#define TK_BUFSIZE 178 -#define TK_STREAM 179 -#define TK_INTO 180 -#define TK_TRIGGER 181 -#define TK_AT_ONCE 182 -#define TK_WINDOW_CLOSE 183 -#define TK_IGNORE 184 -#define TK_EXPIRED 185 -#define TK_KILL 186 -#define TK_CONNECTION 187 -#define TK_TRANSACTION 188 -#define TK_BALANCE 189 -#define TK_VGROUP 190 -#define TK_MERGE 191 -#define TK_REDISTRIBUTE 192 -#define TK_SPLIT 193 -#define TK_SYNCDB 194 -#define TK_DELETE 195 -#define TK_INSERT 196 -#define TK_NULL 197 -#define TK_NK_QUESTION 198 -#define TK_NK_ARROW 199 -#define TK_ROWTS 200 -#define TK_TBNAME 201 -#define TK_QSTART 202 -#define TK_QEND 203 -#define TK_QDURATION 204 -#define TK_WSTART 205 -#define TK_WEND 206 -#define TK_WDURATION 207 -#define TK_CAST 208 -#define TK_NOW 209 -#define TK_TODAY 210 -#define TK_TIMEZONE 211 -#define TK_CLIENT_VERSION 212 -#define TK_SERVER_VERSION 213 -#define TK_SERVER_STATUS 214 -#define TK_CURRENT_USER 215 -#define TK_COUNT 216 -#define TK_LAST_ROW 217 -#define TK_BETWEEN 218 -#define TK_IS 219 -#define TK_NK_LT 220 -#define TK_NK_GT 221 -#define TK_NK_LE 222 -#define TK_NK_GE 223 -#define TK_NK_NE 224 -#define TK_MATCH 225 -#define TK_NMATCH 226 -#define TK_CONTAINS 227 -#define TK_JOIN 228 -#define TK_INNER 229 -#define TK_SELECT 230 -#define TK_DISTINCT 231 -#define TK_WHERE 232 -#define TK_PARTITION 233 -#define TK_BY 234 -#define TK_SESSION 235 -#define TK_STATE_WINDOW 236 -#define TK_SLIDING 237 -#define TK_FILL 238 -#define TK_VALUE 239 -#define TK_NONE 240 -#define TK_PREV 241 -#define TK_LINEAR 242 -#define TK_NEXT 243 -#define TK_HAVING 244 -#define TK_RANGE 245 -#define TK_EVERY 246 -#define TK_ORDER 247 -#define TK_SLIMIT 248 -#define TK_SOFFSET 249 -#define TK_LIMIT 250 -#define TK_OFFSET 251 -#define TK_ASC 252 -#define TK_NULLS 253 -#define TK_ID 254 -#define TK_NK_BITNOT 255 -#define TK_VALUES 256 -#define TK_IMPORT 257 -#define TK_NK_SEMI 258 -#define TK_FILE 259 +#define TK_OUTPUTTYPE 173 +#define TK_AGGREGATE 174 +#define TK_BUFSIZE 175 +#define TK_STREAM 176 +#define TK_INTO 177 +#define TK_TRIGGER 178 +#define TK_AT_ONCE 179 +#define TK_WINDOW_CLOSE 180 +#define TK_IGNORE 181 +#define TK_EXPIRED 182 +#define TK_KILL 183 +#define TK_CONNECTION 184 +#define TK_TRANSACTION 185 +#define TK_BALANCE 186 +#define TK_VGROUP 187 +#define TK_MERGE 188 +#define TK_REDISTRIBUTE 189 +#define TK_SPLIT 190 +#define TK_DELETE 191 +#define TK_INSERT 192 +#define TK_NULL 193 +#define TK_NK_QUESTION 194 +#define TK_NK_ARROW 195 +#define TK_ROWTS 196 +#define TK_TBNAME 197 +#define TK_QSTART 198 +#define TK_QEND 199 +#define TK_QDURATION 200 +#define TK_WSTART 201 +#define TK_WEND 202 +#define TK_WDURATION 203 +#define TK_CAST 204 +#define TK_NOW 205 +#define TK_TODAY 206 +#define TK_TIMEZONE 207 +#define TK_CLIENT_VERSION 208 +#define TK_SERVER_VERSION 209 +#define TK_SERVER_STATUS 210 +#define TK_CURRENT_USER 211 +#define TK_COUNT 212 +#define TK_LAST_ROW 213 +#define TK_BETWEEN 214 +#define TK_IS 215 +#define TK_NK_LT 216 +#define TK_NK_GT 217 +#define TK_NK_LE 218 +#define TK_NK_GE 219 +#define TK_NK_NE 220 +#define TK_MATCH 221 +#define TK_NMATCH 222 +#define TK_CONTAINS 223 +#define TK_IN 224 +#define TK_JOIN 225 +#define TK_INNER 226 +#define TK_SELECT 227 +#define TK_DISTINCT 228 +#define TK_WHERE 229 +#define TK_PARTITION 230 +#define TK_BY 231 +#define TK_SESSION 232 +#define TK_STATE_WINDOW 233 +#define TK_SLIDING 234 +#define TK_FILL 235 +#define TK_VALUE 236 +#define TK_NONE 237 +#define TK_PREV 238 +#define TK_LINEAR 239 +#define TK_NEXT 240 +#define TK_HAVING 241 +#define TK_RANGE 242 +#define TK_EVERY 243 +#define TK_ORDER 244 +#define TK_SLIMIT 245 +#define TK_SOFFSET 246 +#define TK_LIMIT 247 +#define TK_OFFSET 248 +#define TK_ASC 249 +#define TK_NULLS 250 +#define TK_ID 251 +#define TK_NK_BITNOT 252 +#define TK_VALUES 253 +#define TK_IMPORT 254 +#define TK_NK_SEMI 255 +#define TK_FILE 256 #define TK_NK_SPACE 300 #define TK_NK_COMMENT 301 diff --git a/include/libs/executor/dataSinkMgt.h b/include/libs/executor/dataSinkMgt.h index 8d5a8abcb4..47177dc11b 100644 --- a/include/libs/executor/dataSinkMgt.h +++ b/include/libs/executor/dataSinkMgt.h @@ -38,6 +38,8 @@ typedef struct SDeleterRes { int64_t skey; int64_t ekey; int64_t affectedRows; + char tableName[TSDB_TABLE_NAME_LEN]; + char tsColName[TSDB_COL_NAME_LEN]; } SDeleterRes; typedef struct SDeleterParam { diff --git a/include/libs/executor/executor.h b/include/libs/executor/executor.h index 65e20336cc..a7fae403ed 100644 --- a/include/libs/executor/executor.h +++ b/include/libs/executor/executor.h @@ -64,17 +64,7 @@ qTaskInfo_t qCreateStreamExecTaskInfo(void* msg, SReadHandle* readers); * @param SReadHandle * @return */ -qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* numOfCols, - SSchemaWrapper** pSchema); - -/** - * Set the input data block for the stream scan. - * @param tinfo - * @param input - * @param type - * @return - */ -int32_t qSetStreamInput(qTaskInfo_t tinfo, const void* input, int32_t type, bool assignUid); +qTaskInfo_t qCreateQueueExecTaskInfo(void* msg, SReadHandle* readers, int32_t* numOfCols, SSchemaWrapper** pSchema); /** * Set multiple input data blocks for the stream scan. @@ -84,7 +74,7 @@ int32_t qSetStreamInput(qTaskInfo_t tinfo, const void* input, int32_t type, bool * @param type * @return */ -int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type, bool assignUid); +int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type); /** * Update the table id list, add or remove. diff --git a/include/libs/function/functionMgt.h b/include/libs/function/functionMgt.h index f1f60cb8e5..60ad3ba451 100644 --- a/include/libs/function/functionMgt.h +++ b/include/libs/function/functionMgt.h @@ -209,6 +209,7 @@ typedef enum EFuncDataRequired { } EFuncDataRequired; EFuncDataRequired fmFuncDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWindow); +EFuncDataRequired fmFuncDynDataRequired(int32_t funcId, void* pRes, STimeWindow* pTimeWindow); int32_t fmGetFuncExecFuncs(int32_t funcId, SFuncExecFuncs* pFpSet); int32_t fmGetScalarFuncExecFuncs(int32_t funcId, SScalarFuncExecFuncs* pFpSet); diff --git a/include/libs/nodes/plannodes.h b/include/libs/nodes/plannodes.h index ba16acf7b0..644185a244 100644 --- a/include/libs/nodes/plannodes.h +++ b/include/libs/nodes/plannodes.h @@ -151,7 +151,8 @@ typedef struct SVnodeModifyLogicNode { uint64_t tableId; uint64_t stableId; int8_t tableType; // table type - char tableFName[TSDB_TABLE_FNAME_LEN]; + char tableName[TSDB_TABLE_NAME_LEN]; + char tsColName[TSDB_COL_NAME_LEN]; STimeWindow deleteTimeRange; SVgroupsInfo* pVgroupList; SNodeList* pInsertCols; @@ -328,6 +329,7 @@ typedef struct STableScanPhysiNode { int8_t triggerType; int64_t watermark; int8_t igExpired; + bool assignBlockUid; } STableScanPhysiNode; typedef STableScanPhysiNode STableSeqScanPhysiNode; @@ -493,7 +495,7 @@ typedef struct SQueryInserterNode { uint64_t tableId; uint64_t stableId; int8_t tableType; // table type - char tableFName[TSDB_TABLE_FNAME_LEN]; + char tableName[TSDB_TABLE_NAME_LEN]; int32_t vgId; SEpSet epSet; } SQueryInserterNode; @@ -502,7 +504,8 @@ typedef struct SDataDeleterNode { SDataSinkNode sink; uint64_t tableId; int8_t tableType; // table type - char tableFName[TSDB_TABLE_FNAME_LEN]; + char tableFName[TSDB_TABLE_NAME_LEN]; + char tsColName[TSDB_COL_NAME_LEN]; STimeWindow deleteTimeRange; SNode* pAffectedRows; } SDataDeleterNode; diff --git a/include/libs/nodes/querynodes.h b/include/libs/nodes/querynodes.h index 81ed5b5ecd..0600d16d72 100644 --- a/include/libs/nodes/querynodes.h +++ b/include/libs/nodes/querynodes.h @@ -375,6 +375,7 @@ typedef struct SQuery { int8_t precision; SCmdMsgInfo* pCmdMsg; int32_t msgType; + SArray* pTargetTableList; SArray* pTableList; SArray* pDbList; bool showRewrite; diff --git a/include/libs/qcom/query.h b/include/libs/qcom/query.h index cc040594b1..b62f822313 100644 --- a/include/libs/qcom/query.h +++ b/include/libs/qcom/query.h @@ -251,8 +251,8 @@ extern int32_t (*queryProcessMsgRsp[TDMT_MAX])(void* output, char* msg, int32_t (_code) == TSDB_CODE_APP_NOT_READY || (_code) == TSDB_CODE_RPC_BROKEN_LINK) #define NEED_CLIENT_RM_TBLMETA_REQ(_type) \ - ((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_VND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \ - (_type) == TDMT_VND_DROP_STB) + ((_type) == TDMT_VND_CREATE_TABLE || (_type) == TDMT_MND_CREATE_STB || (_type) == TDMT_VND_DROP_TABLE || \ + (_type) == TDMT_MND_DROP_STB) #define NEED_SCHEDULER_REDIRECT_ERROR(_code) \ ((_code) == TSDB_CODE_RPC_REDIRECT || (_code) == TSDB_CODE_NODE_NOT_DEPLOYED || \ diff --git a/include/libs/stream/tstream.h b/include/libs/stream/tstream.h index eb83da1803..ab1c00a694 100644 --- a/include/libs/stream/tstream.h +++ b/include/libs/stream/tstream.h @@ -171,8 +171,8 @@ typedef struct { } STaskDispatcherFixedEp; typedef struct { - // int8_t hashMethod; char stbFullName[TSDB_TABLE_FNAME_LEN]; + int32_t waitingRspCnt; SUseDbRsp dbInfo; } STaskDispatcherShuffle; @@ -270,7 +270,7 @@ typedef struct SStreamTask { int64_t startVer; int64_t checkpointVer; int64_t processedVer; - int32_t numOfVgroups; + // int32_t numOfVgroups; // children info SArray* childEpInfo; // SArray diff --git a/include/util/taoserror.h b/include/util/taoserror.h index bba03718ba..3493cbb3a3 100644 --- a/include/util/taoserror.h +++ b/include/util/taoserror.h @@ -513,7 +513,6 @@ int32_t* taosGetErrno(); #define TSDB_CODE_PAR_ONLY_ONE_JSON_TAG TAOS_DEF_ERROR_CODE(0, 0x2633) #define TSDB_CODE_PAR_INCORRECT_NUM_OF_COL TAOS_DEF_ERROR_CODE(0, 0x2634) #define TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL TAOS_DEF_ERROR_CODE(0, 0x2635) -#define TSDB_CODE_PAR_INVALID_DAYS_VALUE TAOS_DEF_ERROR_CODE(0, 0x2636) #define TSDB_CODE_PAR_OFFSET_LESS_ZERO TAOS_DEF_ERROR_CODE(0, 0x2637) #define TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_BY TAOS_DEF_ERROR_CODE(0, 0x2638) #define TSDB_CODE_PAR_INVALID_TOPIC_QUERY TAOS_DEF_ERROR_CODE(0, 0x2639) diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 779fa68140..b4c0fd380e 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -222,6 +222,7 @@ typedef struct SRequestObj { int32_t code; SArray* dbList; SArray* tableList; + SArray* targetTableList; SQueryExecMetric metric; SRequestSendRecvBody body; bool syncQuery; // todo refactor: async query object diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index eecb22abe5..68f47ba915 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -235,6 +235,7 @@ int32_t parseSql(SRequestObj* pRequest, bool topicQuery, SQuery** pQuery, SStmtC if (TSDB_CODE_SUCCESS == code || NEED_CLIENT_HANDLE_ERROR(code)) { TSWAP(pRequest->dbList, (*pQuery)->pDbList); TSWAP(pRequest->tableList, (*pQuery)->pTableList); + TSWAP(pRequest->targetTableList, (*pQuery)->pTargetTableList); } return code; @@ -851,7 +852,7 @@ void schedulerExecCb(SExecResult* pResult, void* param, int32_t code) { tscDebug("schedulerExecCb request type %s", TMSG_INFO(pRequest->type)); if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type)) { - removeMeta(pTscObj, pRequest->tableList); + removeMeta(pTscObj, pRequest->targetTableList); } // return to client @@ -1094,7 +1095,7 @@ SRequestObj* execQuery(uint64_t connId, const char* sql, int sqlLen, bool valida } while (retryNum++ < REQUEST_TOTAL_EXEC_TIMES); if (NEED_CLIENT_RM_TBLMETA_REQ(pRequest->type)) { - removeMeta(pRequest->pTscObj, pRequest->tableList); + removeMeta(pRequest->pTscObj, pRequest->targetTableList); } return pRequest; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index 416d50d987..b04b4ea2aa 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -687,6 +687,7 @@ void retrieveMetaCallback(SMetaData *pResultMeta, void *param, int32_t code) { TSWAP(pRequest->dbList, (pQuery)->pDbList); TSWAP(pRequest->tableList, (pQuery)->pTableList); + TSWAP(pRequest->targetTableList, (pQuery)->pTargetTableList); destorySqlParseWrapper(pWrapper); diff --git a/source/client/src/clientStmt.c b/source/client/src/clientStmt.c index 70edb32f2d..fa21f82d19 100644 --- a/source/client/src/clientStmt.c +++ b/source/client/src/clientStmt.c @@ -693,6 +693,7 @@ int stmtBindBatch(TAOS_STMT* stmt, TAOS_MULTI_BIND* bind, int32_t colIdx) { TSWAP(pStmt->exec.pRequest->dbList, pStmt->sql.pQuery->pDbList); TSWAP(pStmt->exec.pRequest->tableList, pStmt->sql.pQuery->pTableList); + TSWAP(pStmt->exec.pRequest->targetTableList, pStmt->sql.pQuery->pTargetTableList); // if (STMT_TYPE_QUERY == pStmt->sql.queryRes) { // STMT_ERR_RET(stmtRestoreQueryFields(pStmt)); diff --git a/source/client/src/tmq.c b/source/client/src/tmq.c index 74d5d4270b..88ebb099e5 100644 --- a/source/client/src/tmq.c +++ b/source/client/src/tmq.c @@ -1206,6 +1206,7 @@ int32_t tmqPollCb(void* param, SDataBuf* pMsg, int32_t code) { SDecoder decoder; tDecoderInit(&decoder, POINTER_SHIFT(pMsg->pData, sizeof(SMqRspHead)), pMsg->len - sizeof(SMqRspHead)); tDecodeSMqDataRsp(&decoder, &pRspWrapper->dataRsp); + tDecoderClear(&decoder); memcpy(&pRspWrapper->dataRsp, pMsg->pData, sizeof(SMqRspHead)); } else { ASSERT(rspType == TMQ_MSG_TYPE__POLL_META_RSP); @@ -1859,6 +1860,10 @@ tmq_res_t tmq_get_res_type(TAOS_RES* res) { if (TD_RES_TMQ(res)) { return TMQ_RES_DATA; } else if (TD_RES_TMQ_META(res)) { + SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; + if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DELETE) { + return TMQ_RES_DATA; + } return TMQ_RES_TABLE_META; } else { return TMQ_RES_INVALID; @@ -1913,17 +1918,6 @@ const char* tmq_get_table_name(TAOS_RES* res) { return NULL; } -int32_t tmq_get_raw_meta(TAOS_RES* res, tmq_raw_data *raw) { - if (TD_RES_TMQ_META(res) && raw) { - SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; - raw->raw_meta = pMetaRspObj->metaRsp.metaRsp; - raw->raw_meta_len = pMetaRspObj->metaRsp.metaRspLen; - raw->raw_meta_type = pMetaRspObj->metaRsp.resMsgType; - return TSDB_CODE_SUCCESS; - } - return TSDB_CODE_INVALID_PARA; -} - static char* buildCreateTableJson(SSchemaWrapper* schemaRow, SSchemaWrapper* schemaTag, char* name, int64_t id, int8_t t) { char* string = NULL; @@ -2436,30 +2430,6 @@ _exit: return string; } -char* tmq_get_json_meta(TAOS_RES* res) { - if (!TD_RES_TMQ_META(res)) { - return NULL; - } - - SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; - if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_STB) { - return processCreateStb(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_ALTER_STB) { - return processAlterStb(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_STB) { - return processDropSTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_TABLE) { - return processCreateTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_ALTER_TABLE) { - return processAlterTable(&pMetaRspObj->metaRsp); - } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_TABLE) { - return processDropTable(&pMetaRspObj->metaRsp); - } - return NULL; -} - -void tmq_free_json_meta(char* jsonMeta) { taosMemoryFreeClear(jsonMeta); } - static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { SVCreateStbReq req = {0}; SDecoder coder; @@ -2531,6 +2501,13 @@ static int32_t taosCreateStb(TAOS* taos, void* meta, int32_t metaLen) { pQuery.stableQuery = true; launchQueryImpl(pRequest, &pQuery, true, NULL); + + if(pRequest->code == TSDB_CODE_SUCCESS){ + SCatalog* pCatalog = NULL; + catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog); + catalogRemoveTableMeta(pCatalog, &tableName); + } + code = pRequest->code; taosMemoryFree(pCmdMsg.pMsg); @@ -2572,7 +2549,7 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { pReq.suid = req.suid; STscObj* pTscObj = pRequest->pTscObj; - SName tableName; + SName tableName = {0}; tNameExtractFullName(toName(pTscObj->acctId, pRequest->pDb, req.name, &tableName), pReq.name); SCmdMsgInfo pCmdMsg = {0}; @@ -2593,6 +2570,13 @@ static int32_t taosDropStb(TAOS* taos, void* meta, int32_t metaLen) { pQuery.stableQuery = true; launchQueryImpl(pRequest, &pQuery, true, NULL); + + if(pRequest->code == TSDB_CODE_SUCCESS){ + SCatalog* pCatalog = NULL; + catalogGetHandle(pTscObj->pAppInfo->clusterId, &pCatalog); + catalogRemoveTableMeta(pCatalog, &tableName); + } + code = pRequest->code; taosMemoryFree(pCmdMsg.pMsg); @@ -2659,17 +2643,20 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + + pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); // loop to create table for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { pCreateReq = req.pReqs + iReq; SVgroupInfo pInfo = {0}; - SName pName; + SName pName = {0}; toName(pTscObj->acctId, pRequest->pDb, pCreateReq->name, &pName); code = catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo); if (code != TSDB_CODE_SUCCESS) { goto end; } + taosArrayPush(pRequest->tableList, &pName); SVgroupCreateTableBatch* pTableBatch = taosHashGet(pVgroupHashmap, &pInfo.vgId, sizeof(pInfo.vgId)); if (pTableBatch == NULL) { @@ -2703,8 +2690,11 @@ static int32_t taosCreateTable(TAOS* taos, void* meta, int32_t metaLen) { goto end; } - launchQueryImpl(pRequest, pQuery, false, NULL); - pQuery = NULL; // no need to free in the end + launchQueryImpl(pRequest, pQuery, true, NULL); + if (pRequest->code == TSDB_CODE_SUCCESS){ + removeMeta(pTscObj, pRequest->tableList); + } + code = pRequest->code; end: @@ -2772,19 +2762,21 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { .requestId = pRequest->requestId, .requestObjRefId = pRequest->self, .mgmtEps = getEpSet_s(&pTscObj->pAppInfo->mgmtEp)}; + pRequest->tableList = taosArrayInit(req.nReqs, sizeof(SName)); // loop to create table for (int32_t iReq = 0; iReq < req.nReqs; iReq++) { pDropReq = req.pReqs + iReq; pDropReq->igNotExists = true; SVgroupInfo pInfo = {0}; - SName pName; + SName pName = {0}; toName(pTscObj->acctId, pRequest->pDb, pDropReq->name, &pName); code = catalogGetTableHashVgroup(pCatalog, &conn, &pName, &pInfo); if (code != TSDB_CODE_SUCCESS) { goto end; } + taosArrayPush(pRequest->tableList, &pName); SVgroupDropTableBatch* pTableBatch = taosHashGet(pVgroupHashmap, &pInfo.vgId, sizeof(pInfo.vgId)); if (pTableBatch == NULL) { SVgroupDropTableBatch tBatch = {0}; @@ -2815,8 +2807,10 @@ static int32_t taosDropTable(TAOS* taos, void* meta, int32_t metaLen) { goto end; } - launchQueryImpl(pRequest, pQuery, false, NULL); - pQuery = NULL; // no need to free in the end + launchQueryImpl(pRequest, pQuery, true, NULL); + if (pRequest->code == TSDB_CODE_SUCCESS){ + removeMeta(pTscObj, pRequest->tableList); + } code = pRequest->code; end: @@ -2827,6 +2821,70 @@ end: return code; } +// delete from db.tabl where .. -> delete from tabl where .. +// delete from db .tabl where .. -> delete from tabl where .. +//static void getTbName(char *sql){ +// char *ch = sql; +// +// bool inBackQuote = false; +// int8_t dotIndex = 0; +// while(*ch != '\0'){ +// if(!inBackQuote && *ch == '`'){ +// inBackQuote = true; +// ch++; +// continue; +// } +// +// if(inBackQuote && *ch == '`'){ +// inBackQuote = false; +// ch++; +// +// continue; +// } +// +// if(!inBackQuote && *ch == '.'){ +// dotIndex ++; +// if(dotIndex == 2){ +// memmove(sql, ch + 1, strlen(ch + 1) + 1); +// break; +// } +// } +// ch++; +// } +//} + +static int32_t taosDeleteData(TAOS* taos, void* meta, int32_t metaLen) { + SDeleteRes req = {0}; + SDecoder coder = {0}; + int32_t code = TSDB_CODE_SUCCESS; + + // decode and process req + void* data = POINTER_SHIFT(meta, sizeof(SMsgHead)); + int32_t len = metaLen - sizeof(SMsgHead); + tDecoderInit(&coder, data, len); + if (tDecodeDeleteRes(&coder, &req) < 0) { + code = TSDB_CODE_INVALID_PARA; + goto end; + } + +// getTbName(req.tableFName); + char sql[256] = {0}; + sprintf(sql, "delete from `%s` where `%s` >= %" PRId64" and `%s` <= %" PRId64, req.tableFName, req.tsColName, req.skey, req.tsColName, req.ekey); + printf("delete sql:%s\n", sql); + + TAOS_RES* res = taos_query(taos, sql); + SRequestObj *pRequest = (SRequestObj *)res; + code = pRequest->code; + if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST) { + code = TSDB_CODE_SUCCESS; + } + taos_free_result(res); + +end: + tDecoderClear(&coder); + return code; +} + static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { SVAlterTbReq req = {0}; SDecoder coder = {0}; @@ -2914,15 +2972,21 @@ static int32_t taosAlterTable(TAOS* taos, void* meta, int32_t metaLen) { goto end; } - launchQueryImpl(pRequest, pQuery, false, NULL); - pQuery = NULL; // no need to free in the end + launchQueryImpl(pRequest, pQuery, true, NULL); + pVgData = NULL; pArray = NULL; code = pRequest->code; if (code == TSDB_CODE_VND_TABLE_NOT_EXIST) { - code = 0; + code = TSDB_CODE_SUCCESS; } + if(pRequest->code == TSDB_CODE_SUCCESS){ + SExecResult* pRes = &pRequest->body.resInfo.execRes; + if(pRes->res != NULL){ + code = handleAlterTbExecRes(pRes->res, pCatalog); + } + } end: taosArrayDestroy(pArray); if (pVgData) taosMemoryFreeClear(pVgData->pData); @@ -2933,27 +2997,6 @@ end: return code; } -int32_t taos_write_raw_meta(TAOS *taos, tmq_raw_data raw_meta){ - if (!taos) { - return TSDB_CODE_INVALID_PARA; - } - - if(raw_meta.raw_meta_type == TDMT_VND_CREATE_STB) { - return taosCreateStb(taos, raw_meta.raw_meta, raw_meta.raw_meta_len); - }else if(raw_meta.raw_meta_type == TDMT_VND_ALTER_STB){ - return taosCreateStb(taos, raw_meta.raw_meta, raw_meta.raw_meta_len); - }else if(raw_meta.raw_meta_type == TDMT_VND_DROP_STB){ - return taosDropStb(taos, raw_meta.raw_meta, raw_meta.raw_meta_len); - }else if(raw_meta.raw_meta_type == TDMT_VND_CREATE_TABLE){ - return taosCreateTable(taos, raw_meta.raw_meta, raw_meta.raw_meta_len); - }else if(raw_meta.raw_meta_type == TDMT_VND_ALTER_TABLE){ - return taosAlterTable(taos, raw_meta.raw_meta, raw_meta.raw_meta_len); - }else if(raw_meta.raw_meta_type == TDMT_VND_DROP_TABLE){ - return taosDropTable(taos, raw_meta.raw_meta, raw_meta.raw_meta_len); - } - return TSDB_CODE_INVALID_PARA; -} - typedef struct{ SVgroupInfo vg; void *data; @@ -2964,15 +3007,196 @@ static void destroyVgHash(void* data) { taosMemoryFreeClear(vgData->data); } -int32_t taos_write_raw_data(TAOS *taos, TAOS_RES *msg){ - if (!TD_RES_TMQ(msg)) { - uError("WriteRaw:msg is not tmq : %d", *(int8_t*)msg); - return TSDB_CODE_TMQ_INVALID_MSG; +int taos_write_raw_block(TAOS *taos, int rows, char *pData, const char* tbname){ + int32_t code = TSDB_CODE_SUCCESS; + STableMeta* pTableMeta = NULL; + SQuery *pQuery = NULL; + + SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT); + if(!pRequest){ + uError("WriteRaw:createRequest error request is null"); + code = terrno; + goto end; } + if (!pRequest->pDb) { + uError("WriteRaw:not use db"); + code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; + goto end; + } + + SName pName = {TSDB_TABLE_NAME_T, pRequest->pTscObj->acctId, {0}, {0}}; + strcpy(pName.dbname, pRequest->pDb); + strcpy(pName.tname, tbname); + + struct SCatalog *pCatalog = NULL; + code = catalogGetHandle(pRequest->pTscObj->pAppInfo->clusterId, &pCatalog); + if(code != TSDB_CODE_SUCCESS){ + uError("WriteRaw: get gatlog error"); + goto end; + } + + SRequestConnInfo conn = {0}; + conn.pTrans = pRequest->pTscObj->pAppInfo->pTransporter; + conn.requestId = pRequest->requestId; + conn.requestObjRefId = pRequest->self; + conn.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); + + SVgroupInfo vgData = {0}; + code = catalogGetTableHashVgroup(pCatalog, &conn, &pName, &vgData); + if (code != TSDB_CODE_SUCCESS) { + uError("WriteRaw:catalogGetTableHashVgroup failed. table name: %s", tbname); + goto end; + } + + code = catalogGetTableMeta(pCatalog, &conn, &pName, &pTableMeta); + if (code != TSDB_CODE_SUCCESS) { + uError("WriteRaw:catalogGetTableMeta failed. table name: %s", tbname); + goto end; + } + uint64_t suid = (TSDB_NORMAL_TABLE == pTableMeta->tableType ? 0 : pTableMeta->suid); + uint64_t uid = pTableMeta->uid; + int32_t numOfCols = pTableMeta->tableInfo.numOfColumns; + + uint16_t fLen = 0; + int32_t rowSize = 0; + int16_t nVar = 0; + for (int i = 0; i < numOfCols; i++) { + SSchema *schema = pTableMeta->schema + i; + fLen += TYPE_BYTES[schema->type]; + rowSize += schema->bytes; + if(IS_VAR_DATA_TYPE(schema->type)){ + nVar ++; + } + } + + int32_t extendedRowSize = rowSize + TD_ROW_HEAD_LEN - sizeof(TSKEY) + nVar * sizeof(VarDataOffsetT) + + (int32_t)TD_BITMAP_BYTES(numOfCols - 1); + int32_t schemaLen = 0; + int32_t submitLen = sizeof(SSubmitBlk) + schemaLen + rows * extendedRowSize; + + int32_t totalLen = sizeof(SSubmitReq) + submitLen; + SSubmitReq* subReq = taosMemoryCalloc(1, totalLen); + SSubmitBlk* blk = POINTER_SHIFT(subReq, sizeof(SSubmitReq)); + void* blkSchema = POINTER_SHIFT(blk, sizeof(SSubmitBlk)); + STSRow* rowData = POINTER_SHIFT(blkSchema, schemaLen); + + SRowBuilder rb = {0}; + tdSRowInit(&rb, pTableMeta->sversion); + tdSRowSetTpInfo(&rb, numOfCols, fLen); + int32_t dataLen = 0; + + char* pStart = pData + sizeof(int32_t) + sizeof(uint64_t) + numOfCols * (sizeof(int16_t) + sizeof(int32_t)); + int32_t* colLength = (int32_t*)pStart; + pStart += sizeof(int32_t) * numOfCols; + + SResultColumn *pCol = taosMemoryCalloc(numOfCols, sizeof(SResultColumn)); + + for (int32_t i = 0; i < numOfCols; ++i) { + if (IS_VAR_DATA_TYPE(pTableMeta->schema[i].type)) { + pCol[i].offset = (int32_t*)pStart; + pStart += rows * sizeof(int32_t); + } else { + pCol[i].nullbitmap = pStart; + pStart += BitmapLen(rows); + } + + pCol[i].pData = pStart; + pStart += colLength[i]; + } + + for (int32_t j = 0; j < rows; j++) { + tdSRowResetBuf(&rb, rowData); + int32_t offset = 0; + for (int32_t k = 0; k < numOfCols; k++) { + const SSchema* pColumn = &pTableMeta->schema[k]; + + if (IS_VAR_DATA_TYPE(pColumn->type)) { + if (pCol[k].offset[j] != -1) { + char* data = pCol[k].pData + pCol[k].offset[j]; + tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NORM, data, true, offset, k); + } else { + tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NULL, NULL, false, offset, k); + } + } else { + if (!colDataIsNull_f(pCol[k].nullbitmap, j)) { + char* data = pCol[k].pData + pColumn->bytes * j; + tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NORM, data, true, offset, k); + } else { + tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NULL, NULL, false, offset, k); + } + } + + offset += TYPE_BYTES[pColumn->type]; + } + int32_t rowLen = TD_ROW_LEN(rowData); + rowData = POINTER_SHIFT(rowData, rowLen); + dataLen += rowLen; + } + + taosMemoryFree(pCol); + + blk->uid = htobe64(uid); + blk->suid = htobe64(suid); + blk->padding = htonl(blk->padding); + blk->sversion = htonl(pTableMeta->sversion); + blk->schemaLen = htonl(schemaLen); + blk->numOfRows = htons(rows); + blk->dataLen = htonl(dataLen); + subReq->length = sizeof(SSubmitReq) + sizeof(SSubmitBlk) + schemaLen + dataLen; + subReq->numOfBlocks = 1; + + pQuery = (SQuery*)nodesMakeNode(QUERY_NODE_QUERY); + if (NULL == pQuery) { + uError("create SQuery error"); + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } + pQuery->execMode = QUERY_EXEC_MODE_SCHEDULE; + pQuery->haveResultSet = false; + pQuery->msgType = TDMT_VND_SUBMIT; + pQuery->pRoot = (SNode *)nodesMakeNode(QUERY_NODE_VNODE_MODIF_STMT); + if (NULL == pQuery->pRoot) { + uError("create pQuery->pRoot error"); + code = TSDB_CODE_OUT_OF_MEMORY; + goto end; + } + SVnodeModifOpStmt *nodeStmt = (SVnodeModifOpStmt *)(pQuery->pRoot); + nodeStmt->payloadType = PAYLOAD_TYPE_KV; + nodeStmt->pDataBlocks = taosArrayInit(1, POINTER_BYTES); + + SVgDataBlocks *dst = taosMemoryCalloc(1, sizeof(SVgDataBlocks)); + if (NULL == dst) { + code = TSDB_CODE_TSC_OUT_OF_MEMORY; + goto end; + } + dst->vg = vgData; + dst->numOfTables = subReq->numOfBlocks; + dst->size = subReq->length; + dst->pData = (char*)subReq; + subReq->header.vgId = htonl(dst->vg.vgId); + subReq->version = htonl(1); + subReq->header.contLen = htonl(subReq->length); + subReq->length = htonl(subReq->length); + subReq->numOfBlocks = htonl(subReq->numOfBlocks); + subReq = NULL; // no need free + taosArrayPush(nodeStmt->pDataBlocks, &dst); + + launchQueryImpl(pRequest, pQuery, true, NULL); + code = pRequest->code; + +end: + taosMemoryFreeClear(pTableMeta); + qDestroyQuery(pQuery); + return code; +} + +static int32_t tmqWriteRaw(TAOS *taos, void* data, int32_t dataLen){ int32_t code = TSDB_CODE_SUCCESS; SHashObj *pVgHash = NULL; SQuery *pQuery = NULL; + SMqRspObj rspObj = {0}; + SDecoder decoder = {0}; terrno = TSDB_CODE_SUCCESS; SRequestObj* pRequest = (SRequestObj*)createRequest(*(int64_t*)taos, TSDB_SQL_INSERT); @@ -2981,6 +3205,17 @@ int32_t taos_write_raw_data(TAOS *taos, TAOS_RES *msg){ return terrno; } + rspObj.resIter = -1; + rspObj.resType = RES_TYPE__TMQ; + + tDecoderInit(&decoder, data, dataLen); + code = tDecodeSMqDataRsp(&decoder, &rspObj.rsp); + if (code != 0){ + uError("WriteRaw:decode smqDataRsp error"); + code = TSDB_CODE_INVALID_MSG; + goto end; + } + if (!pRequest->pDb) { uError("WriteRaw:not use db"); code = TSDB_CODE_PAR_DB_NOT_SPECIFIED; @@ -3001,18 +3236,18 @@ int32_t taos_write_raw_data(TAOS *taos, TAOS_RES *msg){ conn.requestId = pRequest->requestId; conn.requestObjRefId = pRequest->self; conn.mgmtEps = getEpSet_s(&pRequest->pTscObj->pAppInfo->mgmtEp); - SMqRspObj *rspObj = ((SMqRspObj*)msg); - printf("raw data block num:%d\n", rspObj->rsp.blockNum); - while (++rspObj->resIter < rspObj->rsp.blockNum) { - SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(rspObj->rsp.blockData, rspObj->resIter); - if (!rspObj->rsp.withSchema) { - uError("WriteRaw:no schema, iter:%d", rspObj->resIter); + + printf("raw data block num:%d\n", rspObj.rsp.blockNum); + while (++rspObj.resIter < rspObj.rsp.blockNum) { + SRetrieveTableRsp* pRetrieve = (SRetrieveTableRsp*)taosArrayGetP(rspObj.rsp.blockData, rspObj.resIter); + if (!rspObj.rsp.withSchema) { + uError("WriteRaw:no schema, iter:%d", rspObj.resIter); goto end; } - SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj->rsp.blockSchema, rspObj->resIter); - setResSchemaInfo(&rspObj->resInfo, pSW->pSchema, pSW->nCols); + SSchemaWrapper* pSW = (SSchemaWrapper*)taosArrayGetP(rspObj.rsp.blockSchema, rspObj.resIter); + setResSchemaInfo(&rspObj.resInfo, pSW->pSchema, pSW->nCols); - code = setQueryResultFromRsp(&rspObj->resInfo, pRetrieve, false, false); + code = setQueryResultFromRsp(&rspObj.resInfo, pRetrieve, false, false); if(code != TSDB_CODE_SUCCESS){ uError("WriteRaw: setQueryResultFromRsp error"); goto end; @@ -3030,13 +3265,13 @@ int32_t taos_write_raw_data(TAOS *taos, TAOS_RES *msg){ } } - int32_t rows = rspObj->resInfo.numOfRows; + int32_t rows = rspObj.resInfo.numOfRows; int32_t extendedRowSize = rowSize + TD_ROW_HEAD_LEN - sizeof(TSKEY) + nVar * sizeof(VarDataOffsetT) + (int32_t)TD_BITMAP_BYTES(pSW->nCols - 1); int32_t schemaLen = 0; int32_t submitLen = sizeof(SSubmitBlk) + schemaLen + rows * extendedRowSize; - const char* tbName = tmq_get_table_name(msg); + const char* tbName = (const char*)taosArrayGetP(rspObj.rsp.blockTbName, rspObj.resIter); if(!tbName){ uError("WriteRaw: tbname is null"); code = TSDB_CODE_TMQ_INVALID_MSG; @@ -3108,13 +3343,13 @@ int32_t taos_write_raw_data(TAOS *taos, TAOS_RES *msg){ for (int32_t j = 0; j < rows; j++) { tdSRowResetBuf(&rb, rowData); - doSetOneRowPtr(&rspObj->resInfo); - rspObj->resInfo.current += 1; + doSetOneRowPtr(&rspObj.resInfo); + rspObj.resInfo.current += 1; int32_t offset = 0; for (int32_t k = 0; k < pSW->nCols; k++) { const SSchema* pColumn = &pSW->pSchema[k]; - char *data = rspObj->resInfo.row[k]; + char *data = rspObj.resInfo.row[k]; if (!data) { tdAppendColValToRow(&rb, pColumn->colId, pColumn->type, TD_VTYPE_NULL, NULL, false, offset, k); } else { @@ -3186,13 +3421,105 @@ int32_t taos_write_raw_data(TAOS *taos, TAOS_RES *msg){ launchQueryImpl(pRequest, pQuery, true, NULL); code = pRequest->code; + end: + tDecoderClear(&decoder); + taos_free_result(&rspObj); qDestroyQuery(pQuery); destroyRequest(pRequest); taosHashCleanup(pVgHash); return code; } +char* tmq_get_json_meta(TAOS_RES* res) { + if (!TD_RES_TMQ_META(res)) { + return NULL; + } + + SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; + if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_STB) { + return processCreateStb(&pMetaRspObj->metaRsp); + } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_ALTER_STB) { + return processAlterStb(&pMetaRspObj->metaRsp); + } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_STB) { + return processDropSTable(&pMetaRspObj->metaRsp); + } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_CREATE_TABLE) { + return processCreateTable(&pMetaRspObj->metaRsp); + } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_ALTER_TABLE) { + return processAlterTable(&pMetaRspObj->metaRsp); + } else if (pMetaRspObj->metaRsp.resMsgType == TDMT_VND_DROP_TABLE) { + return processDropTable(&pMetaRspObj->metaRsp); + } + return NULL; +} + +void tmq_free_json_meta(char* jsonMeta) { taosMemoryFreeClear(jsonMeta); } + +int32_t tmq_get_raw(TAOS_RES* res, tmq_raw_data *raw) { + if (!raw || !res){ + return TSDB_CODE_INVALID_PARA; + } + if (TD_RES_TMQ_META(res)) { + SMqMetaRspObj* pMetaRspObj = (SMqMetaRspObj*)res; + raw->raw = pMetaRspObj->metaRsp.metaRsp; + raw->raw_len = pMetaRspObj->metaRsp.metaRspLen; + raw->raw_type = pMetaRspObj->metaRsp.resMsgType; + } else if(TD_RES_TMQ(res)){ + SMqRspObj *rspObj = ((SMqRspObj*)res); + + int32_t len = 0; + int32_t code = 0; + tEncodeSize(tEncodeSMqDataRsp, &rspObj->rsp, len, code); + if (code < 0) { + return -1; + } + + void *buf = taosMemoryCalloc(1, len); + SEncoder encoder = {0}; + tEncoderInit(&encoder, buf, len); + tEncodeSMqDataRsp(&encoder, &rspObj->rsp); + tEncoderClear(&encoder); + + raw->raw = buf; + raw->raw_len = len; + raw->raw_type = RES_TYPE__TMQ; + } else { + return TSDB_CODE_TMQ_INVALID_MSG; + } + return TSDB_CODE_SUCCESS; +} + +void tmq_free_raw(tmq_raw_data raw) { + if (raw.raw_type == RES_TYPE__TMQ){ + taosMemoryFree(raw.raw); + } +} + +int32_t tmq_write_raw(TAOS *taos, tmq_raw_data raw){ + if (!taos) { + return TSDB_CODE_INVALID_PARA; + } + + if(raw.raw_type == TDMT_VND_CREATE_STB) { + return taosCreateStb(taos, raw.raw, raw.raw_len); + }else if(raw.raw_type == TDMT_VND_ALTER_STB){ + return taosCreateStb(taos, raw.raw, raw.raw_len); + }else if(raw.raw_type == TDMT_VND_DROP_STB){ + return taosDropStb(taos, raw.raw, raw.raw_len); + }else if(raw.raw_type == TDMT_VND_CREATE_TABLE){ + return taosCreateTable(taos, raw.raw, raw.raw_len); + }else if(raw.raw_type == TDMT_VND_ALTER_TABLE){ + return taosAlterTable(taos, raw.raw, raw.raw_len); + }else if(raw.raw_type == TDMT_VND_DROP_TABLE) { + return taosDropTable(taos, raw.raw, raw.raw_len); + }else if(raw.raw_type == TDMT_VND_DELETE){ + return taosDeleteData(taos, raw.raw, raw.raw_len); + }else if(raw.raw_type == RES_TYPE__TMQ){ + return tmqWriteRaw(taos, raw.raw, raw.raw_len); + } + return TSDB_CODE_INVALID_PARA; +} + void tmq_commit_async(tmq_t* tmq, const TAOS_RES* msg, tmq_commit_cb* cb, void* param) { // tmqCommitInner2(tmq, msg, 0, 1, cb, param); diff --git a/source/common/src/systable.c b/source/common/src/systable.c index 589a4a9c81..5d1610b9b6 100644 --- a/source/common/src/systable.c +++ b/source/common/src/systable.c @@ -89,8 +89,8 @@ static const SSysDbTableSchema userDBSchema[] = { {.name = "status", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "retention", .bytes = 60 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, {.name = "single_stable", .bytes = 1, .type = TSDB_DATA_TYPE_BOOL}, - {.name = "cache_model", .bytes = TSDB_CACHE_MODEL_STR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, - {.name = "cache_size", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, + {.name = "cachemodel", .bytes = TSDB_CACHE_MODEL_STR_LEN + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR}, + {.name = "cachesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "wal_level", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT}, {.name = "wal_fsync_period", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, {.name = "wal_retention_period", .bytes = 4, .type = TSDB_DATA_TYPE_INT}, diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 35eb58d039..3163982dec 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -5681,6 +5681,8 @@ int32_t tEncodeDeleteRes(SEncoder *pCoder, const SDeleteRes *pRes) { if (tEncodeI64(pCoder, pRes->ekey) < 0) return -1; if (tEncodeI64v(pCoder, pRes->affectedRows) < 0) return -1; + if (tEncodeCStr(pCoder, pRes->tableFName) < 0) return -1; + if (tEncodeCStr(pCoder, pRes->tsColName) < 0) return -1; return 0; } @@ -5692,12 +5694,14 @@ int32_t tDecodeDeleteRes(SDecoder *pCoder, SDeleteRes *pRes) { if (tDecodeI32v(pCoder, &nUid) < 0) return -1; for (int32_t iUid = 0; iUid < nUid; iUid++) { if (tDecodeU64(pCoder, &uid) < 0) return -1; - taosArrayPush(pRes->uidList, &uid); + if (pRes->uidList) taosArrayPush(pRes->uidList, &uid); } if (tDecodeI64(pCoder, &pRes->skey) < 0) return -1; if (tDecodeI64(pCoder, &pRes->ekey) < 0) return -1; if (tDecodeI64v(pCoder, &pRes->affectedRows) < 0) return -1; + if (tDecodeCStrTo(pCoder, pRes->tableFName) < 0) return -1; + if (tDecodeCStrTo(pCoder, pRes->tsColName) < 0) return -1; return 0; } int32_t tEncodeSMqDataRsp(SEncoder *pEncoder, const SMqDataRsp *pRsp) { diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c index 22a53f07f6..647af20fcf 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmHandle.c @@ -184,6 +184,7 @@ SArray *mmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_MND_ALTER_STB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_STB, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_TABLE_META, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_MND_BATCH_META, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_TABLE_CFG, mmPutMsgToReadQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_CREATE_SMA, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_MND_DROP_SMA, mmPutMsgToWriteQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c index 0c80e69384..eca61dd960 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmHandle.c @@ -343,6 +343,7 @@ SArray *vmGetMsgHandles() { if (dmSetMgmtHandle(pArray, TDMT_VND_UPDATE_TAG_VAL, vmPutMsgToWriteQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TABLE_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TABLE_CFG, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; + if (dmSetMgmtHandle(pArray, TDMT_VND_BATCH_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_VND_TABLES_META, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_CANCEL_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; if (dmSetMgmtHandle(pArray, TDMT_SCH_DROP_TASK, vmPutMsgToFetchQueue, 0) == NULL) goto _OVER; diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c index 5ad13e383a..9d1142801d 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmWorker.c @@ -89,7 +89,7 @@ static void vmProcessStreamQueue(SQueueInfo *pInfo, SRpcMsg *pMsg) { int32_t code = vnodeProcessFetchMsg(pVnode->pImpl, pMsg, pInfo); if (code != 0) { if (terrno != 0) code = terrno; - dGError("vgId:%d, msg:%p failed to stream since %s", pVnode->vgId, pMsg, terrstr()); + dGError("vgId:%d, msg:%p failed to process stream since %s", pVnode->vgId, pMsg, terrstr()); vmSendRsp(pMsg, code); } diff --git a/source/dnode/mnode/impl/CMakeLists.txt b/source/dnode/mnode/impl/CMakeLists.txt index a4bd12a7f7..c740ea1397 100644 --- a/source/dnode/mnode/impl/CMakeLists.txt +++ b/source/dnode/mnode/impl/CMakeLists.txt @@ -1,4 +1,11 @@ aux_source_directory(src MNODE_SRC) +IF (TD_PRIVILEGE) + ADD_DEFINITIONS(-D_PRIVILEGE) +ENDIF () +IF (TD_PRIVILEGE) + LIST(APPEND MNODE_SRC ${TD_ENTERPRISE_DIR}/src/plugins/privilege/src/privilege.c) +ENDIF () + add_library(mnode STATIC ${MNODE_SRC}) target_include_directories( mnode @@ -8,11 +15,8 @@ target_include_directories( target_link_libraries( mnode scheduler sdb wal transport cjson sync monitor executor qworker stream parser ) - IF (TD_GRANT) TARGET_LINK_LIBRARIES(mnode grant) -ENDIF () -IF (TD_GRANT) ADD_DEFINITIONS(-D_GRANT) ENDIF () diff --git a/source/dnode/mnode/impl/inc/mndPrivilege.h b/source/dnode/mnode/impl/inc/mndPrivilege.h index f6002e3be8..dc88b25f51 100644 --- a/source/dnode/mnode/impl/inc/mndPrivilege.h +++ b/source/dnode/mnode/impl/inc/mndPrivilege.h @@ -30,6 +30,7 @@ int32_t mndCheckDbPrivilege(SMnode *pMnode, const char *user, EOperType operType int32_t mndCheckDbPrivilegeByName(SMnode *pMnode, const char *user, EOperType operType, const char *dbname); int32_t mndCheckShowPrivilege(SMnode *pMnode, const char *user, EShowType showType, const char *dbname); int32_t mndCheckAlterUserPrivilege(SUserObj *pOperUser, SUserObj *pUser, SAlterUserReq *pAlter); +int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp); #ifdef __cplusplus } diff --git a/source/dnode/mnode/impl/inc/mndUser.h b/source/dnode/mnode/impl/inc/mndUser.h index 016ec3e6e9..970d1db7db 100644 --- a/source/dnode/mnode/impl/inc/mndUser.h +++ b/source/dnode/mnode/impl/inc/mndUser.h @@ -17,6 +17,7 @@ #define _TD_MND_USER_H_ #include "mndInt.h" +#include "thash.h" #ifdef __cplusplus extern "C" { @@ -28,9 +29,10 @@ SUserObj *mndAcquireUser(SMnode *pMnode, const char *userName); void mndReleaseUser(SMnode *pMnode, SUserObj *pUser); // for trans test -SSdbRaw *mndUserActionEncode(SUserObj *pUser); -int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_t numOfUses, void **ppRsp, - int32_t *pRspLen); +SSdbRaw *mndUserActionEncode(SUserObj *pUser); +SHashObj *mndDupDbHash(SHashObj *pOld); +int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_t numOfUses, void **ppRsp, + int32_t *pRspLen); #ifdef __cplusplus } diff --git a/source/dnode/mnode/impl/src/mndPrivilege.c b/source/dnode/mnode/impl/src/mndPrivilege.c index e4422c480f..151a2a6404 100644 --- a/source/dnode/mnode/impl/src/mndPrivilege.c +++ b/source/dnode/mnode/impl/src/mndPrivilege.c @@ -18,177 +18,20 @@ #include "mndDb.h" #include "mndUser.h" +#ifndef _PRIVILEGE int32_t mndInitPrivilege(SMnode *pMnode) { return 0; } - -void mndCleanupPrivilege(SMnode *pMnode) {} - -int32_t mndCheckOperPrivilege(SMnode *pMnode, const char *user, EOperType operType) { - int32_t code = 0; - SUserObj *pUser = mndAcquireUser(pMnode, user); - - if (pUser == NULL) { - terrno = TSDB_CODE_MND_NO_USER_FROM_CONN; - code = -1; - goto _OVER; - } - - if (pUser->superUser) { - goto _OVER; - } - - if (!pUser->enable) { - terrno = TSDB_CODE_MND_USER_DISABLED; - code = -1; - goto _OVER; - } - - switch (operType) { - case MND_OPER_CONNECT: - case MND_OPER_CREATE_FUNC: - case MND_OPER_DROP_FUNC: - case MND_OPER_SHOW_VARIBALES: - break; - default: - terrno = TSDB_CODE_MND_NO_RIGHTS; - code = -1; - } - -_OVER: - mndReleaseUser(pMnode, pUser); - return code; -} - -int32_t mndCheckAlterUserPrivilege(SUserObj *pOperUser, SUserObj *pUser, SAlterUserReq *pAlter) { - if (pUser->superUser && pAlter->alterType != TSDB_ALTER_USER_PASSWD) { - terrno = TSDB_CODE_MND_NO_RIGHTS; - return -1; - } - - if (pOperUser->superUser) return 0; - - if (!pOperUser->enable) { - terrno = TSDB_CODE_MND_USER_DISABLED; - return -1; - } - - if (pAlter->alterType == TSDB_ALTER_USER_PASSWD) { - if (strcmp(pUser->user, pOperUser->user) == 0) { - if (pOperUser->sysInfo) return 0; - } - } - - terrno = TSDB_CODE_MND_NO_RIGHTS; - return -1; -} - -int32_t mndCheckShowPrivilege(SMnode *pMnode, const char *user, EShowType showType, const char *dbname) { - int32_t code = 0; - SUserObj *pUser = mndAcquireUser(pMnode, user); - - if (pUser == NULL) { - code = -1; - goto _OVER; - } - - if (pUser->superUser) { - goto _OVER; - } - - if (!pUser->enable) { - terrno = TSDB_CODE_MND_USER_DISABLED; - code = -1; - goto _OVER; - } - - if (pUser->sysInfo) { - goto _OVER; - } - - switch (showType) { - case TSDB_MGMT_TABLE_DB: - case TSDB_MGMT_TABLE_STB: - case TSDB_MGMT_TABLE_INDEX: - case TSDB_MGMT_TABLE_STREAMS: - case TSDB_MGMT_TABLE_CONSUMERS: - case TSDB_MGMT_TABLE_TOPICS: - case TSDB_MGMT_TABLE_SUBSCRIPTIONS: - case TSDB_MGMT_TABLE_FUNC: - case TSDB_MGMT_TABLE_QUERIES: - case TSDB_MGMT_TABLE_CONNS: - case TSDB_MGMT_TABLE_APPS: - case TSDB_MGMT_TABLE_TRANS: - code = 0; - break; - default: - terrno = TSDB_CODE_MND_NO_RIGHTS; - code = -1; - goto _OVER; - } - - if (showType == TSDB_MGMT_TABLE_STB || showType == TSDB_MGMT_TABLE_VGROUP || showType == TSDB_MGMT_TABLE_INDEX) { - code = mndCheckDbPrivilegeByName(pMnode, user, MND_OPER_READ_OR_WRITE_DB, dbname); - } - -_OVER: - mndReleaseUser(pMnode, pUser); - return code; -} - -int32_t mndCheckDbPrivilege(SMnode *pMnode, const char *user, EOperType operType, SDbObj *pDb) { - int32_t code = 0; - SUserObj *pUser = mndAcquireUser(pMnode, user); - - if (pUser == NULL) { - code = -1; - goto _OVER; - } - - if (pUser->superUser) goto _OVER; - - if (!pUser->enable) { - terrno = TSDB_CODE_MND_USER_DISABLED; - code = -1; - goto _OVER; - } - - if (operType == MND_OPER_CREATE_DB) { - if (pUser->sysInfo) goto _OVER; - } - - if (operType == MND_OPER_ALTER_DB || operType == MND_OPER_DROP_DB || operType == MND_OPER_COMPACT_DB || - operType == MND_OPER_TRIM_DB) { - if (strcmp(pUser->user, pDb->createUser) == 0 && pUser->sysInfo) goto _OVER; - } - - if (operType == MND_OPER_USE_DB || operType == MND_OPER_READ_OR_WRITE_DB) { - if (strcmp(pUser->user, pDb->createUser) == 0) goto _OVER; - if (taosHashGet(pUser->readDbs, pDb->name, strlen(pDb->name) + 1) != NULL) goto _OVER; - if (taosHashGet(pUser->writeDbs, pDb->name, strlen(pDb->name) + 1) != NULL) goto _OVER; - } - - if (operType == MND_OPER_WRITE_DB) { - if (strcmp(pUser->user, pDb->createUser) == 0) goto _OVER; - if (taosHashGet(pUser->writeDbs, pDb->name, strlen(pDb->name) + 1) != NULL) goto _OVER; - } - - if (operType == MND_OPER_READ_DB) { - if (strcmp(pUser->user, pDb->createUser) == 0) goto _OVER; - if (taosHashGet(pUser->readDbs, pDb->name, strlen(pDb->name) + 1) != NULL) goto _OVER; - } - - terrno = TSDB_CODE_MND_NO_RIGHTS; - code = -1; - -_OVER: - mndReleaseUser(pMnode, pUser); - return code; -} - +void mndCleanupPrivilege(SMnode *pMnode) {} +int32_t mndCheckOperPrivilege(SMnode *pMnode, const char *user, EOperType operType) { return 0; } +int32_t mndCheckAlterUserPrivilege(SUserObj *pOperUser, SUserObj *pUser, SAlterUserReq *pAlter) { return 0; } +int32_t mndCheckShowPrivilege(SMnode *pMnode, const char *user, EShowType showType, const char *dbname) { return 0; } +int32_t mndCheckDbPrivilege(SMnode *pMnode, const char *user, EOperType operType, SDbObj *pDb) { return 0; } int32_t mndCheckDbPrivilegeByName(SMnode *pMnode, const char *user, EOperType operType, const char *dbname) { - SDbObj *pDb = mndAcquireDb(pMnode, dbname); - if (pDb == NULL) return -1; - - int32_t code = mndCheckDbPrivilege(pMnode, user, operType, pDb); - mndReleaseDb(pMnode, pDb); - return code; -} \ No newline at end of file + return 0; +} +int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp) { + memcpy(pRsp->user, pUser->user, TSDB_USER_LEN); + pRsp->superAuth = 1; + pRsp->version = pUser->authVersion; + return 0; +} +#endif \ No newline at end of file diff --git a/source/dnode/mnode/impl/src/mndQuery.c b/source/dnode/mnode/impl/src/mndQuery.c index 5a527b994e..2beeb10335 100644 --- a/source/dnode/mnode/impl/src/mndQuery.c +++ b/source/dnode/mnode/impl/src/mndQuery.c @@ -63,6 +63,106 @@ int32_t mndProcessQueryMsg(SRpcMsg *pMsg) { return code; } +int32_t mndProcessBatchMetaMsg(SRpcMsg *pMsg) { + int32_t code = 0; + int32_t offset = 0; + int32_t rspSize = 0; + SBatchReq *batchReq = (SBatchReq*)pMsg->pCont; + int32_t msgNum = ntohl(batchReq->msgNum); + offset += sizeof(SBatchReq); + SBatchMsg req = {0}; + SBatchRsp rsp = {0}; + SRpcMsg reqMsg = *pMsg; + SRpcMsg rspMsg = {0}; + void* pRsp = NULL; + SMnode *pMnode = pMsg->info.node; + + SArray* batchRsp = taosArrayInit(msgNum, sizeof(SBatchRsp)); + if (NULL == batchRsp) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + + for (int32_t i = 0; i < msgNum; ++i) { + req.msgType = ntohl(*(int32_t*)((char*)pMsg->pCont + offset)); + offset += sizeof(req.msgType); + + req.msgLen = ntohl(*(int32_t*)((char*)pMsg->pCont + offset)); + offset += sizeof(req.msgLen); + + req.msg = (char*)pMsg->pCont + offset; + offset += req.msgLen; + + reqMsg.msgType = req.msgType; + reqMsg.pCont = req.msg; + reqMsg.contLen = req.msgLen; + reqMsg.info.rsp = NULL; + reqMsg.info.rspLen = 0; + + MndMsgFp fp = pMnode->msgFp[TMSG_INDEX(req.msgType)]; + if (fp == NULL) { + mError("msg:%p, failed to get msg handle, app:%p type:%s", pMsg, pMsg->info.ahandle, TMSG_INFO(pMsg->msgType)); + terrno = TSDB_CODE_MSG_NOT_PROCESSED; + return -1; + } + + if ((*fp)(&reqMsg)) { + rsp.rspCode = terrno; + } else { + rsp.rspCode = 0; + } + rsp.reqType = reqMsg.msgType; + rsp.msgLen = reqMsg.info.rspLen; + rsp.msg = reqMsg.info.rsp; + + taosArrayPush(batchRsp, &rsp); + + rspSize += sizeof(rsp) + rsp.msgLen - POINTER_BYTES; + } + + rspSize += sizeof(int32_t); + offset = 0; + + pRsp = rpcMallocCont(rspSize); + if (pRsp == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + + *(int32_t*)((char*)pRsp + offset) = htonl(msgNum); + offset += sizeof(msgNum); + for (int32_t i = 0; i < msgNum; ++i) { + SBatchRsp *p = taosArrayGet(batchRsp, i); + + *(int32_t*)((char*)pRsp + offset) = htonl(p->reqType); + offset += sizeof(p->reqType); + *(int32_t*)((char*)pRsp + offset) = htonl(p->msgLen); + offset += sizeof(p->msgLen); + *(int32_t*)((char*)pRsp + offset) = htonl(p->rspCode); + offset += sizeof(p->rspCode); + memcpy((char*)pRsp + offset, p->msg, p->msgLen); + offset += p->msgLen; + + rpcFreeCont(p->msg); + } + + taosArrayDestroy(batchRsp); + batchRsp = NULL; + +_exit: + + pMsg->info.rsp = pRsp; + pMsg->info.rspLen = rspSize; + + if (code) { + mError("mnd get batch meta failed cause of %s", tstrerror(code)); + } + + taosArrayDestroyEx(batchRsp, tFreeSBatchRsp); + + return code; +} + int32_t mndInitQuery(SMnode *pMnode) { if (qWorkerInit(NODE_TYPE_MNODE, MNODE_HANDLE, NULL, (void **)&pMnode->pQuery, &pMnode->msgCb) != 0) { mError("failed to init qworker in mnode since %s", terrstr()); @@ -76,6 +176,7 @@ int32_t mndInitQuery(SMnode *pMnode) { mndSetMsgHandle(pMnode, TDMT_SCH_MERGE_FETCH, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_DROP_TASK, mndProcessQueryMsg); mndSetMsgHandle(pMnode, TDMT_SCH_QUERY_HEARTBEAT, mndProcessQueryMsg); + mndSetMsgHandle(pMnode, TDMT_MND_BATCH_META, mndProcessBatchMetaMsg); return 0; } diff --git a/source/dnode/mnode/impl/src/mndScheduler.c b/source/dnode/mnode/impl/src/mndScheduler.c index a46938590e..9d7fa537bb 100644 --- a/source/dnode/mnode/impl/src/mndScheduler.c +++ b/source/dnode/mnode/impl/src/mndScheduler.c @@ -114,18 +114,26 @@ int32_t mndAddSinkToTask(SMnode* pMnode, SStreamObj* pStream, SStreamTask* pTask int32_t mndAddDispatcherToInnerTask(SMnode* pMnode, SStreamObj* pStream, SStreamTask* pTask) { pTask->sinkType = TASK_SINK__NONE; + + bool isShuffle = false; + if (pStream->fixedSinkVgId == 0) { - pTask->dispatchType = TASK_DISPATCH__SHUFFLE; - pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH; SDbObj* pDb = mndAcquireDb(pMnode, pStream->targetDb); ASSERT(pDb); - - if (mndExtractDbInfo(pMnode, pDb, &pTask->shuffleDispatcher.dbInfo, NULL) < 0) { - ASSERT(0); - return -1; + if (pDb->cfg.numOfVgroups > 1) { + isShuffle = true; + pTask->dispatchType = TASK_DISPATCH__SHUFFLE; + pTask->dispatchMsgType = TDMT_STREAM_TASK_DISPATCH; + if (mndExtractDbInfo(pMnode, pDb, &pTask->shuffleDispatcher.dbInfo, NULL) < 0) { + ASSERT(0); + return -1; + } } - sdbRelease(pMnode->pSdb, pDb); + sdbRelease(pMnode->pSdb, pDb); + } + + if (isShuffle) { memcpy(pTask->shuffleDispatcher.stbFullName, pStream->targetSTbName, TSDB_TABLE_FNAME_LEN); SArray* pVgs = pTask->shuffleDispatcher.dbInfo.pVgroupInfos; int32_t sz = taosArrayGetSize(pVgs); @@ -383,10 +391,12 @@ int32_t mndScheduleStream(SMnode* pMnode, SStreamObj* pStream) { // exec pInnerTask->execType = TASK_EXEC__PIPE; +#if 0 SDbObj* pSourceDb = mndAcquireDb(pMnode, pStream->sourceDb); ASSERT(pDbObj != NULL); sdbRelease(pSdb, pSourceDb); pInnerTask->numOfVgroups = pSourceDb->cfg.numOfVgroups; +#endif if (tsSchedStreamToSnode) { SSnodeObj* pSnode = mndSchedFetchOneSnode(pMnode); diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 0452659d47..5da119bb30 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -15,8 +15,8 @@ #define _DEFAULT_SOURCE #include "mndUser.h" -#include "mndPrivilege.h" #include "mndDb.h" +#include "mndPrivilege.h" #include "mndShow.h" #include "mndTrans.h" #include "tbase64.h" @@ -408,7 +408,7 @@ static int32_t mndAlterUser(SMnode *pMnode, SUserObj *pOld, SUserObj *pNew, SRpc return 0; } -static SHashObj *mndDupDbHash(SHashObj *pOld) { +SHashObj *mndDupDbHash(SHashObj *pOld) { SHashObj *pNew = taosHashInit(taosHashGetSize(pOld), taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_ENTRY_LOCK); if (pNew == NULL) { @@ -662,38 +662,6 @@ _OVER: return code; } -static int32_t mndSetUserAuthRsp(SMnode *pMnode, SUserObj *pUser, SGetUserAuthRsp *pRsp) { - memcpy(pRsp->user, pUser->user, TSDB_USER_LEN); - pRsp->superAuth = pUser->superUser; - pRsp->version = pUser->authVersion; - taosRLockLatch(&pUser->lock); - pRsp->readDbs = mndDupDbHash(pUser->readDbs); - pRsp->writeDbs = mndDupDbHash(pUser->writeDbs); - taosRUnLockLatch(&pUser->lock); - pRsp->createdDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - if (NULL == pRsp->createdDbs) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return -1; - } - - SSdb *pSdb = pMnode->pSdb; - void *pIter = NULL; - while (1) { - SDbObj *pDb = NULL; - pIter = sdbFetch(pSdb, SDB_DB, pIter, (void **)&pDb); - if (pIter == NULL) break; - - if (strcmp(pDb->createUser, pUser->user) == 0) { - int32_t len = strlen(pDb->name) + 1; - taosHashPut(pRsp->createdDbs, pDb->name, len, pDb->name, len); - } - - sdbRelease(pSdb, pDb); - } - - return 0; -} - static int32_t mndProcessGetUserAuthReq(SRpcMsg *pReq) { SMnode *pMnode = pReq->info.node; int32_t code = -1; diff --git a/source/dnode/vnode/src/inc/vnd.h b/source/dnode/vnode/src/inc/vnd.h index 984b34814d..dd1facb462 100644 --- a/source/dnode/vnode/src/inc/vnd.h +++ b/source/dnode/vnode/src/inc/vnd.h @@ -78,8 +78,9 @@ void vnodeBufPoolReset(SVBufPool* pPool); // vnodeQuery.c int32_t vnodeQueryOpen(SVnode* pVnode); void vnodeQueryClose(SVnode* pVnode); -int32_t vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg); -int vnodeGetTableCfg(SVnode* pVnode, SRpcMsg* pMsg); +int32_t vnodeGetTableMeta(SVnode* pVnode, SRpcMsg* pMsg, bool direct); +int vnodeGetTableCfg(SVnode* pVnode, SRpcMsg* pMsg, bool direct); +int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg); // vnodeCommit.c int32_t vnodeBegin(SVnode* pVnode); diff --git a/source/dnode/vnode/src/sma/smaRollup.c b/source/dnode/vnode/src/sma/smaRollup.c index a6fde1e2d2..4b29b13abd 100644 --- a/source/dnode/vnode/src/sma/smaRollup.c +++ b/source/dnode/vnode/src/sma/smaRollup.c @@ -611,8 +611,8 @@ static int32_t tdRSmaFetchAndSubmitResult(SRSmaInfoItem *pItem, STSchema *pTSche goto _err; } - smaDebug("vgId:%d, process submit req for rsma table %" PRIi64 " level %" PRIi8 " version:%"PRIi64, SMA_VID(pSma), - suid, pItem->level, output->info.version); + smaDebug("vgId:%d, process submit req for rsma table %" PRIi64 " level %" PRIi8 " version:%" PRIi64, + SMA_VID(pSma), suid, pItem->level, output->info.version); taosMemoryFreeClear(pReq); taosArrayClear(pResult); @@ -644,7 +644,7 @@ static int32_t tdExecuteRSmaImpl(SSma *pSma, const void *pMsg, int32_t inputType smaDebug("vgId:%d, execute rsma %" PRIi8 " task for qTaskInfo:%p suid:%" PRIu64, SMA_VID(pSma), level, pItem->taskInfo, suid); - if (qSetStreamInput(pItem->taskInfo, pMsg, inputType, true) < 0) { // INPUT__DATA_SUBMIT + if (qSetMultiStreamInput(pItem->taskInfo, pMsg, 1, inputType) < 0) { // INPUT__DATA_SUBMIT smaError("vgId:%d, rsma % " PRIi8 " qSetStreamInput failed since %s", SMA_VID(pSma), level, tstrerror(terrno)); return TSDB_CODE_FAILED; } @@ -1329,7 +1329,7 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { tdRefRSmaInfo(pSma, pRSmaInfo); SSDataBlock dataBlock = {.info.type = STREAM_GET_ALL}; - qSetStreamInput(pItem->taskInfo, &dataBlock, STREAM_INPUT__DATA_BLOCK, false); + qSetMultiStreamInput(pItem->taskInfo, &dataBlock, 1, STREAM_INPUT__DATA_BLOCK); tdRSmaFetchAndSubmitResult(pItem, pRSmaInfo->pTSchema, pRSmaInfo->suid, pStat, STREAM_INPUT__DATA_BLOCK); tdUnRefRSmaInfo(pSma, pRSmaInfo); @@ -1356,4 +1356,4 @@ static void tdRSmaFetchTrigger(void *param, void *tmrId) { _end: tdReleaseSmaRef(smaMgmt.rsetId, pItem->refId, __func__, __LINE__); -} \ No newline at end of file +} diff --git a/source/dnode/vnode/src/tq/tq.c b/source/dnode/vnode/src/tq/tq.c index 2adfc92ab1..6b0e3944e3 100644 --- a/source/dnode/vnode/src/tq/tq.c +++ b/source/dnode/vnode/src/tq/tq.c @@ -146,8 +146,8 @@ int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, con } } - int32_t len; - int32_t code; + int32_t len = 0; + int32_t code = 0; tEncodeSize(tEncodeSMqDataRsp, pRsp, len, code); if (code < 0) { return -1; @@ -164,9 +164,10 @@ int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, con void* abuf = POINTER_SHIFT(buf, sizeof(SMqRspHead)); - SEncoder encoder; + SEncoder encoder = {0}; tEncoderInit(&encoder, abuf, len); tEncodeSMqDataRsp(&encoder, pRsp); + tEncoderClear(&encoder); SRpcMsg rsp = { .info = pMsg->info, @@ -176,8 +177,8 @@ int32_t tqSendDataRsp(STQ* pTq, const SRpcMsg* pMsg, const SMqPollReq* pReq, con }; tmsgSendRsp(&rsp); - char buf1[80]; - char buf2[80]; + char buf1[80] = {0}; + char buf2[80] = {0}; tFormatOffset(buf1, 80, &pRsp->reqOffset); tFormatOffset(buf2, 80, &pRsp->rspOffset); tqDebug("vgId:%d from consumer:%" PRId64 ", (epoch %d) send rsp, block num: %d, reqOffset:%s, rspOffset:%s", @@ -652,7 +653,7 @@ int32_t tqProcessTaskDeployReq(STQ* pTq, char* msg, int32_t msgLen) { } else { SReadHandle mgHandle = { .vnode = NULL, - .numOfVgroups = pTask->numOfVgroups, + .numOfVgroups = (int32_t)taosArrayGetSize(pTask->childEpInfo), }; pTask->exec.executor = qCreateStreamExecTaskInfo(pTask->exec.qmsg, &mgHandle); } diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 1b162bf488..03985654f8 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -431,6 +431,12 @@ static int32_t tsdbReaderCreate(SVnode* pVnode, SQueryTableDataCond* pCond, STsd pSup->tsColAgg.colId = PRIMARYKEY_TIMESTAMP_COL_ID; + code = tBlockDataInit(&pReader->status.fileBlockData); + if (code != TSDB_CODE_SUCCESS) { + terrno = code; + goto _end; + } + pReader->pResBlock = createResBlock(pCond, pReader->capacity); if (pReader->pResBlock == NULL) { code = terrno; @@ -1200,8 +1206,9 @@ static int32_t buildDataBlockFromBuf(STsdbReader* pReader, STableBlockScanInfo* } static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* pBlockScanInfo, TSDBROW* pRow, - STSRow* pTSRow, SIterInfo* pIter, int64_t key) { + SIterInfo* pIter, int64_t key) { SRowMerger merge = {0}; + STSRow* pTSRow = NULL; SBlockData* pBlockData = &pReader->status.fileBlockData; SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; @@ -1250,6 +1257,8 @@ static int32_t doMergeBufAndFileRows(STsdbReader* pReader, STableBlockScanInfo* tRowMergerClear(&merge); doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + + taosMemoryFree(pTSRow); return TSDB_CODE_SUCCESS; } @@ -1411,8 +1420,6 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI SFileBlockDumpInfo* pDumpInfo = &pReader->status.fBlockDumpInfo; SBlockData* pBlockData = &pReader->status.fileBlockData; - STSRow* pTSRow = NULL; - int64_t key = pBlockData->aTSKEY[pDumpInfo->rowIndex]; TSDBROW* pRow = getValidRow(&pBlockScanInfo->iter, pBlockScanInfo->delSkyline, pReader); TSDBROW* piRow = getValidRow(&pBlockScanInfo->iiter, pBlockScanInfo->delSkyline, pReader); @@ -1422,23 +1429,27 @@ static int32_t buildComposedDataBlockImpl(STsdbReader* pReader, STableBlockScanI } else { // imem + file if (pBlockScanInfo->iiter.hasVal) { - return doMergeBufAndFileRows(pReader, pBlockScanInfo, piRow, pTSRow, &pBlockScanInfo->iiter, key); + return doMergeBufAndFileRows(pReader, pBlockScanInfo, piRow, &pBlockScanInfo->iiter, key); } // mem + file if (pBlockScanInfo->iter.hasVal) { - return doMergeBufAndFileRows(pReader, pBlockScanInfo, pRow, pTSRow, &pBlockScanInfo->iter, key); + return doMergeBufAndFileRows(pReader, pBlockScanInfo, pRow, &pBlockScanInfo->iter, key); } // imem & mem are all empty, only file exist TSDBROW fRow = tsdbRowFromBlockData(pBlockData, pDumpInfo->rowIndex); + STSRow* pTSRow = NULL; SRowMerger merge = {0}; + tRowMergerInit(&merge, &fRow, pReader->pSchema); doMergeRowsInFileBlocks(pBlockData, pBlockScanInfo, pReader, &merge); tRowMergerGetRow(&merge, &pTSRow); doAppendOneRow(pReader->pResBlock, pReader, pTSRow); + taosMemoryFree(pTSRow); + tRowMergerClear(&merge); return TSDB_CODE_SUCCESS; } } @@ -1716,7 +1727,8 @@ static int32_t doBuildDataBlock(STsdbReader* pReader) { TSDBKEY key = getCurrentKeyInBuf(pBlockIter, pReader); if (fileBlockShouldLoad(pReader, pFBlock, pBlock, pScanInfo, key)) { - tBlockDataInit(&pStatus->fileBlockData); + tBlockDataReset(&pStatus->fileBlockData); + tBlockDataClearData(&pStatus->fileBlockData); code = doLoadFileBlockData(pReader, pBlockIter, pScanInfo, &pStatus->fileBlockData); if (code != TSDB_CODE_SUCCESS) { return code; @@ -2160,6 +2172,8 @@ static int32_t checkForNeighborFileBlock(STsdbReader* pReader, STableBlockScanIn setFileBlockActiveInBlockIter(pBlockIter, neighborIndex, step); // 3. load the neighbor block, and set it to be the currently accessed file data block + tBlockDataReset(&pStatus->fileBlockData); + tBlockDataClearData(&pStatus->fileBlockData); int32_t code = doLoadFileBlockData(pReader, pBlockIter, pScanInfo, &pStatus->fileBlockData); if (code != TSDB_CODE_SUCCESS) { return code; @@ -2563,6 +2577,7 @@ void tsdbReaderClose(STsdbReader* pReader) { } } taosMemoryFree(pSupInfo->buildBuf); + tBlockDataClear(&pReader->status.fileBlockData, true); cleanupDataBlockIterator(&pReader->status.blockIter); @@ -2760,13 +2775,9 @@ static SArray* doRetrieveDataBlock(STsdbReader* pReader) { SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(&pStatus->blockIter); STableBlockScanInfo* pBlockScanInfo = taosHashGet(pStatus->pTableMap, &pFBlock->uid, sizeof(pFBlock->uid)); - int32_t code = tBlockDataInit(&pStatus->fileBlockData); - if (code != TSDB_CODE_SUCCESS) { - terrno = code; - return NULL; - } - - code = doLoadFileBlockData(pReader, &pStatus->blockIter, pBlockScanInfo, &pStatus->fileBlockData); + tBlockDataReset(&pStatus->fileBlockData); + tBlockDataClearData(&pStatus->fileBlockData); + int32_t code = doLoadFileBlockData(pReader, &pStatus->blockIter, pBlockScanInfo, &pStatus->fileBlockData); if (code != TSDB_CODE_SUCCESS) { tBlockDataClear(&pStatus->fileBlockData, 1); @@ -2775,7 +2786,6 @@ static SArray* doRetrieveDataBlock(STsdbReader* pReader) { } copyBlockDataToSDataBlock(pReader, pBlockScanInfo); - tBlockDataClear(&pStatus->fileBlockData, 1); return pReader->pResBlock->pDataBlock; } @@ -2872,9 +2882,7 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa while (true) { if (hasNext) { - SFileDataBlockInfo* pFBlock = getCurrentBlockInfo(pBlockIter); - STableBlockScanInfo* pScanInfo = taosHashGet(pStatus->pTableMap, &pFBlock->uid, sizeof(pFBlock->uid)); - SBlock* pBlock = taosArrayGet(pScanInfo->pBlockList, pFBlock->tbBlockIdx); + SBlock* pBlock = getCurrentBlock(pBlockIter); int32_t numOfRows = pBlock->nRow; pTableBlockInfo->totalRows += numOfRows; @@ -2895,7 +2903,6 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa pTableBlockInfo->blockRowsHisto[bucketIndex]++; hasNext = blockIteratorNext(&pStatus->blockIter); - } else { code = initForFirstBlockInFile(pReader, pBlockIter); if ((code != TSDB_CODE_SUCCESS) || (pReader->status.loadFromFile == false)) { diff --git a/source/dnode/vnode/src/tsdb/tsdbUtil.c b/source/dnode/vnode/src/tsdb/tsdbUtil.c index 805e49a705..3e05b75dd0 100644 --- a/source/dnode/vnode/src/tsdb/tsdbUtil.c +++ b/source/dnode/vnode/src/tsdb/tsdbUtil.c @@ -1022,6 +1022,10 @@ void tBlockDataClear(SBlockData *pBlockData, int8_t deepClear) { tFree((uint8_t *)pBlockData->aTSKEY); taosArrayDestroy(pBlockData->aIdx); taosArrayDestroyEx(pBlockData->aColData, deepClear ? tColDataClear : NULL); + pBlockData->aColData = NULL; + pBlockData->aIdx = NULL; + pBlockData->aTSKEY = NULL; + pBlockData->aVersion = NULL; } int32_t tBlockDataSetSchema(SBlockData *pBlockData, STSchema *pTSchema) { diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 1c3e2f0514..71b9d70518 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -21,7 +21,7 @@ int vnodeQueryOpen(SVnode *pVnode) { void vnodeQueryClose(SVnode *pVnode) { qWorkerDestroy((void **)&pVnode->pQuery); } -int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) { +int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { STableInfoReq infoReq = {0}; STableMetaRsp metaRsp = {0}; SMetaReader mer1 = {0}; @@ -99,7 +99,12 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) { goto _exit; } - pRsp = rpcMallocCont(rspLen); + if (direct) { + pRsp = rpcMallocCont(rspLen); + } else { + pRsp = taosMemoryCalloc(1, rspLen); + } + if (pRsp == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; @@ -117,15 +122,19 @@ _exit: qError("get table %s meta failed cause of %s", infoReq.tbName, tstrerror(code)); } - tmsgSendRsp(&rpcMsg); - + if (direct) { + tmsgSendRsp(&rpcMsg); + } else { + *pMsg = rpcMsg; + } + taosMemoryFree(metaRsp.pSchemas); metaReaderClear(&mer2); metaReaderClear(&mer1); return TSDB_CODE_SUCCESS; } -int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg) { +int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { STableCfgReq cfgReq = {0}; STableCfgRsp cfgRsp = {0}; SMetaReader mer1 = {0}; @@ -209,7 +218,12 @@ int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg) { goto _exit; } - pRsp = rpcMallocCont(rspLen); + if (direct) { + pRsp = rpcMallocCont(rspLen); + } else { + pRsp = taosMemoryCalloc(1, rspLen); + } + if (pRsp == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; goto _exit; @@ -227,14 +241,124 @@ _exit: qError("get table %s cfg failed cause of %s", cfgReq.tbName, tstrerror(code)); } - tmsgSendRsp(&rpcMsg); - + if (direct) { + tmsgSendRsp(&rpcMsg); + } else { + *pMsg = rpcMsg; + } + tFreeSTableCfgRsp(&cfgRsp); metaReaderClear(&mer2); metaReaderClear(&mer1); return TSDB_CODE_SUCCESS; } +int32_t vnodeGetBatchMeta(SVnode *pVnode, SRpcMsg *pMsg) { + int32_t code = 0; + int32_t offset = 0; + int32_t rspSize = 0; + SBatchReq *batchReq = (SBatchReq*)pMsg->pCont; + int32_t msgNum = ntohl(batchReq->msgNum); + offset += sizeof(SBatchReq); + SBatchMsg req = {0}; + SBatchRsp rsp = {0}; + SRpcMsg reqMsg = *pMsg; + SRpcMsg rspMsg = {0}; + void* pRsp = NULL; + + SArray* batchRsp = taosArrayInit(msgNum, sizeof(SBatchRsp)); + if (NULL == batchRsp) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + + for (int32_t i = 0; i < msgNum; ++i) { + req.msgType = ntohl(*(int32_t*)((char*)pMsg->pCont + offset)); + offset += sizeof(req.msgType); + + req.msgLen = ntohl(*(int32_t*)((char*)pMsg->pCont + offset)); + offset += sizeof(req.msgLen); + + req.msg = (char*)pMsg->pCont + offset; + offset += req.msgLen; + + reqMsg.msgType = req.msgType; + reqMsg.pCont = req.msg; + reqMsg.contLen = req.msgLen; + + switch (req.msgType) { + case TDMT_VND_TABLE_META: + vnodeGetTableMeta(pVnode, &reqMsg, false); + break; + case TDMT_VND_TABLE_CFG: + vnodeGetTableCfg(pVnode, &reqMsg, false); + break; + default: + qError("invalid req msgType %d", req.msgType); + reqMsg.code = TSDB_CODE_INVALID_MSG; + reqMsg.pCont = NULL; + reqMsg.contLen = 0; + break; + } + + rsp.reqType = reqMsg.msgType; + rsp.msgLen = reqMsg.contLen; + rsp.rspCode = reqMsg.code; + rsp.msg = reqMsg.pCont; + + taosArrayPush(batchRsp, &rsp); + + rspSize += sizeof(rsp) + rsp.msgLen - POINTER_BYTES; + } + + rspSize += sizeof(int32_t); + offset = 0; + + pRsp = rpcMallocCont(rspSize); + if (pRsp == NULL) { + code = TSDB_CODE_OUT_OF_MEMORY; + goto _exit; + } + + *(int32_t*)((char*)pRsp + offset) = htonl(msgNum); + offset += sizeof(msgNum); + for (int32_t i = 0; i < msgNum; ++i) { + SBatchRsp *p = taosArrayGet(batchRsp, i); + + *(int32_t*)((char*)pRsp + offset) = htonl(p->reqType); + offset += sizeof(p->reqType); + *(int32_t*)((char*)pRsp + offset) = htonl(p->msgLen); + offset += sizeof(p->msgLen); + *(int32_t*)((char*)pRsp + offset) = htonl(p->rspCode); + offset += sizeof(p->rspCode); + memcpy((char*)pRsp + offset, p->msg, p->msgLen); + offset += p->msgLen; + + taosMemoryFreeClear(p->msg); + } + + taosArrayDestroy(batchRsp); + batchRsp = NULL; + +_exit: + + rspMsg.info = pMsg->info; + rspMsg.pCont = pRsp; + rspMsg.contLen = rspSize; + rspMsg.code = code; + rspMsg.msgType = pMsg->msgType; + + if (code) { + qError("vnd get batch meta failed cause of %s", tstrerror(code)); + } + + taosArrayDestroyEx(batchRsp, tFreeSBatchRsp); + + tmsgSendRsp(&rspMsg); + + return code; +} + int32_t vnodeGetLoad(SVnode *pVnode, SVnodeLoad *pLoad) { pLoad->vgId = TD_VID(pVnode); pLoad->syncState = syncGetMyRole(pVnode->sync); diff --git a/source/dnode/vnode/src/vnd/vnodeSvr.c b/source/dnode/vnode/src/vnd/vnodeSvr.c index 9d06fbffdd..a83e1ab85b 100644 --- a/source/dnode/vnode/src/vnd/vnodeSvr.c +++ b/source/dnode/vnode/src/vnd/vnodeSvr.c @@ -106,7 +106,9 @@ int32_t vnodePreProcessWriteMsg(SVnode *pVnode, SRpcMsg *pMsg) { .meta = pVnode->pMeta, .config = &pVnode->config, .vnode = pVnode, .pMsgCb = &pVnode->msgCb}; code = qWorkerProcessDeleteMsg(&handle, pVnode->pQuery, pMsg, &res); - if (code) goto _err; + if (code) { + goto _err; + } // malloc and encode tEncodeSize(tEncodeDeleteRes, &res, size, ret); @@ -296,7 +298,7 @@ int32_t vnodeProcessQueryMsg(SVnode *pVnode, SRpcMsg *pMsg) { int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { vTrace("message in fetch queue is processing"); if ((pMsg->msgType == TDMT_SCH_FETCH || pMsg->msgType == TDMT_VND_TABLE_META || - pMsg->msgType == TDMT_VND_TABLE_CFG) && + pMsg->msgType == TDMT_VND_TABLE_CFG || pMsg->msgType == TDMT_VND_BATCH_META) && !vnodeIsLeader(pVnode)) { vnodeRedirectRpcMsg(pVnode, pMsg); return 0; @@ -318,9 +320,11 @@ int32_t vnodeProcessFetchMsg(SVnode *pVnode, SRpcMsg *pMsg, SQueueInfo *pInfo) { case TDMT_SCH_QUERY_HEARTBEAT: return qWorkerProcessHbMsg(pVnode, pVnode->pQuery, pMsg, 0); case TDMT_VND_TABLE_META: - return vnodeGetTableMeta(pVnode, pMsg); + return vnodeGetTableMeta(pVnode, pMsg, true); case TDMT_VND_TABLE_CFG: - return vnodeGetTableCfg(pVnode, pMsg); + return vnodeGetTableCfg(pVnode, pMsg, true); + case TDMT_VND_BATCH_META: + return vnodeGetBatchMeta(pVnode, pMsg); case TDMT_VND_CONSUME: return tqProcessPollReq(pVnode->pTq, pMsg); case TDMT_STREAM_TASK_RUN: @@ -993,6 +997,11 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t version, void *pReq SDecoder *pCoder = &(SDecoder){0}; SDeleteRes *pRes = &(SDeleteRes){0}; + pRsp->msgType = TDMT_VND_DELETE_RSP; + pRsp->pCont = NULL; + pRsp->contLen = 0; + pRsp->code = TSDB_CODE_SUCCESS; + pRes->uidList = taosArrayInit(0, sizeof(tb_uid_t)); if (pRes->uidList == NULL) { code = TSDB_CODE_OUT_OF_MEMORY; @@ -1010,6 +1019,15 @@ static int32_t vnodeProcessDeleteReq(SVnode *pVnode, int64_t version, void *pReq tDecoderClear(pCoder); taosArrayDestroy(pRes->uidList); + + SVDeleteRsp rsp = {.affectedRows = pRes->affectedRows}; + int32_t ret = 0; + tEncodeSize(tEncodeSVDeleteRsp, &rsp, pRsp->contLen, ret); + pRsp->pCont = rpcMallocCont(pRsp->contLen); + SEncoder ec = {0}; + tEncoderInit(&ec, pRsp->pCont, pRsp->contLen); + tEncodeSVDeleteRsp(&ec, &rsp); + tEncoderClear(&ec); return code; _err: diff --git a/source/libs/catalog/inc/catalogInt.h b/source/libs/catalog/inc/catalogInt.h index bf3bc1f0f4..1aaa1ecfd7 100644 --- a/source/libs/catalog/inc/catalogInt.h +++ b/source/libs/catalog/inc/catalogInt.h @@ -31,6 +31,7 @@ extern "C" { #define CTG_DEFAULT_RENT_SECOND 10 #define CTG_DEFAULT_RENT_SLOT_SIZE 10 #define CTG_DEFAULT_MAX_RETRY_TIMES 3 +#define CTG_DEFAULT_BATCH_NUM 64 #define CTG_RENT_SLOT_SECOND 1.5 @@ -38,6 +39,8 @@ extern "C" { #define CTG_ERR_CODE_TABLE_NOT_EXIST TSDB_CODE_PAR_TABLE_NOT_EXIST +#define CTG_BATCH_FETCH 1 + enum { CTG_READ = 1, CTG_WRITE, @@ -200,8 +203,20 @@ typedef struct SCatalog { SCtgRentMgmt stbRent; } SCatalog; +typedef struct SCtgBatch { + int32_t batchId; + int32_t msgType; + int32_t msgSize; + SArray* pMsgs; + SRequestConnInfo conn; + char dbFName[TSDB_DB_FNAME_LEN]; + SArray* pTaskIds; +} SCtgBatch; + typedef struct SCtgJob { int64_t refId; + int32_t batchId; + SHashObj* pBatchs; SArray* pTasks; int32_t taskDone; SMetaData jobRes; @@ -236,6 +251,16 @@ typedef struct SCtgMsgCtx { char* target; } SCtgMsgCtx; + +typedef struct SCtgTaskCallbackParam { + uint64_t queryId; + int64_t refId; + SArray* taskId; + int32_t reqType; + int32_t batchId; +} SCtgTaskCallbackParam; + + typedef struct SCtgTask SCtgTask; typedef int32_t (*ctgSubTaskCbFp)(SCtgTask*); @@ -258,6 +283,7 @@ typedef struct SCtgTask { SRWLatch lock; SArray* pParents; SCtgSubRes subRes; + SHashObj* pBatchs; } SCtgTask; typedef int32_t (*ctgInitTaskFp)(SCtgJob*, int32_t, void*); @@ -618,6 +644,7 @@ int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SNa int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SName* pTableName, SVgroupInfo *vgroupInfo, STableCfg **out, SCtgTask* pTask); int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SName* pTableName, STableCfg **out, SCtgTask* pTask); int32_t ctgGetSvrVerFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, char **out, SCtgTask* pTask); +int32_t ctgLaunchBatchs(SCatalog* pCtg, SCtgJob *pJob, SHashObj* pBatchs); int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const SCatalogReq* pReq, catalogCallback fp, void* param); int32_t ctgLaunchJob(SCtgJob *pJob); @@ -626,6 +653,9 @@ int32_t ctgLaunchSubTask(SCtgTask *pTask, CTG_TASK_TYPE type, ctgSubTaskCbFp fp, int32_t ctgGetTbCfgCb(SCtgTask *pTask); void ctgFreeHandle(SCatalog* pCatalog); +void ctgFreeMsgSendParam(void* param); +void ctgFreeBatch(SCtgBatch *pBatch); +void ctgFreeBatchs(SHashObj *pBatchs); int32_t ctgCloneVgInfo(SDBVgInfo *src, SDBVgInfo **dst); int32_t ctgCloneMetaOutput(STableMetaOutput *output, STableMetaOutput **pOutput); int32_t ctgGenerateVgList(SCatalog *pCtg, SHashObj *vgHash, SArray** pList); @@ -642,7 +672,7 @@ int32_t ctgDbVgVersionSearchCompare(const void* key1, const void* key2); void ctgFreeSTableMetaOutput(STableMetaOutput* pOutput); int32_t ctgUpdateMsgCtx(SCtgMsgCtx* pCtx, int32_t reqType, void* out, char* target); char * ctgTaskTypeStr(CTG_TASK_TYPE type); -int32_t ctgUpdateSendTargetInfo(SMsgSendInfo *pMsgSendInfo, int32_t msgType, SCtgTask* pTask); +int32_t ctgUpdateSendTargetInfo(SMsgSendInfo *pMsgSendInfo, int32_t msgType, char* dbFName, int32_t vgId); int32_t ctgCloneTableIndex(SArray* pIndex, SArray** pRes); void ctgFreeSTableIndex(void *info); void ctgClearSubTaskRes(SCtgSubRes *pRes); diff --git a/source/libs/catalog/inc/ctgRemote.h b/source/libs/catalog/inc/ctgRemote.h index cd88863c1b..fe0762a88a 100644 --- a/source/libs/catalog/inc/ctgRemote.h +++ b/source/libs/catalog/inc/ctgRemote.h @@ -20,12 +20,6 @@ extern "C" { #endif -typedef struct SCtgTaskCallbackParam { - uint64_t queryId; - int64_t refId; - uint64_t taskId; - int32_t reqType; -} SCtgTaskCallbackParam; #ifdef __cplusplus diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index 920acbac2e..f4cee13ec0 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -473,8 +473,15 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const pJob->tbCfgNum = tbCfgNum; pJob->svrVerNum = svrVerNum; - pJob->pTasks = taosArrayInit(taskNum, sizeof(SCtgTask)); +#if CTG_BATCH_FETCH + pJob->pBatchs = taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); + if (NULL == pJob->pBatchs) { + ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM); + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } +#endif + pJob->pTasks = taosArrayInit(taskNum, sizeof(SCtgTask)); if (NULL == pJob->pTasks) { ctgError("taosArrayInit %d tasks failed", taskNum); CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); @@ -560,7 +567,7 @@ int32_t ctgInitJob(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob** job, const _return: - taosMemoryFreeClear(*job); + ctgFreeJob(*job); CTG_RET(code); } @@ -776,7 +783,8 @@ int32_t ctgCallSubCb(SCtgTask *pTask) { pParent->subRes.code = code; } } - + + pParent->pBatchs = pTask->pBatchs; CTG_ERR_JRET(pParent->subRes.fp(pParent)); } @@ -872,7 +880,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTask* pTask, int32_t reqType, const SDataBuf * SVgroupInfo vgInfo = {0}; CTG_ERR_JRET(ctgGetVgInfoFromHashValue(pCtg, dbCache->vgCache.vgInfo, ctx->pName, &vgInfo)); - ctgDebug("will refresh tbmeta, not supposed to be stb, tbName:%s, flag:%d", tNameGetTableName(ctx->pName), ctx->flag); + ctgDebug("will refresh tbmeta, supposed to be stb, tbName:%s, flag:%d", tNameGetTableName(ctx->pName), ctx->flag); ctx->vgId = vgInfo.vgId; CTG_ERR_JRET(ctgGetTbMetaFromVnode(pCtg, pConn, ctx->pName, &vgInfo, NULL, pTask)); @@ -890,7 +898,7 @@ int32_t ctgHandleGetTbMetaRsp(SCtgTask* pTask, int32_t reqType, const SDataBuf * return TSDB_CODE_SUCCESS; } - ctgError("no tbmeta got, tbNmae:%s", tNameGetTableName(ctx->pName)); + ctgError("no tbmeta got, tbName:%s", tNameGetTableName(ctx->pName)); ctgRemoveTbMetaFromCache(pCtg, ctx->pName, false); CTG_ERR_JRET(CTG_ERR_CODE_TABLE_NOT_EXIST); @@ -1653,6 +1661,7 @@ int32_t ctgSetSubTaskCb(SCtgTask *pSub, SCtgTask *pTask) { if (CTG_TASK_DONE == pSub->status) { pTask->subRes.code = pSub->code; CTG_ERR_JRET((*gCtgAsyncFps[pTask->type].cloneFp)(pSub, &pTask->subRes.res)); + pTask->pBatchs = pSub->pBatchs; CTG_ERR_JRET(pTask->subRes.fp(pTask)); } else { if (NULL == pSub->pParents) { @@ -1690,6 +1699,7 @@ int32_t ctgLaunchSubTask(SCtgTask *pTask, CTG_TASK_TYPE type, ctgSubTaskCbFp fp, CTG_ERR_RET(ctgSetSubTaskCb(pSub, pTask)); if (newTask) { + pSub->pBatchs = pTask->pBatchs; CTG_ERR_RET((*gCtgAsyncFps[pSub->type].launchFp)(pSub)); pSub->status = CTG_TASK_LAUNCHED; } @@ -1702,9 +1712,11 @@ int32_t ctgLaunchJob(SCtgJob *pJob) { for (int32_t i = 0; i < taskNum; ++i) { SCtgTask *pTask = taosArrayGet(pJob->pTasks, i); + pTask->pBatchs = pJob->pBatchs; qDebug("QID:0x%" PRIx64 " ctg launch [%dth] task", pJob->queryId, pTask->taskId); CTG_ERR_RET((*gCtgAsyncFps[pTask->type].launchFp)(pTask)); + pTask->status = CTG_TASK_LAUNCHED; } @@ -1712,6 +1724,10 @@ int32_t ctgLaunchJob(SCtgJob *pJob) { qDebug("QID:0x%" PRIx64 " ctg call user callback with rsp %s", pJob->queryId, tstrerror(pJob->jobResCode)); taosAsyncExec(ctgCallUserCb, pJob, NULL); +#if CTG_BATCH_FETCH + } else { + ctgLaunchBatchs(pJob->pCtg, pJob, pJob->pBatchs); +#endif } return TSDB_CODE_SUCCESS; diff --git a/source/libs/catalog/src/ctgRemote.c b/source/libs/catalog/src/ctgRemote.c index cc5dde9298..55bfc88a49 100644 --- a/source/libs/catalog/src/ctgRemote.c +++ b/source/libs/catalog/src/ctgRemote.c @@ -18,9 +18,67 @@ #include "tname.h" #include "catalogInt.h" #include "systable.h" -#include "ctgRemote.h" #include "tref.h" +int32_t ctgHandleBatchRsp(SCtgJob* pJob, SCtgTaskCallbackParam* cbParam, SDataBuf *pMsg, int32_t rspCode) { + int32_t code = 0; + SArray* pTaskId = cbParam->taskId; + SCatalog* pCtg = pJob->pCtg; + int32_t taskNum = taosArrayGetSize(pTaskId); + SDataBuf taskMsg = *pMsg; + int32_t offset = 0; + int32_t msgNum = (TSDB_CODE_SUCCESS == rspCode && pMsg->pData && (pMsg->len > 0)) ? ntohl(*(int32_t*)pMsg->pData) : 0; + ASSERT(taskNum == msgNum || 0 == msgNum); + + ctgDebug("QID:0x%" PRIx64 " ctg got batch %d rsp %s", pJob->queryId, cbParam->batchId, TMSG_INFO(cbParam->reqType + 1)); + + offset += sizeof(msgNum); + SBatchRsp rsp = {0}; + SHashObj* pBatchs = taosHashInit(taskNum, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); + if (NULL == pBatchs) { + ctgError("taosHashInit %d batch failed", taskNum); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + for (int32_t i = 0; i < taskNum; ++i) { + int32_t* taskId = taosArrayGet(pTaskId, i); + SCtgTask *pTask = taosArrayGet(pJob->pTasks, *taskId); + if (msgNum > 0) { + rsp.reqType = ntohl(*(int32_t*)((char*)pMsg->pData + offset)); + offset += sizeof(rsp.reqType); + rsp.msgLen = ntohl(*(int32_t*)((char*)pMsg->pData + offset)); + offset += sizeof(rsp.msgLen); + rsp.rspCode = ntohl(*(int32_t*)((char*)pMsg->pData + offset)); + offset += sizeof(rsp.rspCode); + rsp.msg = ((char*)pMsg->pData) + offset; + offset += rsp.msgLen; + + taskMsg.msgType = rsp.reqType; + taskMsg.pData = rsp.msg; + taskMsg.len = rsp.msgLen; + } else { + rsp.reqType = -1; + taskMsg.msgType = -1; + taskMsg.pData = NULL; + taskMsg.len = 0; + } + + pTask->pBatchs = pBatchs; + + ctgDebug("QID:0x%" PRIx64 " ctg task %d start to handle rsp %s", pJob->queryId, pTask->taskId, TMSG_INFO(taskMsg.msgType + 1)); + + (*gCtgAsyncFps[pTask->type].handleRspFp)(pTask, rsp.reqType, &taskMsg, (rsp.rspCode ? rsp.rspCode : rspCode)); + } + + CTG_ERR_JRET(ctgLaunchBatchs(pJob->pCtg, pJob, pBatchs)); + +_return: + + ctgFreeBatchs(pBatchs); + CTG_RET(code); +} + + int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, int32_t rspCode, char* target) { int32_t code = 0; @@ -233,6 +291,11 @@ int32_t ctgProcessRspMsg(void* out, int32_t reqType, char* msg, int32_t msgSize, break; } default: + if (TSDB_CODE_SUCCESS != rspCode) { + qError("Got error rsp, error:%s", tstrerror(rspCode)); + CTG_ERR_RET(rspCode); + } + qError("invalid req type %s", TMSG_INFO(reqType)); return TSDB_CODE_APP_ERROR; } @@ -254,12 +317,32 @@ int32_t ctgHandleMsgCallback(void *param, SDataBuf *pMsg, int32_t rspCode) { goto _return; } - SCtgTask *pTask = taosArrayGet(pJob->pTasks, cbParam->taskId); + SCatalog* pCtg = pJob->pCtg; - qDebug("QID:0x%" PRIx64 " ctg task %d start to handle rsp %s", pJob->queryId, pTask->taskId, TMSG_INFO(cbParam->reqType + 1)); + if (TDMT_VND_BATCH_META == cbParam->reqType || TDMT_MND_BATCH_META == cbParam->reqType) { + CTG_ERR_JRET(ctgHandleBatchRsp(pJob, cbParam, pMsg, rspCode)); + } else { + int32_t *taskId = taosArrayGet(cbParam->taskId, 0); + SCtgTask *pTask = taosArrayGet(pJob->pTasks, *taskId); + + qDebug("QID:0x%" PRIx64 " ctg task %d start to handle rsp %s", pJob->queryId, pTask->taskId, TMSG_INFO(cbParam->reqType + 1)); + +#if CTG_BATCH_FETCH + SHashObj* pBatchs = taosHashInit(CTG_DEFAULT_BATCH_NUM, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK); + if (NULL == pBatchs) { + ctgError("taosHashInit %d batch failed", CTG_DEFAULT_BATCH_NUM); + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + pTask->pBatchs = pBatchs; +#endif + + CTG_ERR_JRET((*gCtgAsyncFps[pTask->type].handleRspFp)(pTask, cbParam->reqType, pMsg, rspCode)); + +#if CTG_BATCH_FETCH + CTG_ERR_JRET(ctgLaunchBatchs(pJob->pCtg, pJob, pBatchs)); +#endif + } - CTG_ERR_JRET((*gCtgAsyncFps[pTask->type].handleRspFp)(pTask, cbParam->reqType, pMsg, rspCode)); - _return: taosMemoryFree(pMsg->pData); @@ -272,12 +355,12 @@ _return: } -int32_t ctgMakeMsgSendInfo(SCtgTask* pTask, int32_t msgType, SMsgSendInfo **pMsgSendInfo) { +int32_t ctgMakeMsgSendInfo(SCtgJob* pJob, SArray* pTaskId, int32_t batchId, int32_t msgType, SMsgSendInfo **pMsgSendInfo) { int32_t code = 0; SMsgSendInfo *msgSendInfo = taosMemoryCalloc(1, sizeof(SMsgSendInfo)); if (NULL == msgSendInfo) { qError("calloc %d failed", (int32_t)sizeof(SMsgSendInfo)); - CTG_ERR_RET(TSDB_CODE_QRY_OUT_OF_MEMORY); + CTG_ERR_JRET(TSDB_CODE_QRY_OUT_OF_MEMORY); } SCtgTaskCallbackParam *param = taosMemoryCalloc(1, sizeof(SCtgTaskCallbackParam)); @@ -287,12 +370,13 @@ int32_t ctgMakeMsgSendInfo(SCtgTask* pTask, int32_t msgType, SMsgSendInfo **pMsg } param->reqType = msgType; - param->queryId = pTask->pJob->queryId; - param->refId = pTask->pJob->refId; - param->taskId = pTask->taskId; + param->queryId = pJob->queryId; + param->refId = pJob->refId; + param->taskId = pTaskId; + param->batchId = batchId; msgSendInfo->param = param; - msgSendInfo->paramFreeFp = taosMemoryFree; + msgSendInfo->paramFreeFp = ctgFreeMsgSendParam; msgSendInfo->fp = ctgHandleMsgCallback; *pMsgSendInfo = msgSendInfo; @@ -301,18 +385,19 @@ int32_t ctgMakeMsgSendInfo(SCtgTask* pTask, int32_t msgType, SMsgSendInfo **pMsg _return: - taosMemoryFree(param); - taosMemoryFree(msgSendInfo); + taosArrayDestroy(pTaskId); + destroySendMsgInfo(msgSendInfo); CTG_RET(code); } -int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTask* pTask, int32_t msgType, void *msg, uint32_t msgSize) { +int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgJob* pJob, SArray* pTaskId, + int32_t batchId, char* dbFName, int32_t vgId, int32_t msgType, void *msg, uint32_t msgSize) { int32_t code = 0; SMsgSendInfo *pMsgSendInfo = NULL; - CTG_ERR_JRET(ctgMakeMsgSendInfo(pTask, msgType, &pMsgSendInfo)); + CTG_ERR_JRET(ctgMakeMsgSendInfo(pJob, pTaskId, batchId, msgType, &pMsgSendInfo)); - ctgUpdateSendTargetInfo(pMsgSendInfo, msgType, pTask); + ctgUpdateSendTargetInfo(pMsgSendInfo, msgType, dbFName, vgId); pMsgSendInfo->requestId = pConn->requestId; pMsgSendInfo->requestObjRefId = pConn->requestObjRefId; @@ -323,24 +408,178 @@ int32_t ctgAsyncSendMsg(SCatalog* pCtg, SRequestConnInfo *pConn, SCtgTask* pTask int64_t transporterId = 0; code = asyncSendMsgToServer(pConn->pTrans, &pConn->mgmtEps, &transporterId, pMsgSendInfo); + pMsgSendInfo = NULL; if (code) { ctgError("asyncSendMsgToSever failed, error: %s", tstrerror(code)); CTG_ERR_JRET(code); } - ctgDebug("ctg req msg sent, reqId:0x%" PRIx64 ", msg type:%d, %s", pTask->pJob->queryId, msgType, TMSG_INFO(msgType)); + ctgDebug("ctg req msg sent, reqId:0x%" PRIx64 ", msg type:%d, %s", pJob->queryId, msgType, TMSG_INFO(msgType)); return TSDB_CODE_SUCCESS; _return: if (pMsgSendInfo) { - taosMemoryFreeClear(pMsgSendInfo->param); - taosMemoryFreeClear(pMsgSendInfo); + destroySendMsgInfo(pMsgSendInfo); } CTG_RET(code); } +int32_t ctgAddBatch(SCatalog* pCtg, int32_t vgId, SRequestConnInfo *pConn, SCtgTask* pTask, int32_t msgType, void *msg, uint32_t msgSize) { + int32_t code = 0; + SHashObj* pBatchs = pTask->pBatchs; + SCtgJob* pJob = pTask->pJob; + SCtgBatch* pBatch = taosHashGet(pBatchs, &vgId, sizeof(vgId)); + int32_t taskNum = taosArrayGetSize(pTask->pJob->pTasks); + SCtgBatch newBatch = {0}; + SBatchMsg req = {0}; + + if (NULL == pBatch) { + newBatch.pMsgs = taosArrayInit(taskNum, sizeof(SBatchMsg)); + newBatch.pTaskIds = taosArrayInit(taskNum, sizeof(int32_t)); + if (NULL == newBatch.pMsgs || NULL == newBatch.pTaskIds) { + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } + + newBatch.conn = *pConn; + + req.msgType = msgType; + req.msgLen = msgSize; + req.msg = msg; + if (NULL == taosArrayPush(newBatch.pMsgs, &req)) { + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } + if (NULL == taosArrayPush(newBatch.pTaskIds, &pTask->taskId)) { + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } + newBatch.msgSize = sizeof(SBatchReq) + sizeof(req) + msgSize - POINTER_BYTES; + + if (vgId > 0) { + if (TDMT_VND_TABLE_CFG == msgType) { + SCtgTbCfgCtx* ctx = (SCtgTbCfgCtx*)pTask->taskCtx; + tNameGetFullDbName(ctx->pName, newBatch.dbFName); + } else if (TDMT_VND_TABLE_META == msgType) { + SCtgTbMetaCtx* ctx = (SCtgTbMetaCtx*)pTask->taskCtx; + tNameGetFullDbName(ctx->pName, newBatch.dbFName); + } else { + ctgError("invalid vnode msgType %d", msgType); + CTG_ERR_JRET(TSDB_CODE_APP_ERROR); + } + } + + newBatch.msgType = (vgId > 0) ? TDMT_VND_BATCH_META : TDMT_MND_BATCH_META; + newBatch.batchId = atomic_add_fetch_32(&pJob->batchId, 1); + + if (0 != taosHashPut(pBatchs, &vgId, sizeof(vgId), &newBatch, sizeof(newBatch))) { + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } + + ctgDebug("task %d %s req added to batch %d, target vgId %d", pTask->taskId, TMSG_INFO(msgType), newBatch.batchId, vgId); + + return TSDB_CODE_SUCCESS; + } + + req.msgType = msgType; + req.msgLen = msgSize; + req.msg = msg; + if (NULL == taosArrayPush(pBatch->pMsgs, &req)) { + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } + if (NULL == taosArrayPush(pBatch->pTaskIds, &pTask->taskId)) { + CTG_ERR_JRET(TSDB_CODE_OUT_OF_MEMORY); + } + pBatch->msgSize += sizeof(req) + msgSize - POINTER_BYTES; + + if (vgId > 0) { + if (TDMT_VND_TABLE_CFG == msgType) { + SCtgTbCfgCtx* ctx = (SCtgTbCfgCtx*)pTask->taskCtx; + tNameGetFullDbName(ctx->pName, newBatch.dbFName); + } else if (TDMT_VND_TABLE_META == msgType) { + SCtgTbMetaCtx* ctx = (SCtgTbMetaCtx*)pTask->taskCtx; + tNameGetFullDbName(ctx->pName, newBatch.dbFName); + } else { + ctgError("invalid vnode msgType %d", msgType); + CTG_ERR_JRET(TSDB_CODE_APP_ERROR); + } + } + + ctgDebug("task %d %s req added to batch %d, target vgId %d", pTask->taskId, TMSG_INFO(msgType), pBatch->batchId, vgId); + + return TSDB_CODE_SUCCESS; + +_return: + + ctgFreeBatch(&newBatch); + taosMemoryFree(msg); + + return code; +} + +int32_t ctgBuildBatchReqMsg(SCtgBatch* pBatch, int32_t vgId, void** msg) { + *msg = taosMemoryMalloc(pBatch->msgSize); + if (NULL == (*msg)) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + + int32_t offset = 0; + int32_t num = taosArrayGetSize(pBatch->pMsgs); + SBatchReq *pBatchReq = (SBatchReq*)(*msg); + + pBatchReq->header.vgId = htonl(vgId); + pBatchReq->msgNum = htonl(num); + offset += sizeof(SBatchReq); + + for (int32_t i = 0; i < num; ++i) { + SBatchMsg* pReq = taosArrayGet(pBatch->pMsgs, i); + *(int32_t*)((char*)(*msg) + offset) = htonl(pReq->msgType); + offset += sizeof(pReq->msgType); + *(int32_t*)((char*)(*msg) + offset) = htonl(pReq->msgLen); + offset += sizeof(pReq->msgLen); + memcpy((char*)(*msg) + offset, pReq->msg, pReq->msgLen); + offset += pReq->msgLen; + } + + ASSERT(pBatch->msgSize == offset); + + qDebug("batch req %d to vg %d msg built with %d meta reqs", pBatch->batchId, vgId, num); + + return TSDB_CODE_SUCCESS; +} + +int32_t ctgLaunchBatchs(SCatalog* pCtg, SCtgJob *pJob, SHashObj* pBatchs) { + int32_t code = 0; + void* msg = NULL; + void* p = taosHashIterate(pBatchs, NULL); + while (NULL != p) { + size_t len = 0; + int32_t* vgId = taosHashGetKey(p, &len); + SCtgBatch* pBatch = (SCtgBatch*)p; + + ctgDebug("QID:0x%" PRIx64 " ctg start to launch batch %d", pJob->queryId, pBatch->batchId); + + CTG_ERR_JRET(ctgBuildBatchReqMsg(pBatch, *vgId, &msg)); + code = ctgAsyncSendMsg(pCtg, &pBatch->conn, pJob, pBatch->pTaskIds, pBatch->batchId, + pBatch->dbFName, *vgId, pBatch->msgType, msg, pBatch->msgSize); + pBatch->pTaskIds = NULL; + CTG_ERR_JRET(code); + + p = taosHashIterate(pBatchs, p); + } + + return TSDB_CODE_SUCCESS; + +_return: + + if (p) { + taosHashCancelIterate(pBatchs, p); + } + taosMemoryFree(msg); + + CTG_RET(code); +} + + int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray *out, SCtgTask* pTask) { char *msg = NULL; int32_t msgLen = 0; @@ -361,7 +600,18 @@ int32_t ctgGetQnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, NULL)); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); + + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -396,7 +646,18 @@ int32_t ctgGetDnodeListFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SArray if (pTask) { CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, NULL, NULL)); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); + + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -436,8 +697,18 @@ int32_t ctgGetDBVgInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SBuildU CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, input->db)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -476,8 +747,18 @@ int32_t ctgGetDBCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const char CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, (char*)dbFName)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -516,8 +797,18 @@ int32_t ctgGetIndexInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, (char*)indexName)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -559,8 +850,18 @@ int32_t ctgGetTbIndexFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, SName *n } CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, (char*)tbFName)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -599,8 +900,18 @@ int32_t ctgGetUdfInfoFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const ch CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, (char*)funcName)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -639,8 +950,18 @@ int32_t ctgGetUserDbAuthFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, (char*)user)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -684,8 +1005,17 @@ int32_t ctgGetTbMetaFromMnodeImpl(SCatalog* pCtg, SRequestConnInfo *pConn, char CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, pOut, tbFName)); +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -744,7 +1074,21 @@ int32_t ctgGetTbMetaFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const SNa .requestId = pConn->requestId, .requestObjRefId = pConn->requestObjRefId, .mgmtEps = vgroupInfo->epSet}; - CTG_RET(ctgAsyncSendMsg(pCtg, &vConn, pTask, reqType, msg, msgLen)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, vgroupInfo->vgId, &vConn, pTask, reqType, msg, msgLen)); +#else + SCtgTbMetaCtx* ctx = (SCtgTbMetaCtx*)pTask->taskCtx; + char dbFName[TSDB_DB_FNAME_LEN]; + tNameGetFullDbName(ctx->pName, dbFName); + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); + + CTG_RET(ctgAsyncSendMsg(pCtg, &vConn, pTask->pJob, pTaskId, -1, dbFName, ctx->vgId, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -791,7 +1135,20 @@ int32_t ctgGetTableCfgFromVnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S .requestId = pConn->requestId, .requestObjRefId = pConn->requestObjRefId, .mgmtEps = vgroupInfo->epSet}; - CTG_RET(ctgAsyncSendMsg(pCtg, &vConn, pTask, reqType, msg, msgLen)); +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, vgroupInfo->vgId, &vConn, pTask, reqType, msg, msgLen)); +#else + SCtgTbCfgCtx* ctx = (SCtgTbCfgCtx*)pTask->taskCtx; + char dbFName[TSDB_DB_FNAME_LEN]; + tNameGetFullDbName(ctx->pName, dbFName); + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); + + CTG_RET(ctgAsyncSendMsg(pCtg, &vConn, pTask->pJob, pTaskId, -1, dbFName, ctx->pVgInfo->vgId, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -832,8 +1189,17 @@ int32_t ctgGetTableCfgFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, const S if (pTask) { CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, NULL, (char*)tbFName)); +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { @@ -868,8 +1234,18 @@ int32_t ctgGetSvrVerFromMnode(SCatalog* pCtg, SRequestConnInfo *pConn, char **ou if (pTask) { CTG_ERR_RET(ctgUpdateMsgCtx(&pTask->msgCtx, reqType, NULL, NULL)); + +#if CTG_BATCH_FETCH + CTG_RET(ctgAddBatch(pCtg, 0, pConn, pTask, reqType, msg, msgLen)); +#else + SArray* pTaskId = taosArrayInit(1, sizeof(int32_t)); + if (NULL == pTaskId) { + CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); + } + taosArrayPush(pTaskId, &pTask->taskId); - CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask, reqType, msg, msgLen)); + CTG_RET(ctgAsyncSendMsg(pCtg, pConn, pTask->pJob, pTaskId, -1, NULL, 0, reqType, msg, msgLen)); +#endif } SRpcMsg rpcMsg = { diff --git a/source/libs/catalog/src/ctgUtil.c b/source/libs/catalog/src/ctgUtil.c index 1f0f074a0f..e61becbe17 100644 --- a/source/libs/catalog/src/ctgUtil.c +++ b/source/libs/catalog/src/ctgUtil.c @@ -19,6 +19,39 @@ #include "catalogInt.h" #include "systable.h" +void ctgFreeMsgSendParam(void* param) { + if (NULL == param) { + return; + } + + SCtgTaskCallbackParam* pParam = (SCtgTaskCallbackParam*)param; + taosArrayDestroy(pParam->taskId); + + taosMemoryFree(param); +} + +void ctgFreeBatch(SCtgBatch *pBatch) { + if (NULL == pBatch) { + return; + } + + taosArrayDestroy(pBatch->pMsgs); + taosArrayDestroy(pBatch->pTaskIds); +} + +void ctgFreeBatchs(SHashObj *pBatchs) { + void* p = taosHashIterate(pBatchs, NULL); + while (NULL != p) { + SCtgBatch* pBatch = (SCtgBatch*)p; + + ctgFreeBatch(pBatch); + + p = taosHashIterate(pBatchs, p); + } + + taosHashCleanup(pBatchs); +} + char *ctgTaskTypeStr(CTG_TASK_TYPE type) { switch (type) { case CTG_TASK_GET_QNODE: @@ -612,6 +645,7 @@ void ctgFreeJob(void* job) { uint64_t qid = pJob->queryId; ctgFreeTasks(pJob->pTasks); + ctgFreeBatchs(pJob->pBatchs); ctgFreeSMetaData(&pJob->jobRes); @@ -867,14 +901,10 @@ int32_t ctgCloneTableIndex(SArray* pIndex, SArray** pRes) { } -int32_t ctgUpdateSendTargetInfo(SMsgSendInfo *pMsgSendInfo, int32_t msgType, SCtgTask* pTask) { - if (msgType == TDMT_VND_TABLE_META) { - SCtgTbMetaCtx* ctx = (SCtgTbMetaCtx*)pTask->taskCtx; - char dbFName[TSDB_DB_FNAME_LEN]; - tNameGetFullDbName(ctx->pName, dbFName); - +int32_t ctgUpdateSendTargetInfo(SMsgSendInfo *pMsgSendInfo, int32_t msgType, char* dbFName, int32_t vgId) { + if (msgType == TDMT_VND_TABLE_META || msgType == TDMT_VND_TABLE_CFG || msgType == TDMT_VND_BATCH_META) { pMsgSendInfo->target.type = TARGET_TYPE_VNODE; - pMsgSendInfo->target.vgId = ctx->vgId; + pMsgSendInfo->target.vgId = vgId; pMsgSendInfo->target.dbFName = strdup(dbFName); } else { pMsgSendInfo->target.type = TARGET_TYPE_MNODE; diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 6c0f4b2c12..d5486d62b1 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -468,7 +468,6 @@ typedef struct SStreamScanInfo { SSDataBlock* pUpdateDataRes; // status for tmq // SSchemaWrapper schema; - STqOffset offset; SNodeList* pGroupTags; SNode* pTagCond; SNode* pTagIndexCond; @@ -1021,6 +1020,7 @@ void copyUpdateDataBlock(SSDataBlock* pDest, SSDataBlock* pSource, int32_t tsCol int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle, SNodeList* groupKey); SSDataBlock* createSpecialDataBlock(EStreamType type); +void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput); #ifdef __cplusplus } diff --git a/source/libs/executor/src/dataDeleter.c b/source/libs/executor/src/dataDeleter.c index a0d4d64bff..06b7c13fa2 100644 --- a/source/libs/executor/src/dataDeleter.c +++ b/source/libs/executor/src/dataDeleter.c @@ -90,6 +90,8 @@ static void toDataCacheEntry(SDataDeleterHandle* pHandle, const SInputData* pInp pRes->uidList = pHandle->pParam->pUidList; pRes->skey = pHandle->pDeleter->deleteTimeRange.skey; pRes->ekey = pHandle->pDeleter->deleteTimeRange.ekey; + strcpy(pRes->tableName, pHandle->pDeleter->tableFName); + strcpy(pRes->tsColName, pHandle->pDeleter->tsColName); pRes->affectedRows = *(int64_t*)pColRes->pData; pBuf->useSize += pEntry->dataLen; diff --git a/source/libs/executor/src/executil.c b/source/libs/executor/src/executil.c index ec8e3c4abb..65df7140f7 100644 --- a/source/libs/executor/src/executil.c +++ b/source/libs/executor/src/executil.c @@ -193,7 +193,7 @@ SSDataBlock* createResDataBlock(SDataBlockDescNode* pNode) { pBlock->info.calWin = (STimeWindow){.skey = INT64_MIN, .ekey = INT64_MAX}; for (int32_t i = 0; i < numOfCols; ++i) { - SSlotDescNode* pDescNode = (SSlotDescNode*)nodesListGetNode(pNode->pSlots, i); + SSlotDescNode* pDescNode = (SSlotDescNode*)nodesListGetNode(pNode->pSlots, i); SColumnInfoData idata = createColumnInfoData(pDescNode->dataType.type, pDescNode->dataType.bytes, pDescNode->slotId); idata.info.scale = pDescNode->dataType.scale; @@ -267,8 +267,9 @@ int32_t isQualifiedTable(STableKeyInfo* info, SNode* pTagCond, void* metaHandle, code = metaGetTableEntryByUid(&mr, info->uid); if (TSDB_CODE_SUCCESS != code) { metaReaderClear(&mr); + *pQualified = false; - return terrno; + return TSDB_CODE_SUCCESS; } SNode* pTagCondTmp = nodesCloneNode(pTagCond); @@ -387,7 +388,7 @@ size_t getTableTagsBufLen(const SNodeList* pGroups) { } int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode, char* keyBuf, uint64_t* pGroupId) { - SMetaReader mr = {0}; + SMetaReader mr = {0}; metaReaderInit(&mr, pMeta, 0); metaGetTableEntryByUid(&mr, uid); @@ -395,7 +396,7 @@ int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode, nodesRewriteExprsPostOrder(groupNew, doTranslateTagExpr, &mr); char* isNull = (char*)keyBuf; - char* pStart = (char*)keyBuf + sizeof(int8_t)*LIST_LENGTH(pGroupNode); + char* pStart = (char*)keyBuf + sizeof(int8_t) * LIST_LENGTH(pGroupNode); SNode* pNode; int32_t index = 0; @@ -441,7 +442,7 @@ int32_t getGroupIdFromTagsVal(void* pMeta, uint64_t uid, SNodeList* pGroupNode, } } - int32_t len = (int32_t)(pStart - (char*)keyBuf); + int32_t len = (int32_t)(pStart - (char*)keyBuf); *pGroupId = calcGroupId(keyBuf, len); nodesDestroyList(groupNew); diff --git a/source/libs/executor/src/executor.c b/source/libs/executor/src/executor.c index f249321a76..1618bffb09 100644 --- a/source/libs/executor/src/executor.c +++ b/source/libs/executor/src/executor.c @@ -14,12 +14,12 @@ */ #include "executor.h" -#include "tref.h" #include "executorimpl.h" #include "planner.h" #include "tdatablock.h" -#include "vnode.h" +#include "tref.h" #include "tudf.h" +#include "vnode.h" static TdThreadOnce initPoolOnce = PTHREAD_ONCE_INIT; int32_t exchangeObjRefPool = -1; @@ -30,8 +30,7 @@ static void cleanupRefPool() { taosCloseRef(ref); } -static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, bool assignUid, - char* id) { +static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t numOfBlocks, int32_t type, char* id) { ASSERT(pOperator != NULL); if (pOperator->operatorType != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { if (pOperator->numOfDownstream == 0) { @@ -44,12 +43,12 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu return TSDB_CODE_QRY_APP_ERROR; } pOperator->status = OP_NOT_OPENED; - return doSetStreamBlock(pOperator->pDownstream[0], input, numOfBlocks, type, assignUid, id); + return doSetStreamBlock(pOperator->pDownstream[0], input, numOfBlocks, type, id); } else { pOperator->status = OP_NOT_OPENED; SStreamScanInfo* pInfo = pOperator->info; - pInfo->assignBlockUid = assignUid; + /*pInfo->assignBlockUid = assignUid;*/ // TODO: if a block was set but not consumed, // prevent setting a different type of block @@ -95,21 +94,7 @@ static int32_t doSetStreamBlock(SOperatorInfo* pOperator, void* input, size_t nu } } -#if 0 -int32_t qStreamScanSnapshot(qTaskInfo_t tinfo) { - if (tinfo == NULL) { - return TSDB_CODE_QRY_APP_ERROR; - } - SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - return doSetStreamBlock(pTaskInfo->pRoot, NULL, 0, STREAM_INPUT__TABLE_SCAN, 0, NULL); -} -#endif - -int32_t qSetStreamInput(qTaskInfo_t tinfo, const void* input, int32_t type, bool assignUid) { - return qSetMultiStreamInput(tinfo, input, 1, type, assignUid); -} - -int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type, bool assignUid) { +int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numOfBlocks, int32_t type) { if (tinfo == NULL) { return TSDB_CODE_QRY_APP_ERROR; } @@ -120,8 +105,7 @@ int32_t qSetMultiStreamInput(qTaskInfo_t tinfo, const void* pBlocks, size_t numO SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - int32_t code = - doSetStreamBlock(pTaskInfo->pRoot, (void**)pBlocks, numOfBlocks, type, assignUid, GET_TASKID(pTaskInfo)); + int32_t code = doSetStreamBlock(pTaskInfo->pRoot, (void**)pBlocks, numOfBlocks, type, GET_TASKID(pTaskInfo)); if (code != TSDB_CODE_SUCCESS) { qError("%s failed to set the stream block data", GET_TASKID(pTaskInfo)); } else { @@ -258,8 +242,8 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo } // todo refactor STableList - size_t bufLen = (pScanInfo->pGroupTags != NULL)? getTableTagsBufLen(pScanInfo->pGroupTags):0; - char* keyBuf = NULL; + size_t bufLen = (pScanInfo->pGroupTags != NULL) ? getTableTagsBufLen(pScanInfo->pGroupTags) : 0; + char* keyBuf = NULL; if (bufLen > 0) { keyBuf = taosMemoryMalloc(bufLen); if (keyBuf == NULL) { @@ -267,13 +251,13 @@ int32_t qUpdateQualifiedTableId(qTaskInfo_t tinfo, const SArray* tableIdList, bo } } - for(int32_t i = 0; i < taosArrayGetSize(qa); ++i) { + for (int32_t i = 0; i < taosArrayGetSize(qa); ++i) { uint64_t* uid = taosArrayGet(qa, i); STableKeyInfo keyInfo = {.uid = *uid, .groupId = 0}; if (bufLen > 0) { code = getGroupIdFromTagsVal(pScanInfo->readHandle.meta, keyInfo.uid, pScanInfo->pGroupTags, keyBuf, - &keyInfo.groupId); + &keyInfo.groupId); if (code != TSDB_CODE_SUCCESS) { return code; } @@ -347,9 +331,12 @@ int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, } code = dsCreateDataSinker(pSubplan->pDataSink, handle, pSinkParam); + if (code != TSDB_CODE_SUCCESS) { + taosMemoryFreeClear(pSinkParam); + } } - _error: +_error: // if failed to add ref for all tables in this query, abort current query return code; } @@ -573,11 +560,6 @@ const SSchemaWrapper* qExtractSchemaFromStreamScanner(void* scanner) { return pInfo->tqReader->pSchemaWrapper; } -const STqOffset* qExtractStatusFromStreamScanner(void* scanner) { - SStreamScanInfo* pInfo = scanner; - return &pInfo->offset; -} - void* qStreamExtractMetaMsg(qTaskInfo_t tinfo) { SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; ASSERT(pTaskInfo->execModel == OPTR_EXEC_MODEL_QUEUE); @@ -600,12 +582,17 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, const STqOffsetVal* pOffset) { while (1) { uint8_t type = pOperator->operatorType; pOperator->status = OP_OPENED; - if (type == QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { - SStreamScanInfo* pInfo = pOperator->info; - if (pOffset->type == TMQ_OFFSET__LOG) { - STableScanInfo* pTSInfo = pInfo->pTableScanOp->info; - tsdbReaderClose(pTSInfo->dataReader); - pTSInfo->dataReader = NULL; + // TODO add more check + if (type != QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN) { + ASSERT(pOperator->numOfDownstream == 1); + pOperator = pOperator->pDownstream[0]; + } + + SStreamScanInfo* pInfo = pOperator->info; + if (pOffset->type == TMQ_OFFSET__LOG) { + STableScanInfo* pTSInfo = pInfo->pTableScanOp->info; + tsdbReaderClose(pTSInfo->dataReader); + pTSInfo->dataReader = NULL; #if 0 if (tOffsetEqual(pOffset, &pTaskInfo->streamInfo.lastStatus) && pInfo->tqReader->pWalReader->curVersion != pOffset->version) { @@ -614,102 +601,74 @@ int32_t qStreamPrepareScan(qTaskInfo_t tinfo, const STqOffsetVal* pOffset) { ASSERT(0); } #endif - if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) { + if (tqSeekVer(pInfo->tqReader, pOffset->version + 1) < 0) { + return -1; + } + ASSERT(pInfo->tqReader->pWalReader->curVersion == pOffset->version + 1); + } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { + /*pInfo->blockType = STREAM_INPUT__TABLE_SCAN;*/ + int64_t uid = pOffset->uid; + int64_t ts = pOffset->ts; + + if (uid == 0) { + if (taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList) != 0) { + STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0); + uid = pTableInfo->uid; + ts = INT64_MIN; + } else { return -1; } - ASSERT(pInfo->tqReader->pWalReader->curVersion == pOffset->version + 1); - } else if (pOffset->type == TMQ_OFFSET__SNAPSHOT_DATA) { - /*pInfo->blockType = STREAM_INPUT__TABLE_SCAN;*/ - int64_t uid = pOffset->uid; - int64_t ts = pOffset->ts; + } - if (uid == 0) { - if (taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList) != 0) { - STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0); - uid = pTableInfo->uid; - ts = INT64_MIN; - } else { - return -1; - } - } - - /*if (pTaskInfo->streamInfo.lastStatus.type != TMQ_OFFSET__SNAPSHOT_DATA ||*/ - /*pTaskInfo->streamInfo.lastStatus.uid != uid || pTaskInfo->streamInfo.lastStatus.ts != ts) {*/ - STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info; - int32_t tableSz = taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList); + /*if (pTaskInfo->streamInfo.lastStatus.type != TMQ_OFFSET__SNAPSHOT_DATA ||*/ + /*pTaskInfo->streamInfo.lastStatus.uid != uid || pTaskInfo->streamInfo.lastStatus.ts != ts) {*/ + STableScanInfo* pTableScanInfo = pInfo->pTableScanOp->info; + int32_t tableSz = taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList); #ifndef NDEBUG - qDebug("switch to next table %ld (cursor %d), %ld rows returned", uid, pTableScanInfo->currentTable, - pInfo->pTableScanOp->resultInfo.totalRows); - pInfo->pTableScanOp->resultInfo.totalRows = 0; + qDebug("switch to next table %ld (cursor %d), %ld rows returned", uid, pTableScanInfo->currentTable, + pInfo->pTableScanOp->resultInfo.totalRows); + pInfo->pTableScanOp->resultInfo.totalRows = 0; #endif - bool found = false; - for (int32_t i = 0; i < tableSz; i++) { - STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, i); - if (pTableInfo->uid == uid) { - found = true; - pTableScanInfo->currentTable = i; - break; - } + bool found = false; + for (int32_t i = 0; i < tableSz; i++) { + STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, i); + if (pTableInfo->uid == uid) { + found = true; + pTableScanInfo->currentTable = i; + break; } - - // TODO after dropping table, table may be not found - ASSERT(found); - - if (pTableScanInfo->dataReader == NULL) { - if (tsdbReaderOpen(pTableScanInfo->readHandle.vnode, &pTableScanInfo->cond, - pTaskInfo->tableqinfoList.pTableList, &pTableScanInfo->dataReader, NULL) < 0 || - pTableScanInfo->dataReader == NULL) { - ASSERT(0); - } - } - - tsdbSetTableId(pTableScanInfo->dataReader, uid); - int64_t oldSkey = pTableScanInfo->cond.twindows.skey; - pTableScanInfo->cond.twindows.skey = ts + 1; - tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond); - pTableScanInfo->cond.twindows.skey = oldSkey; - pTableScanInfo->scanTimes = 0; - - qDebug("tsdb reader offset seek to uid %ld ts %ld, table cur set to %d , all table num %d", uid, ts, - pTableScanInfo->currentTable, tableSz); - /*}*/ - - } else { - ASSERT(0); } - return 0; + + // TODO after dropping table, table may be not found + ASSERT(found); + + if (pTableScanInfo->dataReader == NULL) { + if (tsdbReaderOpen(pTableScanInfo->readHandle.vnode, &pTableScanInfo->cond, + pTaskInfo->tableqinfoList.pTableList, &pTableScanInfo->dataReader, NULL) < 0 || + pTableScanInfo->dataReader == NULL) { + ASSERT(0); + } + } + + tsdbSetTableId(pTableScanInfo->dataReader, uid); + int64_t oldSkey = pTableScanInfo->cond.twindows.skey; + pTableScanInfo->cond.twindows.skey = ts + 1; + tsdbReaderReset(pTableScanInfo->dataReader, &pTableScanInfo->cond); + pTableScanInfo->cond.twindows.skey = oldSkey; + pTableScanInfo->scanTimes = 0; + + qDebug("tsdb reader offset seek to uid %ld ts %ld, table cur set to %d , all table num %d", uid, ts, + pTableScanInfo->currentTable, tableSz); + /*}*/ + } else { - ASSERT(pOperator->numOfDownstream == 1); - pOperator = pOperator->pDownstream[0]; + ASSERT(0); } + return 0; } } return 0; } - - -#if 0 -int32_t qStreamPrepareTsdbScan(qTaskInfo_t tinfo, uint64_t uid, int64_t ts) { - SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - - if (uid == 0) { - if (taosArrayGetSize(pTaskInfo->tableqinfoList.pTableList) != 0) { - STableKeyInfo* pTableInfo = taosArrayGet(pTaskInfo->tableqinfoList.pTableList, 0); - uid = pTableInfo->uid; - ts = INT64_MIN; - } - } - - return doPrepareScan(pTaskInfo->pRoot, uid, ts); -} - -int32_t qGetStreamScanStatus(qTaskInfo_t tinfo, uint64_t* uid, int64_t* ts) { - SExecTaskInfo* pTaskInfo = (SExecTaskInfo*)tinfo; - - return doGetScanStatus(pTaskInfo->pRoot, uid, ts); -} -#endif - diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 3f2f528a2d..525d7bf336 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -3209,9 +3209,8 @@ static void doHandleRemainBlockFromNewGroup(SFillOperatorInfo* pInfo, SResultInf if (taosFillHasMoreResults(pInfo->pFillInfo)) { int32_t numOfResultRows = pResultInfo->capacity - pInfo->pRes->info.rows; taosFillResultDataBlock(pInfo->pFillInfo, pInfo->pRes, numOfResultRows); - if (pInfo->pRes->info.rows > pResultInfo->threshold) { - return; - } + pInfo->pRes->info.groupId = pInfo->curGroupId; + return; } // handle the cached new group data block @@ -3230,7 +3229,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) { blockDataCleanup(pResBlock); doHandleRemainBlockFromNewGroup(pInfo, pResultInfo, pTaskInfo); - if (pResBlock->info.rows > pResultInfo->threshold || pResBlock->info.rows > 0) { + if (pResBlock->info.rows > 0) { pResBlock->info.groupId = pInfo->curGroupId; return pResBlock; } @@ -3436,7 +3435,7 @@ void initBasicInfo(SOptrBasicInfo* pInfo, SSDataBlock* pBlock) { initResultRowInfo(&pInfo->resultRowInfo); } -static void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) { +void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) { if (pCtx == NULL) { return NULL; } diff --git a/source/libs/executor/src/joinoperator.c b/source/libs/executor/src/joinoperator.c index 11e0059017..7b3c590f07 100644 --- a/source/libs/executor/src/joinoperator.c +++ b/source/libs/executor/src/joinoperator.c @@ -83,8 +83,6 @@ SOperatorInfo* createMergeJoinOperatorInfo(SOperatorInfo** pDownstream, int32_t } else if (pJoinNode->inputTsOrder == ORDER_DESC) { pInfo->inputTsOrder = TSDB_ORDER_DESC; } - //TODO: remove this when JoinNode inputTsOrder is ready - pInfo->inputTsOrder = TSDB_ORDER_ASC; pOperator->fpSet = createOperatorFpSet(operatorDummyOpenFn, doMergeJoin, NULL, NULL, destroyMergeJoinOperator, NULL, NULL, NULL); @@ -116,7 +114,9 @@ void destroyMergeJoinOperator(void* param, int32_t numOfOutput) { taosMemoryFreeClear(param); } -static void doJoinOneRow(struct SOperatorInfo* pOperator, SSDataBlock* pRes, int32_t currRow) { + +static void mergeJoinJoinLeftRight(struct SOperatorInfo* pOperator, SSDataBlock* pRes, int32_t currRow, + SSDataBlock* pLeftBlock, int32_t leftPos, SSDataBlock* pRightBlock, int32_t rightPos) { SJoinOperatorInfo* pJoinInfo = pOperator->info; for (int32_t i = 0; i < pOperator->exprSupp.numOfExprs; ++i) { @@ -130,11 +130,11 @@ static void doJoinOneRow(struct SOperatorInfo* pOperator, SSDataBlock* pRes, int SColumnInfoData* pSrc = NULL; if (pJoinInfo->pLeft->info.blockId == blockId) { - pSrc = taosArrayGet(pJoinInfo->pLeft->pDataBlock, slotId); - rowIndex = pJoinInfo->leftPos; + pSrc = taosArrayGet(pLeftBlock->pDataBlock, slotId); + rowIndex = leftPos; } else { - pSrc = taosArrayGet(pJoinInfo->pRight->pDataBlock, slotId); - rowIndex = pJoinInfo->rightPos; + pSrc = taosArrayGet(pRightBlock->pDataBlock, slotId); + rowIndex = rightPos; } if (colDataIsNull_s(pSrc, rowIndex)) { @@ -146,6 +146,45 @@ static void doJoinOneRow(struct SOperatorInfo* pOperator, SSDataBlock* pRes, int } } + +static bool mergeJoinGetNextTimestamp(SOperatorInfo* pOperator, int64_t* pLeftTs, int64_t* pRightTs) { + SJoinOperatorInfo* pJoinInfo = pOperator->info; + + if (pJoinInfo->pLeft == NULL || pJoinInfo->leftPos >= pJoinInfo->pLeft->info.rows) { + SOperatorInfo* ds1 = pOperator->pDownstream[0]; + pJoinInfo->pLeft = ds1->fpSet.getNextFn(ds1); + + pJoinInfo->leftPos = 0; + if (pJoinInfo->pLeft == NULL) { + setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); + return false; + } + } + + if (pJoinInfo->pRight == NULL || pJoinInfo->rightPos >= pJoinInfo->pRight->info.rows) { + SOperatorInfo* ds2 = pOperator->pDownstream[1]; + pJoinInfo->pRight = ds2->fpSet.getNextFn(ds2); + + pJoinInfo->rightPos = 0; + if (pJoinInfo->pRight == NULL) { + setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); + return false; + } + } + // only the timestamp match support for ordinary table + SColumnInfoData* pLeftCol = taosArrayGet(pJoinInfo->pLeft->pDataBlock, pJoinInfo->leftCol.slotId); + char* pLeftVal = colDataGetData(pLeftCol, pJoinInfo->leftPos); + *pLeftTs = *(int64_t*)pLeftVal; + + SColumnInfoData* pRightCol = taosArrayGet(pJoinInfo->pRight->pDataBlock, pJoinInfo->rightCol.slotId); + char* pRightVal = colDataGetData(pRightCol, pJoinInfo->rightPos); + *pRightTs = *(int64_t*)pRightVal; + + ASSERT(pLeftCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + ASSERT(pRightCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); + return true; +} + static void doMergeJoinImpl(struct SOperatorInfo* pOperator, SSDataBlock* pRes) { SJoinOperatorInfo* pJoinInfo = pOperator->info; @@ -154,52 +193,27 @@ static void doMergeJoinImpl(struct SOperatorInfo* pOperator, SSDataBlock* pRes) bool asc = (pJoinInfo->inputTsOrder == TSDB_ORDER_ASC) ? true : false; while (1) { - // todo extract method - if (pJoinInfo->pLeft == NULL || pJoinInfo->leftPos >= pJoinInfo->pLeft->info.rows) { - SOperatorInfo* ds1 = pOperator->pDownstream[0]; - pJoinInfo->pLeft = ds1->fpSet.getNextFn(ds1); - - pJoinInfo->leftPos = 0; - if (pJoinInfo->pLeft == NULL) { - setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); - break; - } + int64_t leftTs = 0; + int64_t rightTs = 0; + bool hasNextTs = mergeJoinGetNextTimestamp(pOperator, &leftTs, &rightTs); + if (!hasNextTs) { + break; } - if (pJoinInfo->pRight == NULL || pJoinInfo->rightPos >= pJoinInfo->pRight->info.rows) { - SOperatorInfo* ds2 = pOperator->pDownstream[1]; - pJoinInfo->pRight = ds2->fpSet.getNextFn(ds2); - - pJoinInfo->rightPos = 0; - if (pJoinInfo->pRight == NULL) { - setTaskStatus(pOperator->pTaskInfo, TASK_COMPLETED); - break; - } - } - - SColumnInfoData* pLeftCol = taosArrayGet(pJoinInfo->pLeft->pDataBlock, pJoinInfo->leftCol.slotId); - char* pLeftVal = colDataGetData(pLeftCol, pJoinInfo->leftPos); - - SColumnInfoData* pRightCol = taosArrayGet(pJoinInfo->pRight->pDataBlock, pJoinInfo->rightCol.slotId); - char* pRightVal = colDataGetData(pRightCol, pJoinInfo->rightPos); - - // only the timestamp match support for ordinary table - ASSERT(pLeftCol->info.type == TSDB_DATA_TYPE_TIMESTAMP); - if (*(int64_t*)pLeftVal == *(int64_t*)pRightVal) { - doJoinOneRow(pOperator, pRes, nrows); + if (leftTs == rightTs) { + mergeJoinJoinLeftRight(pOperator, pRes, nrows, + pJoinInfo->pLeft, pJoinInfo->leftPos, pJoinInfo->pRight, pJoinInfo->rightPos); pJoinInfo->leftPos += 1; pJoinInfo->rightPos += 1; nrows += 1; - } else if (asc && *(int64_t*)pLeftVal < *(int64_t*)pRightVal || - !asc && *(int64_t*)pLeftVal > *(int64_t*)pRightVal) { + } else if (asc && leftTs < rightTs || !asc && leftTs > rightTs) { pJoinInfo->leftPos += 1; if (pJoinInfo->leftPos >= pJoinInfo->pLeft->info.rows) { continue; } - } else if (asc && *(int64_t*)pLeftVal > *(int64_t*)pRightVal || - !asc && *(int64_t*)pLeftVal < *(int64_t*)pRightVal) { + } else if (asc && leftTs > rightTs || !asc && leftTs < rightTs) { pJoinInfo->rightPos += 1; if (pJoinInfo->rightPos >= pJoinInfo->pRight->info.rows) { continue; diff --git a/source/libs/executor/src/projectoperator.c b/source/libs/executor/src/projectoperator.c index 1edc086551..53e25c7e97 100644 --- a/source/libs/executor/src/projectoperator.c +++ b/source/libs/executor/src/projectoperator.c @@ -292,7 +292,9 @@ SSDataBlock* doProjectOperation(SOperatorInfo* pOperator) { // do apply filter doFilter(pProjectInfo->pFilterNode, pFinalRes, NULL); - if (pFinalRes->info.rows > 0 || pRes->info.rows == 0) { + + // when apply the limit/offset for each group, pRes->info.rows may be 0, due to limit constraint. + if (pFinalRes->info.rows > 0 || (pOperator->status == OP_EXEC_DONE)) { break; } } else { diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index 463ac0e69c..f07256e88e 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -1396,13 +1396,11 @@ SOperatorInfo* createRawScanOperatorInfo(SReadHandle* pHandle, STableScanPhysiNo static void destroyStreamScanOperatorInfo(void* param, int32_t numOfOutput) { SStreamScanInfo* pStreamScan = (SStreamScanInfo*)param; -#if 1 if (pStreamScan->pTableScanOp && pStreamScan->pTableScanOp->info) { STableScanInfo* pTableScanInfo = pStreamScan->pTableScanOp->info; destroyTableScanOperatorInfo(pTableScanInfo, numOfOutput); taosMemoryFreeClear(pStreamScan->pTableScanOp); } -#endif if (pStreamScan->tqReader) { tqCloseReader(pStreamScan->tqReader); } @@ -1528,6 +1526,7 @@ SOperatorInfo* createStreamScanOperatorInfo(SReadHandle* pHandle, STableScanPhys pInfo->pDeleteDataRes = createSpecialDataBlock(STREAM_DELETE_DATA); pInfo->updateWin = (STimeWindow){.skey = INT64_MAX, .ekey = INT64_MAX}; pInfo->pUpdateDataRes = createSpecialDataBlock(STREAM_CLEAR); + pInfo->assignBlockUid = pTableScanNode->assignBlockUid; pOperator->name = "StreamScanOperator"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_STREAM_SCAN; @@ -2855,7 +2854,8 @@ int32_t stopGroupTableMergeScan(SOperatorInfo* pOperator) { return TSDB_CODE_SUCCESS; } -SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock* pResBlock, int32_t capacity, SOperatorInfo* pOperator) { +SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock* pResBlock, int32_t capacity, + SOperatorInfo* pOperator) { STableMergeScanInfo* pInfo = pOperator->info; SExecTaskInfo* pTaskInfo = pOperator->pTaskInfo; @@ -2874,7 +2874,6 @@ SSDataBlock* getSortedTableMergeScanBlockData(SSortHandle* pHandle, SSDataBlock* } } - qDebug("%s get sorted row blocks, rows:%d", GET_TASKID(pTaskInfo), pResBlock->info.rows); return (pResBlock->info.rows > 0) ? pResBlock : NULL; } @@ -2905,7 +2904,8 @@ SSDataBlock* doTableMergeScan(SOperatorInfo* pOperator) { } SSDataBlock* pBlock = NULL; while (pInfo->tableStartIndex < tableListSize) { - pBlock = getSortedTableMergeScanBlockData(pInfo->pSortHandle, pInfo->pResBlock, pOperator->resultInfo.capacity, pOperator); + pBlock = getSortedTableMergeScanBlockData(pInfo->pSortHandle, pInfo->pResBlock, pOperator->resultInfo.capacity, + pOperator); if (pBlock != NULL) { pBlock->info.groupId = pInfo->groupId; pOperator->resultInfo.totalRows += pBlock->info.rows; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index c2cf19167a..9a82b194a9 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -773,9 +773,9 @@ int32_t binarySearch(void* keyList, int num, TSKEY key, int order, __get_value_f } int32_t comparePullWinKey(void* pKey, void* data, int32_t index) { - SArray* res = (SArray*)data; + SArray* res = (SArray*)data; SPullWindowInfo* pos = taosArrayGet(res, index); - SPullWindowInfo* pData = (SPullWindowInfo*) pKey; + SPullWindowInfo* pData = (SPullWindowInfo*)pKey; if (pData->window.skey == pos->window.skey) { if (pData->groupId > pos->groupId) { return 1; @@ -810,7 +810,7 @@ static int32_t savePullWindow(SPullWindowInfo* pPullInfo, SArray* pPullWins) { int32_t compareResKey(void* pKey, void* data, int32_t index) { SArray* res = (SArray*)data; SResKeyPos* pos = taosArrayGetP(res, index); - SWinRes* pData = (SWinRes*) pKey; + SWinRes* pData = (SWinRes*)pKey; if (pData->ts == *(int64_t*)pos->key) { if (pData->groupId > pos->groupId) { return 1; @@ -880,7 +880,7 @@ int64_t getWinReskey(void* data, int32_t index) { int32_t compareWinRes(void* pKey, void* data, int32_t index) { SArray* res = (SArray*)data; SWinRes* pos = taosArrayGetP(res, index); - SResKeyPos* pData = (SResKeyPos*) pKey; + SResKeyPos* pData = (SResKeyPos*)pKey; if (*(int64_t*)pData->key == pos->ts) { if (pData->groupId > pos->groupId) { return 1; @@ -1417,15 +1417,15 @@ static void doClearWindows(SAggSupporter* pAggSup, SExprSupp* pSup1, SInterval* SColumnInfoData* pGpCol = taosArrayGet(pBlock->pDataBlock, GROUPID_COLUMN_INDEX); pGpDatas = (uint64_t*)pGpCol->pData; } - int32_t step = 0; - int32_t startPos = 0; + int32_t step = 0; + int32_t startPos = 0; for (int32_t i = 0; i < pBlock->info.rows; i++) { SResultRowInfo dumyInfo; dumyInfo.cur.pageId = -1; STimeWindow win = getActiveTimeWindow(NULL, &dumyInfo, startTsCols[i], pInterval, TSDB_ORDER_ASC); while (win.ekey <= endTsCols[i]) { uint64_t winGpId = pGpDatas ? pGpDatas[startPos] : pBlock->info.groupId; - bool res = doClearWindow(pAggSup, pSup1, (char*)&win.skey, sizeof(TSKEY), winGpId, numOfOutput); + bool res = doClearWindow(pAggSup, pSup1, (char*)&win.skey, sizeof(TSKEY), winGpId, numOfOutput); if (pUpWins && res) { SWinRes winRes = {.ts = win.skey, .groupId = winGpId}; taosArrayPush(pUpWins, &winRes); @@ -1596,7 +1596,7 @@ static SSDataBlock* doStreamIntervalAgg(SOperatorInfo* pOperator) { } if (pBlock->info.type == STREAM_NORMAL) { - //set input version + // set input version pTaskInfo->version = pBlock->info.version; } @@ -1644,7 +1644,7 @@ static void destroyStateWindowOperatorInfo(void* param, int32_t numOfOutput) { } static void freeItem(void* param) { - SGroupKeys *pKey = (SGroupKeys*) param; + SGroupKeys* pKey = (SGroupKeys*)param; taosMemoryFree(pKey->pData); } @@ -2347,10 +2347,10 @@ SOperatorInfo* createTimeSliceOperatorInfo(SOperatorInfo* downstream, SPhysiNode initResultSizeInfo(&pOperator->resultInfo, 4096); pInfo->pFillColInfo = createFillColInfo(pExprInfo, numOfExprs, (SNodeListNode*)pInterpPhyNode->pFillValues); - pInfo->pRes = createResDataBlock(pPhyNode->pOutputDataBlockDesc); - pInfo->win = pInterpPhyNode->timeRange; + pInfo->pRes = createResDataBlock(pPhyNode->pOutputDataBlockDesc); + pInfo->win = pInterpPhyNode->timeRange; pInfo->interval.interval = pInterpPhyNode->interval; - pInfo->current = pInfo->win.skey; + pInfo->current = pInfo->win.skey; pOperator->name = "TimeSliceOperator"; pOperator->operatorType = QUERY_NODE_PHYSICAL_PLAN_INTERP_FUNC; @@ -2970,8 +2970,8 @@ SSDataBlock* createSpecialDataBlock(EStreamType type) { pBlock->info.groupId = 0; pBlock->info.rows = 0; pBlock->info.type = type; - pBlock->info.rowSize = sizeof(TSKEY) + sizeof(TSKEY) + sizeof(uint64_t) + - sizeof(uint64_t) + sizeof(TSKEY) + sizeof(TSKEY); + pBlock->info.rowSize = + sizeof(TSKEY) + sizeof(TSKEY) + sizeof(uint64_t) + sizeof(uint64_t) + sizeof(TSKEY) + sizeof(TSKEY); pBlock->pDataBlock = taosArrayInit(6, sizeof(SColumnInfoData)); SColumnInfoData infoData = {0}; @@ -3147,6 +3147,8 @@ void destroyStreamSessionAggOperatorInfo(void* param, int32_t numOfOutput) { blockDataDestroy(pInfo->pDelRes); blockDataDestroy(pInfo->pWinBlock); blockDataDestroy(pInfo->pUpdateRes); + destroySqlFunctionCtx(pInfo->pDummyCtx, 0); + taosHashCleanup(pInfo->pStDeleted); taosMemoryFreeClear(param); } @@ -4323,10 +4325,10 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl } else { return; } - + SStreamAggSupporter* pAggSup = &pInfo->streamAggSup; blockDataEnsureCapacity(pAggSup->pScanBlock, pSDataBlock->info.rows); - SColumnInfoData* pKeyColInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->stateCol.slotId); + SColumnInfoData* pKeyColInfo = taosArrayGet(pSDataBlock->pDataBlock, pInfo->stateCol.slotId); for (int32_t i = 0; i < pSDataBlock->info.rows; i += winRows) { if (pInfo->ignoreExpiredData && isOverdue(tsCols[i], &pInfo->twAggSup)) { i++; @@ -4341,7 +4343,7 @@ static void doStreamStateAggImpl(SOperatorInfo* pOperator, SSDataBlock* pSDataBl &allEqual, pInfo->pSeDeleted); if (!allEqual) { appendOneRow(pAggSup->pScanBlock, &pCurWin->winInfo.win.skey, &pCurWin->winInfo.win.ekey, - &pSDataBlock->info.groupId); + &pSDataBlock->info.groupId); taosHashRemove(pSeUpdated, &pCurWin->winInfo.pos, sizeof(SResultRowPosition)); deleteWindow(pAggSup->pCurWins, winIndex); continue; diff --git a/source/libs/function/inc/builtins.h b/source/libs/function/inc/builtins.h index 256500ff8c..f5efcd5206 100644 --- a/source/libs/function/inc/builtins.h +++ b/source/libs/function/inc/builtins.h @@ -25,6 +25,7 @@ extern "C" { typedef int32_t (*FTranslateFunc)(SFunctionNode* pFunc, char* pErrBuf, int32_t len); typedef EFuncDataRequired (*FFuncDataRequired)(SFunctionNode* pFunc, STimeWindow* pTimeWindow); typedef int32_t (*FCreateMergeFuncParameters)(SNodeList* pRawParameters, SNode* pPartialRes, SNodeList** pParameters); +typedef EFuncDataRequired (*FFuncDynDataRequired)(void* pRes, STimeWindow* pTimeWindow); typedef struct SBuiltinFuncDefinition { const char* name; @@ -32,6 +33,7 @@ typedef struct SBuiltinFuncDefinition { uint64_t classification; FTranslateFunc translateFunc; FFuncDataRequired dataRequiredFunc; + FFuncDynDataRequired dynDataRequiredFunc; FExecGetEnv getEnvFunc; FExecInit initFunc; FExecProcess processFunc; diff --git a/source/libs/function/src/builtinsimpl.c b/source/libs/function/src/builtinsimpl.c index 536dd4299a..fb82ab206c 100644 --- a/source/libs/function/src/builtinsimpl.c +++ b/source/libs/function/src/builtinsimpl.c @@ -466,7 +466,7 @@ int32_t functionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); - pResInfo->isNullRes = (pResInfo->numOfRes == 0) ? 1 : 0; + pResInfo->isNullRes = (pResInfo->isNullRes == 1) ? 1 : (pResInfo->numOfRes == 0); char* in = GET_ROWCELL_INTERBUF(pResInfo); colDataAppend(pCol, pBlock->info.rows, in, pResInfo->isNullRes); @@ -663,7 +663,8 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) { // check for overflow if (IS_FLOAT_TYPE(type) && (isinf(pSumRes->dsum) || isnan(pSumRes->dsum))) { - numOfElem = 0; + GET_RES_INFO(pCtx)->isNullRes = 1; + numOfElem = 1; } _sum_over: @@ -1605,7 +1606,7 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { int32_t currentRow = pBlock->info.rows; SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); - pEntryInfo->isNullRes = (pEntryInfo->numOfRes == 0); + pEntryInfo->isNullRes = (pEntryInfo->isNullRes == 1) ? 1 : (pEntryInfo->numOfRes == 0); if (pCol->info.type == TSDB_DATA_TYPE_FLOAT) { float v = *(double*)&pRes->v; diff --git a/source/libs/function/src/functionMgt.c b/source/libs/function/src/functionMgt.c index c173522683..020fd648e1 100644 --- a/source/libs/function/src/functionMgt.c +++ b/source/libs/function/src/functionMgt.c @@ -103,6 +103,13 @@ EFuncDataRequired fmFuncDataRequired(SFunctionNode* pFunc, STimeWindow* pTimeWin return funcMgtBuiltins[pFunc->funcId].dataRequiredFunc(pFunc, pTimeWindow); } +EFuncDataRequired fmFuncDynDataRequired(int32_t funcId, void* pRes, STimeWindow* pTimeWindow) { + if (fmIsUserDefinedFunc(funcId) || funcId < 0 || funcId >= funcMgtBuiltinsNum) { + return TSDB_CODE_FAILED; + } + return funcMgtBuiltins[funcId].dynDataRequiredFunc(pRes, pTimeWindow); +} + int32_t fmGetFuncExecFuncs(int32_t funcId, SFuncExecFuncs* pFpSet) { if (fmIsUserDefinedFunc(funcId) || funcId < 0 || funcId >= funcMgtBuiltinsNum) { return TSDB_CODE_FAILED; diff --git a/source/libs/nodes/src/nodesCloneFuncs.c b/source/libs/nodes/src/nodesCloneFuncs.c index 5279d015b4..5fc94c2642 100644 --- a/source/libs/nodes/src/nodesCloneFuncs.c +++ b/source/libs/nodes/src/nodesCloneFuncs.c @@ -401,7 +401,8 @@ static int32_t logicVnodeModifCopy(const SVnodeModifyLogicNode* pSrc, SVnodeModi COPY_SCALAR_FIELD(tableId); COPY_SCALAR_FIELD(stableId); COPY_SCALAR_FIELD(tableType); - COPY_CHAR_ARRAY_FIELD(tableFName); + COPY_CHAR_ARRAY_FIELD(tableName); + COPY_CHAR_ARRAY_FIELD(tsColName); COPY_OBJECT_FIELD(deleteTimeRange, sizeof(STimeWindow)); CLONE_OBJECT_FIELD(pVgroupList, vgroupsInfoClone); CLONE_NODE_LIST_FIELD(pInsertCols); diff --git a/source/libs/nodes/src/nodesCodeFuncs.c b/source/libs/nodes/src/nodesCodeFuncs.c index 186a51f000..1c9c097cba 100644 --- a/source/libs/nodes/src/nodesCodeFuncs.c +++ b/source/libs/nodes/src/nodesCodeFuncs.c @@ -1712,6 +1712,7 @@ static int32_t jsonToPhysiProjectNode(const SJson* pJson, void* pObj) { } static const char* jkJoinPhysiPlanJoinType = "JoinType"; +static const char* jkJoinPhysiPlanInputTsOrder = "InputTsOrder"; static const char* jkJoinPhysiPlanMergeCondition = "MergeCondition"; static const char* jkJoinPhysiPlanOnConditions = "OnConditions"; static const char* jkJoinPhysiPlanTargets = "Targets"; @@ -1723,6 +1724,9 @@ static int32_t physiJoinNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanJoinType, pNode->joinType); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddIntegerToObject(pJson, jkJoinPhysiPlanInputTsOrder, pNode->inputTsOrder); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddObject(pJson, jkJoinPhysiPlanMergeCondition, nodeToJson, pNode->pMergeCondition); } @@ -1742,7 +1746,9 @@ static int32_t jsonToPhysiJoinNode(const SJson* pJson, void* pObj) { int32_t code = jsonToPhysicPlanNode(pJson, pObj); if (TSDB_CODE_SUCCESS == code) { tjsonGetNumberValue(pJson, jkJoinPhysiPlanJoinType, pNode->joinType, code); - ; + } + if (TSDB_CODE_SUCCESS == code) { + tjsonGetNumberValue(pJson, jkJoinPhysiPlanInputTsOrder, pNode->inputTsOrder, code); } if (TSDB_CODE_SUCCESS == code) { code = jsonToNodeObject(pJson, jkJoinPhysiPlanOnConditions, &pNode->pOnConditions); @@ -2326,7 +2332,7 @@ static int32_t physiQueryInsertNodeToJson(const void* pObj, SJson* pJson) { code = tjsonAddIntegerToObject(pJson, jkQueryInsertPhysiPlanTableType, pNode->tableType); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonAddStringToObject(pJson, jkQueryInsertPhysiPlanTableFName, pNode->tableFName); + code = tjsonAddStringToObject(pJson, jkQueryInsertPhysiPlanTableFName, pNode->tableName); } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkQueryInsertPhysiPlanVgId, pNode->vgId); @@ -2355,7 +2361,7 @@ static int32_t jsonToPhysiQueryInsertNode(const SJson* pJson, void* pObj) { code = tjsonGetTinyIntValue(pJson, jkQueryInsertPhysiPlanTableType, &pNode->tableType); } if (TSDB_CODE_SUCCESS == code) { - code = tjsonGetStringValue(pJson, jkQueryInsertPhysiPlanTableFName, pNode->tableFName); + code = tjsonGetStringValue(pJson, jkQueryInsertPhysiPlanTableFName, pNode->tableName); } if (TSDB_CODE_SUCCESS == code) { code = tjsonGetIntValue(pJson, jkQueryInsertPhysiPlanVgId, &pNode->vgId); @@ -2370,6 +2376,7 @@ static int32_t jsonToPhysiQueryInsertNode(const SJson* pJson, void* pObj) { static const char* jkDeletePhysiPlanTableId = "TableId"; static const char* jkDeletePhysiPlanTableType = "TableType"; static const char* jkDeletePhysiPlanTableFName = "TableFName"; +static const char* jkDeletePhysiPlanTsColName = "TsColName"; static const char* jkDeletePhysiPlanDeleteTimeRangeStartKey = "DeleteTimeRangeStartKey"; static const char* jkDeletePhysiPlanDeleteTimeRangeEndKey = "DeleteTimeRangeEndKey"; static const char* jkDeletePhysiPlanAffectedRows = "AffectedRows"; @@ -2387,6 +2394,9 @@ static int32_t physiDeleteNodeToJson(const void* pObj, SJson* pJson) { if (TSDB_CODE_SUCCESS == code) { code = tjsonAddStringToObject(pJson, jkDeletePhysiPlanTableFName, pNode->tableFName); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonAddStringToObject(pJson, jkDeletePhysiPlanTsColName, pNode->tsColName); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonAddIntegerToObject(pJson, jkDeletePhysiPlanDeleteTimeRangeStartKey, pNode->deleteTimeRange.skey); } @@ -2413,6 +2423,9 @@ static int32_t jsonToPhysiDeleteNode(const SJson* pJson, void* pObj) { if (TSDB_CODE_SUCCESS == code) { code = tjsonGetStringValue(pJson, jkDeletePhysiPlanTableFName, pNode->tableFName); } + if (TSDB_CODE_SUCCESS == code) { + code = tjsonGetStringValue(pJson, jkDeletePhysiPlanTsColName, pNode->tsColName); + } if (TSDB_CODE_SUCCESS == code) { code = tjsonGetBigIntValue(pJson, jkDeletePhysiPlanDeleteTimeRangeStartKey, &pNode->deleteTimeRange.skey); } diff --git a/source/libs/parser/inc/sql.y b/source/libs/parser/inc/sql.y index f4e8779902..f625ebd388 100644 --- a/source/libs/parser/inc/sql.y +++ b/source/libs/parser/inc/sql.y @@ -176,7 +176,6 @@ db_options(A) ::= db_options(B) CACHESIZE NK_INTEGER(C). db_options(A) ::= db_options(B) COMP NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_COMP, &C); } db_options(A) ::= db_options(B) DURATION NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); } db_options(A) ::= db_options(B) DURATION NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_DAYS, &C); } -db_options(A) ::= db_options(B) FSYNC NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_FSYNC, &C); } db_options(A) ::= db_options(B) MAXROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MAXROWS, &C); } db_options(A) ::= db_options(B) MINROWS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_MINROWS, &C); } db_options(A) ::= db_options(B) KEEP integer_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_KEEP, C); } @@ -186,11 +185,12 @@ db_options(A) ::= db_options(B) PAGESIZE NK_INTEGER(C). db_options(A) ::= db_options(B) PRECISION NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_PRECISION, &C); } db_options(A) ::= db_options(B) REPLICA NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_REPLICA, &C); } db_options(A) ::= db_options(B) STRICT NK_STRING(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STRICT, &C); } -db_options(A) ::= db_options(B) WAL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL, &C); } db_options(A) ::= db_options(B) VGROUPS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_VGROUPS, &C); } db_options(A) ::= db_options(B) SINGLE_STABLE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SINGLE_STABLE, &C); } db_options(A) ::= db_options(B) RETENTIONS retention_list(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_RETENTIONS, C); } db_options(A) ::= db_options(B) SCHEMALESS NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_SCHEMALESS, &C); } +db_options(A) ::= db_options(B) WAL_LEVEL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL, &C); } +db_options(A) ::= db_options(B) WAL_FSYNC_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_FSYNC, &C); } db_options(A) ::= db_options(B) WAL_RETENTION_PERIOD NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_WAL_RETENTION_PERIOD, &C); } db_options(A) ::= db_options(B) WAL_RETENTION_PERIOD NK_MINUS(D) NK_INTEGER(C). { SToken t = D; @@ -214,13 +214,13 @@ alter_db_options(A) ::= alter_db_options(B) alter_db_option(C). //alter_db_option(A) ::= BUFFER NK_INTEGER(B). { A.type = DB_OPTION_BUFFER; A.val = B; } alter_db_option(A) ::= CACHEMODEL NK_STRING(B). { A.type = DB_OPTION_CACHEMODEL; A.val = B; } alter_db_option(A) ::= CACHESIZE NK_INTEGER(B). { A.type = DB_OPTION_CACHESIZE; A.val = B; } -alter_db_option(A) ::= FSYNC NK_INTEGER(B). { A.type = DB_OPTION_FSYNC; A.val = B; } +alter_db_option(A) ::= WAL_FSYNC_PERIOD NK_INTEGER(B). { A.type = DB_OPTION_FSYNC; A.val = B; } alter_db_option(A) ::= KEEP integer_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; } alter_db_option(A) ::= KEEP variable_list(B). { A.type = DB_OPTION_KEEP; A.pList = B; } //alter_db_option(A) ::= PAGES NK_INTEGER(B). { A.type = DB_OPTION_PAGES; A.val = B; } //alter_db_option(A) ::= REPLICA NK_INTEGER(B). { A.type = DB_OPTION_REPLICA; A.val = B; } //alter_db_option(A) ::= STRICT NK_STRING(B). { A.type = DB_OPTION_STRICT; A.val = B; } -alter_db_option(A) ::= WAL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; } +alter_db_option(A) ::= WAL_LEVEL NK_INTEGER(B). { A.type = DB_OPTION_WAL; A.val = B; } %type integer_list { SNodeList* } %destructor integer_list { nodesDestroyList($$); } @@ -476,7 +476,7 @@ explain_options(A) ::= explain_options(B) VERBOSE NK_BOOL(C). explain_options(A) ::= explain_options(B) RATIO NK_FLOAT(C). { A = setExplainRatio(pCxt, B, &C); } /************************************************ compact *************************************************************/ -cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP. { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } +//cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP. { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } /************************************************ create/drop function ************************************************/ cmd ::= CREATE agg_func_opt(A) FUNCTION not_exists_opt(F) function_name(B) @@ -525,7 +525,7 @@ dnode_list(A) ::= DNODE NK_INTEGER(B). dnode_list(A) ::= dnode_list(B) DNODE NK_INTEGER(C). { A = addNodeToList(pCxt, B, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &C)); } /************************************************ syncdb **************************************************************/ -cmd ::= SYNCDB db_name(A) REPLICA. { pCxt->pRootNode = createSyncdbStmt(pCxt, &A); } +//cmd ::= SYNCDB db_name(A) REPLICA. { pCxt->pRootNode = createSyncdbStmt(pCxt, &A); } /************************************************ syncdb **************************************************************/ cmd ::= DELETE FROM full_table_name(A) where_clause_opt(B). { pCxt->pRootNode = createDeleteStmt(pCxt, A, B); } diff --git a/source/libs/parser/src/parTokenizer.c b/source/libs/parser/src/parTokenizer.c index e204f37a04..db907b1f68 100644 --- a/source/libs/parser/src/parTokenizer.c +++ b/source/libs/parser/src/parTokenizer.c @@ -29,291 +29,224 @@ typedef struct SKeyword { // clang-format off // keywords in sql string static SKeyword keywordTable[] = { - {"ACCOUNT", TK_ACCOUNT}, - {"ACCOUNTS", TK_ACCOUNTS}, - {"ADD", TK_ADD}, - {"AGGREGATE", TK_AGGREGATE}, - {"ALL", TK_ALL}, - {"ALTER", TK_ALTER}, - {"ANALYZE", TK_ANALYZE}, - {"AND", TK_AND}, - {"APPS", TK_APPS}, - {"AS", TK_AS}, - {"ASC", TK_ASC}, - {"AT_ONCE", TK_AT_ONCE}, - {"BALANCE", TK_BALANCE}, - {"BETWEEN", TK_BETWEEN}, - {"BINARY", TK_BINARY}, - {"BIGINT", TK_BIGINT}, - {"BNODE", TK_BNODE}, - {"BNODES", TK_BNODES}, - {"BOOL", TK_BOOL}, - {"BUFFER", TK_BUFFER}, - {"BUFSIZE", TK_BUFSIZE}, - {"BY", TK_BY}, - {"CACHE", TK_CACHE}, - {"CACHEMODEL", TK_CACHEMODEL}, - {"CACHESIZE", TK_CACHESIZE}, - {"CAST", TK_CAST}, - {"CLIENT_VERSION", TK_CLIENT_VERSION}, - {"CLUSTER", TK_CLUSTER}, - {"COLUMN", TK_COLUMN}, - {"COMMENT", TK_COMMENT}, - {"COMP", TK_COMP}, - {"COMPACT", TK_COMPACT}, - {"CONNS", TK_CONNS}, - {"CONNECTION", TK_CONNECTION}, - {"CONNECTIONS", TK_CONNECTIONS}, - {"CONSUMER", TK_CONSUMER}, - {"CONSUMERS", TK_CONSUMERS}, - {"CONTAINS", TK_CONTAINS}, - {"COUNT", TK_COUNT}, - {"CREATE", TK_CREATE}, - {"CURRENT_USER", TK_CURRENT_USER}, - {"DATABASE", TK_DATABASE}, - {"DATABASES", TK_DATABASES}, - {"DBS", TK_DBS}, - {"DELETE", TK_DELETE}, - {"DESC", TK_DESC}, - {"DESCRIBE", TK_DESCRIBE}, - {"DISTINCT", TK_DISTINCT}, - {"DISTRIBUTED", TK_DISTRIBUTED}, - {"DNODE", TK_DNODE}, - {"DNODES", TK_DNODES}, - {"DOUBLE", TK_DOUBLE}, - {"DROP", TK_DROP}, - {"DURATION", TK_DURATION}, - {"ENABLE", TK_ENABLE}, - {"EXISTS", TK_EXISTS}, - {"EXPIRED", TK_EXPIRED}, - {"EXPLAIN", TK_EXPLAIN}, - {"EVERY", TK_EVERY}, - {"FILE", TK_FILE}, - {"FILL", TK_FILL}, - {"FIRST", TK_FIRST}, - {"FLOAT", TK_FLOAT}, - {"FLUSH", TK_FLUSH}, - {"FROM", TK_FROM}, - {"FSYNC", TK_FSYNC}, - {"FUNCTION", TK_FUNCTION}, - {"FUNCTIONS", TK_FUNCTIONS}, - {"GRANT", TK_GRANT}, - {"GRANTS", TK_GRANTS}, - {"GROUP", TK_GROUP}, - {"HAVING", TK_HAVING}, - {"IF", TK_IF}, - {"IGNORE", TK_IGNORE}, - {"IMPORT", TK_IMPORT}, - {"IN", TK_IN}, - {"INDEX", TK_INDEX}, - {"INDEXES", TK_INDEXES}, - {"INNER", TK_INNER}, - {"INT", TK_INT}, - {"INSERT", TK_INSERT}, - {"INTEGER", TK_INTEGER}, - {"INTERVAL", TK_INTERVAL}, - {"INTO", TK_INTO}, - {"IS", TK_IS}, - {"JOIN", TK_JOIN}, - {"JSON", TK_JSON}, - {"KEEP", TK_KEEP}, - {"KILL", TK_KILL}, - {"LAST", TK_LAST}, - {"LAST_ROW", TK_LAST_ROW}, - {"LICENCE", TK_LICENCE}, - {"LIKE", TK_LIKE}, - {"LIMIT", TK_LIMIT}, - {"LINEAR", TK_LINEAR}, - {"LOCAL", TK_LOCAL}, - {"MATCH", TK_MATCH}, - {"MAXROWS", TK_MAXROWS}, - {"MAX_DELAY", TK_MAX_DELAY}, - {"MERGE", TK_MERGE}, - {"META", TK_META}, - {"MINROWS", TK_MINROWS}, - {"MINUS", TK_MINUS}, - {"MNODE", TK_MNODE}, - {"MNODES", TK_MNODES}, - {"MODIFY", TK_MODIFY}, - {"MODULES", TK_MODULES}, - {"NCHAR", TK_NCHAR}, - {"NEXT", TK_NEXT}, - {"NMATCH", TK_NMATCH}, - {"NONE", TK_NONE}, - {"NOT", TK_NOT}, - {"NOW", TK_NOW}, - {"NULL", TK_NULL}, - {"NULLS", TK_NULLS}, - {"OFFSET", TK_OFFSET}, - {"ON", TK_ON}, - {"OR", TK_OR}, - {"ORDER", TK_ORDER}, - {"OUTPUTTYPE", TK_OUTPUTTYPE}, - {"PARTITION", TK_PARTITION}, - {"PASS", TK_PASS}, - {"PAGES", TK_PAGES}, - {"PAGESIZE", TK_PAGESIZE}, - {"PORT", TK_PORT}, - {"PPS", TK_PPS}, - {"PRECISION", TK_PRECISION}, - // {"PRIVILEGE", TK_PRIVILEGE}, - {"PREV", TK_PREV}, - {"QNODE", TK_QNODE}, - {"QNODES", TK_QNODES}, - {"QTIME", TK_QTIME}, - {"QUERIES", TK_QUERIES}, - {"QUERY", TK_QUERY}, - {"RANGE", TK_RANGE}, - {"RATIO", TK_RATIO}, - {"READ", TK_READ}, - {"REDISTRIBUTE", TK_REDISTRIBUTE}, - {"RENAME", TK_RENAME}, - {"REPLICA", TK_REPLICA}, - {"RESET", TK_RESET}, - {"RETENTIONS", TK_RETENTIONS}, - {"REVOKE", TK_REVOKE}, - {"ROLLUP", TK_ROLLUP}, - {"SCHEMALESS", TK_SCHEMALESS}, - {"SCORES", TK_SCORES}, - {"SELECT", TK_SELECT}, - {"SERVER_STATUS", TK_SERVER_STATUS}, - {"SERVER_VERSION", TK_SERVER_VERSION}, - {"SESSION", TK_SESSION}, - {"SET", TK_SET}, - {"SHOW", TK_SHOW}, - {"SINGLE_STABLE", TK_SINGLE_STABLE}, - {"SLIDING", TK_SLIDING}, - {"SLIMIT", TK_SLIMIT}, - {"SMA", TK_SMA}, - {"SMALLINT", TK_SMALLINT}, - {"SNODE", TK_SNODE}, - {"SNODES", TK_SNODES}, - {"SOFFSET", TK_SOFFSET}, - {"SPLIT", TK_SPLIT}, - {"STABLE", TK_STABLE}, - {"STABLES", TK_STABLES}, - {"STATE", TK_STATE}, - {"STATE_WINDOW", TK_STATE_WINDOW}, - {"STORAGE", TK_STORAGE}, - {"STREAM", TK_STREAM}, - {"STREAMS", TK_STREAMS}, - {"STRICT", TK_STRICT}, - {"SUBSCRIPTIONS", TK_SUBSCRIPTIONS}, - {"SYNCDB", TK_SYNCDB}, - {"SYSINFO", TK_SYSINFO}, - {"TABLE", TK_TABLE}, - {"TABLES", TK_TABLES}, - {"TAG", TK_TAG}, - {"TAGS", TK_TAGS}, - {"TBNAME", TK_TBNAME}, - {"TIMESTAMP", TK_TIMESTAMP}, - {"TIMEZONE", TK_TIMEZONE}, - {"TINYINT", TK_TINYINT}, - {"TO", TK_TO}, - {"TODAY", TK_TODAY}, - {"TOPIC", TK_TOPIC}, - {"TOPICS", TK_TOPICS}, - {"TRANSACTION", TK_TRANSACTION}, - {"TRANSACTIONS", TK_TRANSACTIONS}, - {"TRIGGER", TK_TRIGGER}, - {"TRIM", TK_TRIM}, - {"TSERIES", TK_TSERIES}, - {"TTL", TK_TTL}, - {"UNION", TK_UNION}, - {"UNSIGNED", TK_UNSIGNED}, - {"USE", TK_USE}, - {"USER", TK_USER}, - {"USERS", TK_USERS}, - {"USING", TK_USING}, - {"VALUE", TK_VALUE}, - {"VALUES", TK_VALUES}, - {"VARCHAR", TK_VARCHAR}, - {"VARIABLES", TK_VARIABLES}, - {"VERBOSE", TK_VERBOSE}, - {"VGROUP", TK_VGROUP}, - {"VGROUPS", TK_VGROUPS}, - {"VNODES", TK_VNODES}, - {"WAL", TK_WAL}, + {"ACCOUNT", TK_ACCOUNT}, + {"ACCOUNTS", TK_ACCOUNTS}, + {"ADD", TK_ADD}, + {"AGGREGATE", TK_AGGREGATE}, + {"ALL", TK_ALL}, + {"ALTER", TK_ALTER}, + {"ANALYZE", TK_ANALYZE}, + {"AND", TK_AND}, + {"APPS", TK_APPS}, + {"AS", TK_AS}, + {"ASC", TK_ASC}, + {"AT_ONCE", TK_AT_ONCE}, + {"BALANCE", TK_BALANCE}, + {"BETWEEN", TK_BETWEEN}, + {"BINARY", TK_BINARY}, + {"BIGINT", TK_BIGINT}, + {"BNODE", TK_BNODE}, + {"BNODES", TK_BNODES}, + {"BOOL", TK_BOOL}, + {"BUFFER", TK_BUFFER}, + {"BUFSIZE", TK_BUFSIZE}, + {"BY", TK_BY}, + {"CACHE", TK_CACHE}, + {"CACHEMODEL", TK_CACHEMODEL}, + {"CACHESIZE", TK_CACHESIZE}, + {"CAST", TK_CAST}, + {"CLIENT_VERSION", TK_CLIENT_VERSION}, + {"CLUSTER", TK_CLUSTER}, + {"COLUMN", TK_COLUMN}, + {"COMMENT", TK_COMMENT}, + {"COMP", TK_COMP}, + {"CONNS", TK_CONNS}, + {"CONNECTION", TK_CONNECTION}, + {"CONNECTIONS", TK_CONNECTIONS}, + {"CONSUMER", TK_CONSUMER}, + {"CONSUMERS", TK_CONSUMERS}, + {"CONTAINS", TK_CONTAINS}, + {"COUNT", TK_COUNT}, + {"CREATE", TK_CREATE}, + {"CURRENT_USER", TK_CURRENT_USER}, + {"DATABASE", TK_DATABASE}, + {"DATABASES", TK_DATABASES}, + {"DBS", TK_DBS}, + {"DELETE", TK_DELETE}, + {"DESC", TK_DESC}, + {"DESCRIBE", TK_DESCRIBE}, + {"DISTINCT", TK_DISTINCT}, + {"DISTRIBUTED", TK_DISTRIBUTED}, + {"DNODE", TK_DNODE}, + {"DNODES", TK_DNODES}, + {"DOUBLE", TK_DOUBLE}, + {"DROP", TK_DROP}, + {"DURATION", TK_DURATION}, + {"ENABLE", TK_ENABLE}, + {"EXISTS", TK_EXISTS}, + {"EXPIRED", TK_EXPIRED}, + {"EXPLAIN", TK_EXPLAIN}, + {"EVERY", TK_EVERY}, + {"FILE", TK_FILE}, + {"FILL", TK_FILL}, + {"FIRST", TK_FIRST}, + {"FLOAT", TK_FLOAT}, + {"FLUSH", TK_FLUSH}, + {"FROM", TK_FROM}, + {"FUNCTION", TK_FUNCTION}, + {"FUNCTIONS", TK_FUNCTIONS}, + {"GRANT", TK_GRANT}, + {"GRANTS", TK_GRANTS}, + {"GROUP", TK_GROUP}, + {"HAVING", TK_HAVING}, + {"IF", TK_IF}, + {"IGNORE", TK_IGNORE}, + {"IMPORT", TK_IMPORT}, + {"IN", TK_IN}, + {"INDEX", TK_INDEX}, + {"INDEXES", TK_INDEXES}, + {"INNER", TK_INNER}, + {"INT", TK_INT}, + {"INSERT", TK_INSERT}, + {"INTEGER", TK_INTEGER}, + {"INTERVAL", TK_INTERVAL}, + {"INTO", TK_INTO}, + {"IS", TK_IS}, + {"JOIN", TK_JOIN}, + {"JSON", TK_JSON}, + {"KEEP", TK_KEEP}, + {"KILL", TK_KILL}, + {"LAST", TK_LAST}, + {"LAST_ROW", TK_LAST_ROW}, + {"LICENCE", TK_LICENCE}, + {"LIKE", TK_LIKE}, + {"LIMIT", TK_LIMIT}, + {"LINEAR", TK_LINEAR}, + {"LOCAL", TK_LOCAL}, + {"MATCH", TK_MATCH}, + {"MAXROWS", TK_MAXROWS}, + {"MAX_DELAY", TK_MAX_DELAY}, + {"MERGE", TK_MERGE}, + {"META", TK_META}, + {"MINROWS", TK_MINROWS}, + {"MINUS", TK_MINUS}, + {"MNODE", TK_MNODE}, + {"MNODES", TK_MNODES}, + {"MODIFY", TK_MODIFY}, + {"MODULES", TK_MODULES}, + {"NCHAR", TK_NCHAR}, + {"NEXT", TK_NEXT}, + {"NMATCH", TK_NMATCH}, + {"NONE", TK_NONE}, + {"NOT", TK_NOT}, + {"NOW", TK_NOW}, + {"NULL", TK_NULL}, + {"NULLS", TK_NULLS}, + {"OFFSET", TK_OFFSET}, + {"ON", TK_ON}, + {"OR", TK_OR}, + {"ORDER", TK_ORDER}, + {"OUTPUTTYPE", TK_OUTPUTTYPE}, + {"PARTITION", TK_PARTITION}, + {"PASS", TK_PASS}, + {"PAGES", TK_PAGES}, + {"PAGESIZE", TK_PAGESIZE}, + {"PORT", TK_PORT}, + {"PPS", TK_PPS}, + {"PRECISION", TK_PRECISION}, + {"PREV", TK_PREV}, + {"QNODE", TK_QNODE}, + {"QNODES", TK_QNODES}, + {"QTIME", TK_QTIME}, + {"QUERIES", TK_QUERIES}, + {"QUERY", TK_QUERY}, + {"RANGE", TK_RANGE}, + {"RATIO", TK_RATIO}, + {"READ", TK_READ}, + {"REDISTRIBUTE", TK_REDISTRIBUTE}, + {"RENAME", TK_RENAME}, + {"REPLICA", TK_REPLICA}, + {"RESET", TK_RESET}, + {"RETENTIONS", TK_RETENTIONS}, + {"REVOKE", TK_REVOKE}, + {"ROLLUP", TK_ROLLUP}, + {"SCHEMALESS", TK_SCHEMALESS}, + {"SCORES", TK_SCORES}, + {"SELECT", TK_SELECT}, + {"SERVER_STATUS", TK_SERVER_STATUS}, + {"SERVER_VERSION", TK_SERVER_VERSION}, + {"SESSION", TK_SESSION}, + {"SET", TK_SET}, + {"SHOW", TK_SHOW}, + {"SINGLE_STABLE", TK_SINGLE_STABLE}, + {"SLIDING", TK_SLIDING}, + {"SLIMIT", TK_SLIMIT}, + {"SMA", TK_SMA}, + {"SMALLINT", TK_SMALLINT}, + {"SNODE", TK_SNODE}, + {"SNODES", TK_SNODES}, + {"SOFFSET", TK_SOFFSET}, + {"SPLIT", TK_SPLIT}, + {"STABLE", TK_STABLE}, + {"STABLES", TK_STABLES}, + {"STATE", TK_STATE}, + {"STATE_WINDOW", TK_STATE_WINDOW}, + {"STORAGE", TK_STORAGE}, + {"STREAM", TK_STREAM}, + {"STREAMS", TK_STREAMS}, + {"STRICT", TK_STRICT}, + {"SUBSCRIPTIONS", TK_SUBSCRIPTIONS}, + {"SYSINFO", TK_SYSINFO}, + {"TABLE", TK_TABLE}, + {"TABLES", TK_TABLES}, + {"TAG", TK_TAG}, + {"TAGS", TK_TAGS}, + {"TBNAME", TK_TBNAME}, + {"TIMESTAMP", TK_TIMESTAMP}, + {"TIMEZONE", TK_TIMEZONE}, + {"TINYINT", TK_TINYINT}, + {"TO", TK_TO}, + {"TODAY", TK_TODAY}, + {"TOPIC", TK_TOPIC}, + {"TOPICS", TK_TOPICS}, + {"TRANSACTION", TK_TRANSACTION}, + {"TRANSACTIONS", TK_TRANSACTIONS}, + {"TRIGGER", TK_TRIGGER}, + {"TRIM", TK_TRIM}, + {"TSERIES", TK_TSERIES}, + {"TTL", TK_TTL}, + {"UNION", TK_UNION}, + {"UNSIGNED", TK_UNSIGNED}, + {"USE", TK_USE}, + {"USER", TK_USER}, + {"USERS", TK_USERS}, + {"USING", TK_USING}, + {"VALUE", TK_VALUE}, + {"VALUES", TK_VALUES}, + {"VARCHAR", TK_VARCHAR}, + {"VARIABLES", TK_VARIABLES}, + {"VERBOSE", TK_VERBOSE}, + {"VGROUP", TK_VGROUP}, + {"VGROUPS", TK_VGROUPS}, + {"WAL_FSYNC_PERIOD", TK_WAL_FSYNC_PERIOD}, + {"WAL_LEVEL", TK_WAL_LEVEL}, {"WAL_RETENTION_PERIOD", TK_WAL_RETENTION_PERIOD}, {"WAL_RETENTION_SIZE", TK_WAL_RETENTION_SIZE}, {"WAL_ROLL_PERIOD", TK_WAL_ROLL_PERIOD}, {"WAL_SEGMENT_SIZE", TK_WAL_SEGMENT_SIZE}, - {"WATERMARK", TK_WATERMARK}, - {"WHERE", TK_WHERE}, - {"WINDOW_CLOSE", TK_WINDOW_CLOSE}, - {"WITH", TK_WITH}, - {"WRITE", TK_WRITE}, - {"_C0", TK_ROWTS}, - {"_QDURATION", TK_QDURATION}, - {"_QEND", TK_QEND}, - {"_QSTART", TK_QSTART}, - {"_ROWTS", TK_ROWTS}, - {"_WDURATION", TK_WDURATION}, - {"_WEND", TK_WEND}, - {"_WSTART", TK_WSTART}, - // {"ID", TK_ID}, - // {"STRING", TK_STRING}, - // {"EQ", TK_EQ}, - // {"NE", TK_NE}, - // {"ISNULL", TK_ISNULL}, - // {"NOTNULL", TK_NOTNULL}, - // {"GLOB", TK_GLOB}, - // {"GT", TK_GT}, - // {"GE", TK_GE}, - // {"LT", TK_LT}, - // {"LE", TK_LE}, - // {"BITAND", TK_BITAND}, - // {"BITOR", TK_BITOR}, - // {"LSHIFT", TK_LSHIFT}, - // {"RSHIFT", TK_RSHIFT}, - // {"PLUS", TK_PLUS}, - // {"DIVIDE", TK_DIVIDE}, - // {"TIMES", TK_TIMES}, - // {"STAR", TK_STAR}, - // {"SLASH", TK_SLASH}, - // {"REM ", TK_REM}, - // {"||", TK_CONCAT}, - // {"UMINUS", TK_UMINUS}, - // {"UPLUS", TK_UPLUS}, - // {"BITNOT", TK_BITNOT}, - // {"DOT", TK_DOT}, - // {"CTIME", TK_CTIME}, - // {"LP", TK_LP}, - // {"RP", TK_RP}, - // {"COMMA", TK_COMMA}, - // {"VARIABLE", TK_VARIABLE}, - // {"UPDATE", TK_UPDATE}, - // {"CHANGE", TK_CHANGE}, - // {"COLON", TK_COLON}, - // {"ABORT", TK_ABORT}, - // {"AFTER", TK_AFTER}, - // {"ATTACH", TK_ATTACH}, - // {"BEFORE", TK_BEFORE}, - // {"BEGIN", TK_BEGIN}, - // {"CASCADE", TK_CASCADE}, - // {"CONFLICT", TK_CONFLICT}, - // {"COPY", TK_COPY}, - // {"DEFERRED", TK_DEFERRED}, - // {"DELIMITERS", TK_DELIMITERS}, - // {"DETACH", TK_DETACH}, - // {"EACH", TK_EACH}, - // {"END", TK_END}, - // {"FAIL", TK_FAIL}, - // {"FOR", TK_FOR}, - // {"IMMEDIATE", TK_IMMEDIATE}, - // {"INITIALLY", TK_INITIALLY}, - // {"INSTEAD", TK_INSTEAD}, - // {"KEY", TK_KEY}, - // {"OF", TK_OF}, - // {"RAISE", TK_RAISE}, - // {"REPLACE", TK_REPLACE}, - // {"RESTRICT", TK_RESTRICT}, - // {"ROW", TK_ROW}, - // {"STATEMENT", TK_STATEMENT}, - // {"VIEW", TK_VIEW}, - // {"SEMI", TK_SEMI}, - // {"PARTITIONS", TK_PARTITIONS}, - // {"MODE", TK_MODE}, + {"WATERMARK", TK_WATERMARK}, + {"WHERE", TK_WHERE}, + {"WINDOW_CLOSE", TK_WINDOW_CLOSE}, + {"WITH", TK_WITH}, + {"WRITE", TK_WRITE}, + {"_C0", TK_ROWTS}, + {"_QDURATION", TK_QDURATION}, + {"_QEND", TK_QEND}, + {"_QSTART", TK_QSTART}, + {"_ROWTS", TK_ROWTS}, + {"_WDURATION", TK_WDURATION}, + {"_WEND", TK_WEND}, + {"_WSTART", TK_WSTART}, }; // clang-format on diff --git a/source/libs/parser/src/parTranslater.c b/source/libs/parser/src/parTranslater.c index 1424a522c4..5cba920a43 100644 --- a/source/libs/parser/src/parTranslater.c +++ b/source/libs/parser/src/parTranslater.c @@ -39,6 +39,7 @@ typedef struct STranslateContext { SCmdMsgInfo* pCmdMsg; SHashObj* pDbs; SHashObj* pTables; + SHashObj* pTargetTables; SExplainOptions* pExplainOpt; SParseMetaCache* pMetaCache; bool createStream; @@ -89,10 +90,10 @@ static int32_t collectUseDatabase(const SName* pName, SHashObj* pDbs) { return collectUseDatabaseImpl(dbFName, pDbs); } -static int32_t collectUseTable(const SName* pName, SHashObj* pDbs) { +static int32_t collectUseTable(const SName* pName, SHashObj* pTable) { char fullName[TSDB_TABLE_FNAME_LEN]; tNameExtractFullName(pName, fullName); - return taosHashPut(pDbs, fullName, strlen(fullName), pName, sizeof(SName)); + return taosHashPut(pTable, fullName, strlen(fullName), pName, sizeof(SName)); } static int32_t getTableMetaImpl(STranslateContext* pCxt, const SName* pName, STableMeta** pMeta) { @@ -357,7 +358,8 @@ static int32_t initTranslateContext(SParseContext* pParseCxt, SParseMetaCache* p pCxt->pMetaCache = pMetaCache; pCxt->pDbs = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); pCxt->pTables = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); - if (NULL == pCxt->pNsLevel || NULL == pCxt->pDbs || NULL == pCxt->pTables) { + pCxt->pTargetTables = taosHashInit(4, taosGetDefaultHashFunction(TSDB_DATA_TYPE_BINARY), true, HASH_NO_LOCK); + if (NULL == pCxt->pNsLevel || NULL == pCxt->pDbs || NULL == pCxt->pTables || NULL == pCxt->pTargetTables) { return TSDB_CODE_OUT_OF_MEMORY; } return TSDB_CODE_SUCCESS; @@ -3188,7 +3190,8 @@ static int32_t checkOptionsDependency(STranslateContext* pCxt, const char* pDbNa daysToKeep0 = (-1 == daysToKeep0 ? dbCfg.daysToKeep0 : daysToKeep0); } if (daysPerFile > daysToKeep0) { - return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DAYS_VALUE); + return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_DB_OPTION, + "Invalid duration value, should be keep2 >= keep1 >= keep0 >= duration"); } return TSDB_CODE_SUCCESS; } @@ -3933,6 +3936,9 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm SName tableName; tNameExtractFullName(toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName), pReq->name); int32_t code = collectUseTable(&tableName, pCxt->pTables); + if (TSDB_CODE_SUCCESS == code) { + code = collectUseTable(&tableName, pCxt->pTargetTables); + } if (TSDB_CODE_SUCCESS == code) { code = buildRollupAst(pCxt, pStmt, pReq); } @@ -3953,11 +3959,14 @@ static int32_t translateCreateSuperTable(STranslateContext* pCxt, SCreateTableSt } static int32_t doTranslateDropSuperTable(STranslateContext* pCxt, const SName* pTableName, bool ignoreNotExists) { - SMDropStbReq dropReq = {0}; - tNameExtractFullName(pTableName, dropReq.name); - dropReq.igNotExists = ignoreNotExists; - - return buildCmdMsg(pCxt, TDMT_MND_DROP_STB, (FSerializeFunc)tSerializeSMDropStbReq, &dropReq); + int32_t code = collectUseTable(pTableName, pCxt->pTargetTables); + if (TSDB_CODE_SUCCESS == code) { + SMDropStbReq dropReq = {0}; + tNameExtractFullName(pTableName, dropReq.name); + dropReq.igNotExists = ignoreNotExists; + code = buildCmdMsg(pCxt, TDMT_MND_DROP_STB, (FSerializeFunc)tSerializeSMDropStbReq, &dropReq); + } + return code; } static int32_t translateDropTable(STranslateContext* pCxt, SDropTableStmt* pStmt) { @@ -5559,8 +5568,13 @@ static int32_t rewriteCreateTable(STranslateContext* pCxt, SQuery* pQuery) { int32_t code = checkCreateTable(pCxt, pStmt, false); SVgroupInfo info = {0}; + SName name; + toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name); if (TSDB_CODE_SUCCESS == code) { - code = getTableHashVgroup(pCxt, pStmt->dbName, pStmt->tableName, &info); + code = getTableHashVgroupImpl(pCxt, &name, &info); + } + if (TSDB_CODE_SUCCESS == code) { + code = collectUseTable(&name, pCxt->pTargetTables); } SArray* pBufArray = NULL; if (TSDB_CODE_SUCCESS == code) { @@ -5829,6 +5843,11 @@ static int32_t rewriteCreateSubTable(STranslateContext* pCxt, SCreateSubTableCla if (TSDB_CODE_SUCCESS == code) { code = getTableMeta(pCxt, pStmt->useDbName, pStmt->useTableName, &pSuperTableMeta); } + if (TSDB_CODE_SUCCESS == code) { + SName name; + toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &name); + code = collectUseTable(&name, pCxt->pTargetTables); + } STag* pTag = NULL; SArray* tagName = taosArrayInit(8, TSDB_COL_NAME_LEN); @@ -5927,8 +5946,13 @@ static void addDropTbReqIntoVgroup(SHashObj* pVgroupHashmap, SDropTableClause* p static int32_t buildDropTableVgroupHashmap(STranslateContext* pCxt, SDropTableClause* pClause, bool* pIsSuperTable, SHashObj* pVgroupHashmap) { + SName name; + toName(pCxt->pParseCxt->acctId, pClause->dbName, pClause->tableName, &name); STableMeta* pTableMeta = NULL; - int32_t code = getTableMeta(pCxt, pClause->dbName, pClause->tableName, &pTableMeta); + int32_t code = getTableMetaImpl(pCxt, &name, &pTableMeta); + if (TSDB_CODE_SUCCESS == code) { + code = collectUseTable(&name, pCxt->pTargetTables); + } if (TSDB_CODE_SUCCESS == code && TSDB_SUPER_TABLE == pTableMeta->tableType) { *pIsSuperTable = true; @@ -6509,6 +6533,20 @@ static int32_t setRefreshMate(STranslateContext* pCxt, SQuery* pQuery) { pTable = taosHashIterate(pCxt->pTables, pTable); } } + + if (NULL != pCxt->pTargetTables) { + taosArrayDestroy(pQuery->pTargetTableList); + pQuery->pTargetTableList = taosArrayInit(taosHashGetSize(pCxt->pTargetTables), sizeof(SName)); + if (NULL == pQuery->pTargetTableList) { + return TSDB_CODE_OUT_OF_MEMORY; + } + SName* pTable = taosHashIterate(pCxt->pTargetTables, NULL); + while (NULL != pTable) { + taosArrayPush(pQuery->pTargetTableList, pTable); + pTable = taosHashIterate(pCxt->pTargetTables, pTable); + } + } + return TSDB_CODE_SUCCESS; } diff --git a/source/libs/parser/src/parUtil.c b/source/libs/parser/src/parUtil.c index 7c9a8b10dd..79d6f3b8e8 100644 --- a/source/libs/parser/src/parUtil.c +++ b/source/libs/parser/src/parUtil.c @@ -99,8 +99,6 @@ static char* getSyntaxErrFormat(int32_t errCode) { return "Query block has incorrect number of result columns"; case TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL: return "Incorrect TIMESTAMP value: %s"; - case TSDB_CODE_PAR_INVALID_DAYS_VALUE: - return "Invalid days value, should be keep2 >= keep1 >= keep0 >= days"; case TSDB_CODE_PAR_OFFSET_LESS_ZERO: return "soffset/offset can not be less than 0"; case TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_BY: diff --git a/source/libs/parser/src/sql.c b/source/libs/parser/src/sql.c index 7bac546298..af5a51a903 100644 --- a/source/libs/parser/src/sql.c +++ b/source/libs/parser/src/sql.c @@ -104,26 +104,26 @@ #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 383 +#define YYNOCODE 380 #define YYACTIONTYPE unsigned short int #define ParseTOKENTYPE SToken typedef union { int yyinit; ParseTOKENTYPE yy0; - int64_t yy59; - SNode* yy160; - SNodeList* yy180; - SAlterOption yy189; - SDataType yy190; - SToken yy231; - ENullOrder yy283; - EFillMode yy338; - int8_t yy425; - int32_t yy516; - EOperatorType yy598; - bool yy611; - EJoinType yy652; - EOrder yy742; + EOperatorType yy60; + EFillMode yy94; + SToken yy129; + SDataType yy184; + bool yy337; + ENullOrder yy338; + SAlterOption yy405; + SNodeList* yy464; + int32_t yy500; + EJoinType yy532; + int8_t yy543; + int64_t yy549; + EOrder yy658; + SNode* yy712; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -139,17 +139,17 @@ typedef union { #define ParseCTX_FETCH #define ParseCTX_STORE #define YYFALLBACK 1 -#define YYNSTATE 675 -#define YYNRULE 494 -#define YYNTOKEN 260 -#define YY_MAX_SHIFT 674 -#define YY_MIN_SHIFTREDUCE 982 -#define YY_MAX_SHIFTREDUCE 1475 -#define YY_ERROR_ACTION 1476 -#define YY_ACCEPT_ACTION 1477 -#define YY_NO_ACTION 1478 -#define YY_MIN_REDUCE 1479 -#define YY_MAX_REDUCE 1972 +#define YYNSTATE 666 +#define YYNRULE 492 +#define YYNTOKEN 257 +#define YY_MAX_SHIFT 665 +#define YY_MIN_SHIFTREDUCE 973 +#define YY_MAX_SHIFTREDUCE 1464 +#define YY_ERROR_ACTION 1465 +#define YY_ACCEPT_ACTION 1466 +#define YY_NO_ACTION 1467 +#define YY_MIN_REDUCE 1468 +#define YY_MAX_REDUCE 1959 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -216,696 +216,664 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2541) +#define YY_ACTTAB_COUNT (2395) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 442, 1950, 443, 1514, 1720, 64, 1610, 329, 450, 557, - /* 10 */ 443, 1514, 39, 37, 1949, 143, 1502, 1789, 1947, 1950, - /* 20 */ 342, 1480, 1275, 522, 1621, 40, 38, 36, 35, 34, - /* 30 */ 1806, 328, 163, 1352, 1717, 1273, 1947, 124, 1301, 1032, - /* 40 */ 1015, 1031, 104, 1785, 1791, 103, 102, 101, 100, 99, - /* 50 */ 98, 97, 96, 95, 447, 579, 1347, 1775, 1824, 347, - /* 60 */ 1298, 14, 1664, 1666, 393, 88, 586, 1501, 1281, 1033, - /* 70 */ 1032, 1775, 1031, 585, 39, 37, 1415, 122, 121, 143, - /* 80 */ 1019, 1020, 342, 1541, 1275, 478, 1611, 562, 1622, 1, - /* 90 */ 63, 559, 158, 1892, 1893, 1352, 1897, 1273, 1838, 534, - /* 100 */ 1033, 305, 91, 1807, 588, 1809, 1810, 584, 1775, 579, - /* 110 */ 55, 671, 1884, 36, 35, 34, 308, 1880, 1347, 459, - /* 120 */ 560, 30, 263, 14, 560, 1354, 1355, 1619, 1950, 104, - /* 130 */ 1281, 211, 103, 102, 101, 100, 99, 98, 97, 96, - /* 140 */ 95, 164, 560, 1170, 1171, 1947, 648, 647, 646, 645, - /* 150 */ 352, 2, 644, 643, 642, 125, 637, 636, 635, 634, - /* 160 */ 633, 632, 631, 630, 136, 626, 351, 350, 623, 622, - /* 170 */ 1276, 1899, 1274, 671, 224, 225, 147, 33, 32, 1950, - /* 180 */ 1579, 40, 38, 36, 35, 34, 1300, 1354, 1355, 43, - /* 190 */ 75, 307, 1948, 42, 524, 1896, 1947, 1279, 1280, 387, - /* 200 */ 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, 581, 577, - /* 210 */ 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, 1479, 63, - /* 220 */ 33, 32, 1597, 218, 40, 38, 36, 35, 34, 73, - /* 230 */ 165, 165, 1276, 1595, 1274, 307, 11, 10, 524, 1275, - /* 240 */ 1950, 428, 113, 112, 111, 110, 109, 108, 107, 106, - /* 250 */ 105, 1615, 1273, 162, 1436, 63, 63, 1947, 77, 1279, - /* 260 */ 1280, 378, 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, - /* 270 */ 581, 577, 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, - /* 280 */ 39, 37, 459, 380, 376, 1281, 617, 1824, 342, 1662, - /* 290 */ 1275, 177, 176, 621, 1806, 550, 543, 1434, 1435, 1437, - /* 300 */ 1438, 1352, 1446, 1273, 1128, 610, 609, 608, 1132, 607, - /* 310 */ 1134, 1135, 606, 1137, 603, 345, 1143, 600, 1145, 1146, - /* 320 */ 597, 594, 1824, 143, 1347, 1388, 546, 534, 671, 14, - /* 330 */ 586, 1472, 1621, 549, 165, 1775, 1281, 585, 167, 1301, - /* 340 */ 33, 32, 39, 37, 40, 38, 36, 35, 34, 557, - /* 350 */ 342, 562, 1275, 1302, 521, 1619, 145, 2, 1491, 1300, - /* 360 */ 165, 81, 1838, 1352, 63, 1273, 91, 1807, 588, 1809, - /* 370 */ 1810, 584, 534, 579, 534, 1806, 1884, 124, 173, 671, - /* 380 */ 308, 1880, 1612, 391, 49, 392, 1347, 1276, 1794, 1274, - /* 390 */ 1665, 1666, 1950, 1354, 1355, 1950, 165, 165, 1281, 1789, - /* 400 */ 1619, 223, 1619, 1824, 1500, 162, 552, 547, 162, 1947, - /* 410 */ 71, 586, 1947, 70, 1279, 1280, 1775, 122, 585, 8, - /* 420 */ 1090, 1471, 1426, 33, 32, 1785, 1791, 40, 38, 36, - /* 430 */ 35, 34, 159, 1892, 1893, 1899, 1897, 579, 1276, 618, - /* 440 */ 1274, 671, 1662, 1838, 386, 1775, 385, 93, 1807, 588, - /* 450 */ 1809, 1810, 584, 1092, 579, 1354, 1355, 1884, 22, 1895, - /* 460 */ 1499, 1883, 1880, 1254, 1255, 1279, 1280, 1531, 1329, 1330, - /* 470 */ 1332, 1333, 1334, 1335, 1336, 1337, 581, 577, 1345, 1346, - /* 480 */ 1348, 1349, 1350, 1351, 1353, 1356, 534, 33, 32, 492, - /* 490 */ 255, 40, 38, 36, 35, 34, 1716, 398, 302, 197, - /* 500 */ 1276, 1775, 1274, 33, 32, 165, 566, 40, 38, 36, - /* 510 */ 35, 34, 441, 149, 1619, 445, 488, 487, 476, 472, - /* 520 */ 468, 464, 196, 1806, 1715, 165, 302, 1279, 1280, 355, - /* 530 */ 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, 581, 577, - /* 540 */ 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, 39, 37, - /* 550 */ 1357, 1824, 1498, 304, 74, 1298, 342, 194, 1275, 561, - /* 560 */ 165, 1710, 421, 1412, 1775, 433, 585, 26, 551, 1352, - /* 570 */ 1950, 1273, 172, 33, 32, 505, 1497, 40, 38, 36, - /* 580 */ 35, 34, 406, 162, 434, 1314, 408, 1947, 503, 1496, - /* 590 */ 501, 1838, 1347, 1775, 156, 92, 1807, 588, 1809, 1810, - /* 600 */ 584, 1793, 579, 522, 1281, 1884, 1596, 1658, 1299, 333, - /* 610 */ 1880, 157, 1789, 534, 1718, 1495, 1806, 1775, 534, 193, - /* 620 */ 186, 534, 191, 399, 413, 9, 455, 1671, 1376, 414, - /* 630 */ 1775, 1911, 458, 575, 314, 395, 142, 534, 1785, 1791, - /* 640 */ 331, 1619, 1710, 1669, 1824, 184, 1619, 671, 114, 1619, - /* 650 */ 579, 1381, 586, 175, 1419, 480, 1775, 1775, 1594, 585, - /* 660 */ 1300, 1354, 1355, 432, 1494, 1619, 427, 426, 425, 424, - /* 670 */ 423, 420, 419, 418, 417, 416, 412, 411, 410, 409, - /* 680 */ 403, 402, 401, 400, 1838, 397, 396, 73, 92, 1807, - /* 690 */ 588, 1809, 1810, 584, 27, 579, 449, 1950, 1884, 445, - /* 700 */ 119, 1671, 333, 1880, 1963, 1775, 1276, 619, 1274, 1614, - /* 710 */ 163, 1899, 567, 1918, 1947, 33, 32, 1670, 61, 40, - /* 720 */ 38, 36, 35, 34, 621, 1493, 134, 133, 616, 615, - /* 730 */ 614, 641, 639, 1279, 1280, 1894, 1329, 1330, 1332, 1333, - /* 740 */ 1334, 1335, 1336, 1337, 581, 577, 1345, 1346, 1348, 1349, - /* 750 */ 1350, 1351, 1353, 1356, 39, 37, 496, 348, 674, 619, - /* 760 */ 1671, 1490, 342, 1281, 1275, 143, 1775, 330, 309, 1366, - /* 770 */ 354, 506, 270, 1489, 1621, 1352, 1669, 1273, 134, 133, - /* 780 */ 616, 615, 614, 613, 1488, 210, 154, 629, 7, 1591, - /* 790 */ 1411, 664, 660, 656, 652, 268, 1793, 1314, 1347, 499, - /* 800 */ 319, 1806, 1775, 493, 534, 1374, 28, 1789, 209, 1487, - /* 810 */ 1281, 1950, 33, 32, 1775, 114, 40, 38, 36, 35, - /* 820 */ 34, 1486, 485, 557, 162, 1775, 1303, 89, 1947, 1824, - /* 830 */ 233, 9, 1619, 1785, 1791, 337, 1300, 561, 534, 628, - /* 840 */ 58, 1331, 1775, 57, 585, 579, 1362, 1019, 1020, 1616, - /* 850 */ 1775, 124, 1300, 671, 1671, 320, 132, 318, 317, 1375, - /* 860 */ 482, 346, 1775, 531, 484, 1608, 1619, 1354, 1355, 1838, - /* 870 */ 1669, 1904, 1408, 92, 1807, 588, 1809, 1810, 584, 1485, - /* 880 */ 579, 1477, 1380, 1884, 44, 4, 483, 333, 1880, 157, - /* 890 */ 569, 122, 33, 32, 534, 220, 40, 38, 36, 35, - /* 900 */ 34, 161, 1544, 54, 1604, 1749, 160, 1892, 1893, 1910, - /* 910 */ 1897, 1606, 1276, 1284, 1274, 484, 1246, 1602, 213, 214, - /* 920 */ 1775, 275, 1619, 1484, 1649, 29, 340, 1369, 1370, 1371, - /* 930 */ 1372, 1373, 1377, 1378, 1379, 1483, 1482, 483, 580, 1279, - /* 940 */ 1280, 357, 1329, 1330, 1332, 1333, 1334, 1335, 1336, 1337, - /* 950 */ 581, 577, 1345, 1346, 1348, 1349, 1350, 1351, 1353, 1356, - /* 960 */ 39, 37, 564, 235, 1775, 619, 491, 490, 342, 202, - /* 970 */ 1275, 489, 200, 507, 120, 1283, 1775, 1775, 1408, 1806, - /* 980 */ 486, 1352, 1950, 1273, 134, 133, 616, 615, 614, 1761, - /* 990 */ 612, 534, 491, 490, 640, 162, 1526, 489, 534, 1947, - /* 1000 */ 120, 534, 515, 1524, 1347, 217, 486, 1824, 204, 519, - /* 1010 */ 206, 203, 532, 205, 1950, 586, 1281, 1331, 494, 1619, - /* 1020 */ 1775, 534, 585, 144, 41, 497, 1619, 162, 281, 1619, - /* 1030 */ 222, 1947, 533, 1331, 514, 208, 366, 2, 207, 1492, - /* 1040 */ 76, 381, 279, 60, 53, 518, 59, 1838, 258, 1619, - /* 1050 */ 1287, 92, 1807, 588, 1809, 1810, 584, 534, 579, 671, - /* 1060 */ 128, 1884, 180, 438, 436, 333, 1880, 1963, 264, 534, - /* 1070 */ 131, 1222, 132, 1354, 1355, 51, 1941, 226, 544, 239, - /* 1080 */ 349, 11, 10, 33, 32, 1619, 51, 40, 38, 36, - /* 1090 */ 35, 34, 1474, 1475, 63, 41, 1796, 1619, 570, 87, - /* 1100 */ 41, 624, 1059, 625, 1580, 477, 508, 527, 247, 84, - /* 1110 */ 1825, 353, 1286, 1515, 1659, 1914, 558, 232, 1276, 1121, - /* 1120 */ 1274, 252, 1433, 1078, 592, 1076, 242, 131, 132, 116, - /* 1130 */ 131, 1520, 90, 1382, 257, 1060, 309, 260, 3, 1798, - /* 1140 */ 262, 5, 1338, 1298, 358, 1279, 1280, 274, 1329, 1330, - /* 1150 */ 1332, 1333, 1334, 1335, 1336, 1337, 581, 577, 1345, 1346, - /* 1160 */ 1348, 1349, 1350, 1351, 1353, 1356, 361, 68, 67, 390, - /* 1170 */ 1090, 1149, 171, 1374, 1153, 1160, 1158, 135, 384, 666, - /* 1180 */ 315, 365, 339, 338, 316, 271, 1238, 174, 394, 1806, - /* 1190 */ 415, 303, 1289, 1712, 374, 429, 372, 368, 364, 168, - /* 1200 */ 359, 356, 422, 1352, 435, 1282, 430, 431, 437, 439, - /* 1210 */ 1304, 440, 448, 1307, 451, 1306, 183, 1824, 452, 185, - /* 1220 */ 453, 557, 1308, 456, 454, 586, 1347, 1375, 188, 190, - /* 1230 */ 1775, 1305, 585, 457, 192, 165, 72, 460, 1281, 195, - /* 1240 */ 479, 115, 306, 481, 272, 212, 1609, 199, 1605, 124, - /* 1250 */ 1380, 201, 509, 137, 138, 510, 1607, 1838, 215, 1603, - /* 1260 */ 139, 92, 1807, 588, 1809, 1810, 584, 140, 579, 516, - /* 1270 */ 562, 1884, 520, 219, 542, 333, 1880, 1963, 1754, 1806, - /* 1280 */ 528, 574, 230, 523, 513, 228, 1903, 1753, 129, 122, - /* 1290 */ 325, 1620, 1722, 29, 340, 1369, 1370, 1371, 1372, 1373, - /* 1300 */ 1377, 1378, 1379, 525, 253, 1892, 556, 1824, 555, 130, - /* 1310 */ 327, 1950, 273, 80, 530, 586, 1303, 529, 1915, 538, - /* 1320 */ 1775, 545, 585, 237, 164, 1925, 540, 541, 1947, 1806, - /* 1330 */ 332, 536, 548, 6, 241, 554, 562, 539, 537, 1408, - /* 1340 */ 1290, 251, 1285, 123, 1302, 571, 1900, 1838, 568, 1924, - /* 1350 */ 1906, 288, 1807, 588, 1809, 1810, 584, 1824, 579, 246, - /* 1360 */ 151, 248, 249, 48, 334, 586, 82, 1293, 1295, 1663, - /* 1370 */ 1775, 250, 585, 1966, 590, 1592, 276, 1950, 1865, 577, - /* 1380 */ 1345, 1346, 1348, 1349, 1350, 1351, 562, 267, 1946, 667, - /* 1390 */ 164, 565, 52, 668, 1947, 670, 1806, 1838, 572, 278, - /* 1400 */ 256, 288, 1807, 588, 1809, 1810, 584, 259, 579, 261, - /* 1410 */ 150, 1769, 280, 1806, 289, 1768, 65, 299, 1767, 1766, - /* 1420 */ 1765, 298, 66, 360, 1824, 1762, 362, 1950, 363, 1266, - /* 1430 */ 557, 1267, 586, 169, 367, 1760, 369, 1775, 370, 585, - /* 1440 */ 162, 1824, 371, 1759, 1947, 373, 1758, 375, 1757, 583, - /* 1450 */ 1756, 377, 379, 1739, 1775, 382, 585, 170, 124, 383, - /* 1460 */ 1241, 1240, 1733, 1732, 1838, 388, 389, 1806, 93, 1807, - /* 1470 */ 588, 1809, 1810, 584, 1731, 579, 1730, 1210, 1884, 562, - /* 1480 */ 1705, 1838, 573, 1880, 126, 296, 1807, 588, 1809, 1810, - /* 1490 */ 584, 582, 579, 576, 1856, 1824, 1704, 1703, 122, 1702, - /* 1500 */ 69, 1701, 1700, 586, 1699, 1698, 1697, 404, 1775, 1696, - /* 1510 */ 585, 407, 405, 253, 1892, 556, 1695, 555, 1694, 1693, - /* 1520 */ 1950, 1806, 1692, 1691, 1690, 1689, 1688, 1687, 1686, 1685, - /* 1530 */ 1684, 1683, 1682, 162, 127, 1838, 1212, 1947, 1681, 146, - /* 1540 */ 1807, 588, 1809, 1810, 584, 1806, 579, 1680, 1679, 1824, - /* 1550 */ 1678, 1677, 1676, 1675, 1674, 1673, 1672, 586, 1546, 178, - /* 1560 */ 1545, 1543, 1775, 179, 585, 1511, 444, 446, 1510, 1747, - /* 1570 */ 1741, 1806, 1729, 1824, 117, 181, 1022, 155, 326, 182, - /* 1580 */ 1021, 586, 118, 563, 1964, 187, 1775, 189, 585, 1838, - /* 1590 */ 1728, 1714, 1598, 93, 1807, 588, 1809, 1810, 584, 1824, - /* 1600 */ 579, 1542, 1052, 1884, 535, 1540, 461, 586, 1881, 1538, - /* 1610 */ 462, 466, 1775, 1838, 585, 463, 465, 297, 1807, 588, - /* 1620 */ 1809, 1810, 584, 467, 579, 1536, 470, 471, 469, 1806, - /* 1630 */ 1534, 473, 474, 475, 1523, 1522, 1507, 1600, 1164, 1838, - /* 1640 */ 50, 1806, 1163, 297, 1807, 588, 1809, 1810, 584, 1089, - /* 1650 */ 579, 1599, 1086, 198, 638, 640, 1085, 1824, 1532, 1527, - /* 1660 */ 1084, 321, 322, 1525, 495, 586, 323, 498, 1506, 1824, - /* 1670 */ 1775, 1505, 585, 1504, 504, 94, 500, 586, 502, 1746, - /* 1680 */ 1248, 1740, 1775, 511, 585, 1727, 141, 1725, 1726, 1724, - /* 1690 */ 1723, 1806, 221, 15, 56, 1721, 1258, 1838, 512, 216, - /* 1700 */ 1713, 292, 1807, 588, 1809, 1810, 584, 227, 579, 1838, - /* 1710 */ 234, 78, 231, 146, 1807, 588, 1809, 1810, 584, 1824, - /* 1720 */ 579, 229, 79, 84, 324, 16, 41, 583, 526, 47, - /* 1730 */ 245, 23, 1775, 1806, 585, 236, 517, 1448, 238, 553, - /* 1740 */ 1430, 244, 240, 1796, 1432, 1806, 148, 25, 254, 243, - /* 1750 */ 46, 24, 1795, 18, 152, 1425, 83, 1806, 1965, 1838, - /* 1760 */ 1460, 1824, 1405, 296, 1807, 588, 1809, 1810, 584, 586, - /* 1770 */ 579, 1459, 1857, 1824, 1775, 335, 585, 1464, 341, 1463, - /* 1780 */ 336, 586, 1404, 17, 1465, 1824, 1775, 10, 585, 1454, - /* 1790 */ 343, 1291, 1367, 586, 19, 1342, 153, 1322, 1775, 1806, - /* 1800 */ 585, 1838, 45, 1841, 578, 282, 1807, 588, 1809, 1810, - /* 1810 */ 584, 1340, 579, 1838, 13, 31, 12, 297, 1807, 588, - /* 1820 */ 1809, 1810, 584, 1339, 579, 1838, 20, 1824, 166, 297, - /* 1830 */ 1807, 588, 1809, 1810, 584, 586, 579, 21, 589, 1150, - /* 1840 */ 1775, 591, 585, 344, 593, 595, 1147, 596, 598, 1144, - /* 1850 */ 599, 601, 1806, 1138, 602, 587, 1136, 604, 1127, 605, - /* 1860 */ 1142, 611, 1806, 85, 1159, 1141, 1140, 1838, 86, 62, - /* 1870 */ 1139, 283, 1807, 588, 1809, 1810, 584, 265, 579, 1155, - /* 1880 */ 1824, 1050, 620, 1081, 1080, 1079, 1077, 1075, 586, 627, - /* 1890 */ 1824, 1096, 1070, 1775, 1073, 585, 1072, 266, 586, 1071, - /* 1900 */ 1069, 1068, 1067, 1775, 1066, 585, 1093, 1091, 1063, 1062, - /* 1910 */ 1061, 1058, 1806, 1057, 1056, 1055, 1539, 649, 650, 1537, - /* 1920 */ 1838, 653, 651, 655, 284, 1807, 588, 1809, 1810, 584, - /* 1930 */ 1838, 579, 654, 1806, 291, 1807, 588, 1809, 1810, 584, - /* 1940 */ 1824, 579, 1535, 657, 658, 1533, 659, 661, 586, 662, - /* 1950 */ 663, 1521, 665, 1775, 1503, 585, 1012, 269, 669, 673, - /* 1960 */ 1277, 1824, 277, 1478, 672, 1478, 1478, 1478, 1478, 586, - /* 1970 */ 1478, 1478, 1478, 1478, 1775, 1478, 585, 1478, 1478, 1478, - /* 1980 */ 1838, 1478, 1478, 1806, 293, 1807, 588, 1809, 1810, 584, - /* 1990 */ 1478, 579, 1478, 1478, 1478, 1478, 1478, 1806, 1478, 1478, - /* 2000 */ 1478, 1838, 1478, 1478, 1478, 285, 1807, 588, 1809, 1810, - /* 2010 */ 584, 1824, 579, 1478, 1478, 1478, 1478, 1478, 1478, 586, - /* 2020 */ 1478, 1478, 1478, 1478, 1775, 1824, 585, 1478, 1478, 1478, - /* 2030 */ 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, 1775, 1478, - /* 2040 */ 585, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1806, - /* 2050 */ 1478, 1838, 1478, 1478, 1478, 294, 1807, 588, 1809, 1810, - /* 2060 */ 584, 1478, 579, 1806, 1478, 1838, 1478, 1478, 1478, 286, - /* 2070 */ 1807, 588, 1809, 1810, 584, 1478, 579, 1824, 1478, 1478, - /* 2080 */ 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, - /* 2090 */ 1775, 1824, 585, 1478, 1478, 1478, 1478, 1478, 1478, 586, - /* 2100 */ 1478, 1478, 1478, 1478, 1775, 1478, 585, 1478, 1478, 1478, - /* 2110 */ 1478, 1478, 1478, 1478, 1478, 1478, 1806, 1838, 1478, 1478, - /* 2120 */ 1478, 295, 1807, 588, 1809, 1810, 584, 1478, 579, 1478, - /* 2130 */ 1478, 1838, 1478, 1478, 1478, 287, 1807, 588, 1809, 1810, - /* 2140 */ 584, 1478, 579, 1478, 1824, 1478, 1478, 1478, 1478, 1478, - /* 2150 */ 1478, 1478, 586, 1478, 1478, 1478, 1478, 1775, 1478, 585, - /* 2160 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1806, - /* 2170 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, - /* 2180 */ 1478, 1478, 1478, 1478, 1838, 1478, 1478, 1478, 300, 1807, - /* 2190 */ 588, 1809, 1810, 584, 1478, 579, 1478, 1824, 1478, 1478, - /* 2200 */ 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, - /* 2210 */ 1775, 1478, 585, 1478, 1478, 1478, 1478, 1478, 1478, 1806, - /* 2220 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, - /* 2230 */ 1478, 1478, 1478, 1806, 1478, 1478, 1478, 1838, 1478, 1478, - /* 2240 */ 1478, 301, 1807, 588, 1809, 1810, 584, 1824, 579, 1478, - /* 2250 */ 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, - /* 2260 */ 1775, 1824, 585, 1478, 1478, 1478, 1478, 1478, 1478, 586, - /* 2270 */ 1478, 1478, 1478, 1478, 1775, 1806, 585, 1478, 1478, 1478, - /* 2280 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1838, 1478, 1806, - /* 2290 */ 1478, 1818, 1807, 588, 1809, 1810, 584, 1478, 579, 1478, - /* 2300 */ 1478, 1838, 1478, 1824, 1478, 1817, 1807, 588, 1809, 1810, - /* 2310 */ 584, 586, 579, 1478, 1478, 1478, 1775, 1824, 585, 1478, - /* 2320 */ 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, - /* 2330 */ 1775, 1478, 585, 1478, 1478, 1478, 1478, 1478, 1478, 1478, - /* 2340 */ 1478, 1806, 1478, 1838, 1478, 1478, 1478, 1816, 1807, 588, - /* 2350 */ 1809, 1810, 584, 1478, 579, 1806, 1478, 1838, 1478, 1478, - /* 2360 */ 1478, 312, 1807, 588, 1809, 1810, 584, 1478, 579, 1824, - /* 2370 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, - /* 2380 */ 1478, 1478, 1775, 1824, 585, 1478, 1478, 1478, 1478, 1478, - /* 2390 */ 1478, 586, 1478, 1478, 1478, 1478, 1775, 1478, 585, 1478, - /* 2400 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1806, 1838, - /* 2410 */ 1478, 1478, 1478, 311, 1807, 588, 1809, 1810, 584, 1478, - /* 2420 */ 579, 1478, 1478, 1838, 1478, 1478, 1478, 313, 1807, 588, - /* 2430 */ 1809, 1810, 584, 1478, 579, 1478, 1824, 1478, 1478, 1478, - /* 2440 */ 1478, 1478, 1478, 1478, 586, 1478, 1478, 1478, 1478, 1775, - /* 2450 */ 1478, 585, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, - /* 2460 */ 1478, 1806, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, - /* 2470 */ 1478, 1478, 1478, 1478, 1478, 1478, 1838, 1478, 1478, 1478, - /* 2480 */ 310, 1807, 588, 1809, 1810, 584, 1478, 579, 1478, 1824, - /* 2490 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 586, 1478, 1478, - /* 2500 */ 1478, 1478, 1775, 1478, 585, 1478, 1478, 1478, 1478, 1478, - /* 2510 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, - /* 2520 */ 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1478, 1838, - /* 2530 */ 1478, 1478, 1478, 290, 1807, 588, 1809, 1810, 584, 1478, - /* 2540 */ 579, + /* 0 */ 433, 1937, 434, 1503, 1654, 1655, 1599, 326, 441, 548, + /* 10 */ 434, 1503, 39, 37, 1936, 143, 1709, 1776, 1934, 1937, + /* 20 */ 339, 1469, 1264, 513, 1610, 40, 38, 36, 35, 34, + /* 30 */ 1793, 325, 163, 1341, 1706, 1262, 1934, 124, 1290, 1023, + /* 40 */ 1006, 1022, 104, 1772, 1778, 103, 102, 101, 100, 99, + /* 50 */ 98, 97, 96, 95, 156, 570, 1336, 73, 1811, 344, + /* 60 */ 147, 14, 1653, 1655, 1568, 88, 577, 1647, 1270, 1024, + /* 70 */ 1023, 1762, 1022, 576, 39, 37, 1404, 122, 121, 1604, + /* 80 */ 1010, 1011, 339, 1530, 1264, 469, 1600, 553, 145, 1, + /* 90 */ 1480, 550, 158, 1879, 1880, 1341, 1884, 1262, 1825, 551, + /* 100 */ 1024, 64, 91, 1794, 579, 1796, 1797, 575, 1660, 570, + /* 110 */ 1291, 662, 1871, 1408, 1937, 312, 306, 1867, 1336, 1289, + /* 120 */ 36, 35, 34, 14, 1658, 1343, 1344, 1935, 1937, 104, + /* 130 */ 1270, 1934, 103, 102, 101, 100, 99, 98, 97, 96, + /* 140 */ 95, 164, 450, 1161, 1162, 1934, 639, 638, 637, 636, + /* 150 */ 349, 2, 635, 634, 125, 629, 628, 627, 626, 625, + /* 160 */ 624, 623, 136, 619, 618, 617, 348, 347, 614, 613, + /* 170 */ 1265, 316, 1263, 662, 1491, 33, 32, 1466, 1937, 40, + /* 180 */ 38, 36, 35, 34, 30, 261, 63, 1343, 1344, 432, + /* 190 */ 1290, 163, 436, 1268, 1269, 1934, 1318, 1319, 1321, 1322, + /* 200 */ 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, 1338, + /* 210 */ 1339, 1340, 1342, 1345, 1468, 1762, 33, 32, 612, 551, + /* 220 */ 40, 38, 36, 35, 34, 1289, 317, 165, 315, 314, + /* 230 */ 610, 473, 1265, 209, 1263, 475, 1425, 354, 113, 112, + /* 240 */ 111, 110, 109, 108, 107, 106, 105, 253, 384, 134, + /* 250 */ 133, 607, 606, 605, 63, 1268, 1269, 474, 1318, 1319, + /* 260 */ 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, + /* 270 */ 1337, 1338, 1339, 1340, 1342, 1345, 39, 37, 1937, 534, + /* 280 */ 1423, 1424, 1426, 1427, 339, 303, 1264, 378, 43, 75, + /* 290 */ 305, 162, 221, 515, 1793, 1934, 1320, 1341, 1435, 1262, + /* 300 */ 1119, 601, 600, 599, 1123, 598, 1125, 1126, 597, 1128, + /* 310 */ 594, 487, 1134, 591, 1136, 1137, 588, 585, 440, 1811, + /* 320 */ 1336, 436, 1811, 537, 165, 14, 497, 541, 1937, 1461, + /* 330 */ 577, 1699, 1270, 551, 377, 1762, 376, 576, 39, 37, + /* 340 */ 208, 162, 170, 63, 548, 1934, 339, 49, 1264, 525, + /* 350 */ 665, 1244, 1245, 2, 490, 1490, 222, 223, 484, 1341, + /* 360 */ 55, 1262, 1825, 207, 268, 540, 93, 1794, 579, 1796, + /* 370 */ 1797, 575, 124, 570, 1289, 662, 1871, 1608, 154, 143, + /* 380 */ 1870, 1867, 1336, 655, 651, 647, 643, 266, 1611, 1343, + /* 390 */ 1344, 1270, 165, 1264, 1270, 58, 1762, 216, 57, 1489, + /* 400 */ 543, 538, 42, 39, 37, 1346, 1262, 1780, 496, 1488, + /* 410 */ 548, 339, 122, 1264, 305, 8, 1460, 515, 1776, 89, + /* 420 */ 73, 494, 231, 492, 1341, 542, 1262, 159, 1879, 1880, + /* 430 */ 63, 1884, 77, 119, 1265, 1351, 1263, 662, 124, 1270, + /* 440 */ 1762, 1289, 1603, 63, 1772, 1778, 328, 1336, 479, 478, + /* 450 */ 1762, 1343, 1344, 11, 10, 522, 570, 1268, 1269, 1270, + /* 460 */ 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, + /* 470 */ 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, 122, 215, + /* 480 */ 9, 165, 662, 482, 481, 165, 171, 218, 1586, 195, + /* 490 */ 120, 633, 631, 160, 1879, 1880, 1265, 1884, 1263, 1660, + /* 500 */ 477, 480, 662, 149, 61, 1236, 327, 211, 467, 463, + /* 510 */ 459, 455, 194, 1585, 76, 1658, 1343, 1344, 71, 1268, + /* 520 */ 1269, 70, 1318, 1319, 1321, 1322, 1323, 1324, 1325, 1326, + /* 530 */ 572, 568, 1334, 1335, 1337, 1338, 1339, 1340, 1342, 1345, + /* 540 */ 165, 1265, 1377, 1263, 74, 1583, 1288, 192, 450, 81, + /* 550 */ 33, 32, 342, 165, 40, 38, 36, 35, 34, 1533, + /* 560 */ 143, 1265, 1584, 1263, 1268, 1269, 621, 512, 165, 1610, + /* 570 */ 1601, 1699, 33, 32, 1010, 1011, 40, 38, 36, 35, + /* 580 */ 34, 165, 173, 604, 1268, 1269, 1081, 1318, 1319, 1321, + /* 590 */ 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, + /* 600 */ 1338, 1339, 1340, 1342, 1345, 39, 37, 22, 1937, 191, + /* 610 */ 184, 1793, 189, 339, 610, 1264, 446, 1597, 1320, 1083, + /* 620 */ 513, 162, 612, 482, 481, 1934, 1341, 525, 1262, 1593, + /* 630 */ 120, 1707, 182, 134, 133, 607, 606, 605, 114, 1811, + /* 640 */ 477, 480, 7, 345, 548, 471, 610, 577, 1487, 1336, + /* 650 */ 438, 143, 1762, 525, 576, 1608, 1287, 1595, 419, 352, + /* 660 */ 1610, 1270, 351, 1365, 167, 134, 133, 607, 606, 605, + /* 670 */ 33, 32, 124, 1486, 40, 38, 36, 35, 34, 1825, + /* 680 */ 1485, 1608, 9, 280, 1794, 579, 1796, 1797, 575, 1762, + /* 690 */ 570, 33, 32, 553, 505, 40, 38, 36, 35, 34, + /* 700 */ 1937, 33, 32, 1937, 662, 40, 38, 36, 35, 34, + /* 710 */ 175, 174, 122, 162, 1762, 498, 162, 1934, 1343, 1344, + /* 720 */ 1934, 1762, 1705, 307, 300, 27, 1484, 251, 1879, 547, + /* 730 */ 525, 546, 39, 37, 1937, 1370, 1483, 302, 1886, 1287, + /* 740 */ 339, 114, 1264, 525, 307, 555, 412, 164, 476, 424, + /* 750 */ 1591, 1934, 1303, 1341, 382, 1262, 1937, 212, 1608, 373, + /* 760 */ 1363, 1886, 1883, 1265, 1509, 1263, 397, 1762, 425, 162, + /* 770 */ 399, 1608, 1482, 1934, 1479, 1292, 1336, 1762, 375, 371, + /* 780 */ 1704, 1363, 300, 1415, 1478, 1882, 1268, 1269, 1270, 1318, + /* 790 */ 1319, 1321, 1322, 1323, 1324, 1325, 1326, 572, 568, 1334, + /* 800 */ 1335, 1337, 1338, 1339, 1340, 1342, 1345, 390, 1477, 2, + /* 810 */ 26, 1660, 657, 1762, 1364, 1762, 33, 32, 343, 386, + /* 820 */ 40, 38, 36, 35, 34, 1762, 28, 1658, 1660, 1397, + /* 830 */ 1476, 662, 33, 32, 1475, 1364, 40, 38, 36, 35, + /* 840 */ 34, 622, 1289, 1580, 1659, 1343, 1344, 423, 1474, 1762, + /* 850 */ 418, 417, 416, 415, 414, 411, 410, 409, 408, 407, + /* 860 */ 403, 402, 401, 400, 394, 393, 392, 391, 1473, 388, + /* 870 */ 387, 1762, 475, 1401, 1472, 1762, 29, 337, 1358, 1359, + /* 880 */ 1360, 1361, 1362, 1366, 1367, 1368, 1369, 1886, 608, 1762, + /* 890 */ 1265, 1651, 1263, 609, 474, 571, 1651, 29, 337, 1358, + /* 900 */ 1359, 1360, 1361, 1362, 1366, 1367, 1368, 1369, 1471, 1762, + /* 910 */ 1793, 1881, 233, 1268, 1269, 1762, 1318, 1319, 1321, 1322, + /* 920 */ 1323, 1324, 1325, 1326, 572, 568, 1334, 1335, 1337, 1338, + /* 930 */ 1339, 1340, 1342, 1345, 525, 144, 525, 525, 1811, 1273, + /* 940 */ 279, 525, 1891, 1397, 548, 383, 577, 389, 404, 1762, + /* 950 */ 603, 1762, 405, 576, 277, 60, 273, 132, 59, 1638, + /* 960 */ 44, 4, 1608, 1749, 1608, 1608, 1481, 553, 200, 1608, + /* 970 */ 525, 198, 124, 1520, 178, 429, 427, 1780, 1825, 1515, + /* 980 */ 560, 449, 91, 1794, 579, 1796, 1797, 575, 1776, 570, + /* 990 */ 566, 202, 1871, 553, 201, 483, 306, 1867, 1608, 336, + /* 1000 */ 335, 485, 525, 41, 54, 557, 63, 220, 1937, 1278, + /* 1010 */ 361, 1513, 122, 1605, 1772, 1778, 334, 53, 509, 1320, + /* 1020 */ 1341, 162, 1271, 11, 10, 1934, 570, 251, 1879, 547, + /* 1030 */ 1608, 546, 256, 488, 1937, 525, 204, 1781, 206, 203, + /* 1040 */ 128, 205, 1793, 1336, 90, 131, 1737, 162, 1776, 51, + /* 1050 */ 1213, 1934, 33, 32, 224, 1270, 40, 38, 36, 35, + /* 1060 */ 34, 33, 32, 1608, 132, 40, 38, 36, 35, 34, + /* 1070 */ 1811, 525, 1463, 1464, 1772, 1778, 1276, 1569, 552, 68, + /* 1080 */ 67, 381, 506, 1762, 169, 576, 570, 518, 51, 1783, + /* 1090 */ 615, 535, 230, 1272, 87, 468, 1371, 1400, 565, 1608, + /* 1100 */ 301, 499, 237, 369, 84, 367, 363, 359, 356, 353, + /* 1110 */ 1825, 1112, 1069, 41, 92, 1794, 579, 1796, 1797, 575, + /* 1120 */ 525, 570, 1355, 525, 1871, 525, 525, 525, 330, 1867, + /* 1130 */ 157, 510, 1785, 1050, 523, 1422, 524, 262, 346, 616, + /* 1140 */ 41, 1793, 161, 1303, 165, 245, 350, 1504, 1608, 240, + /* 1150 */ 1897, 1608, 583, 1608, 1608, 1608, 1812, 1279, 131, 1274, + /* 1160 */ 1327, 1067, 1648, 132, 1901, 116, 1051, 549, 250, 1811, + /* 1170 */ 255, 258, 3, 260, 131, 5, 355, 552, 313, 360, + /* 1180 */ 1282, 1284, 1762, 1793, 576, 561, 1229, 272, 172, 269, + /* 1190 */ 385, 1287, 568, 1334, 1335, 1337, 1338, 1339, 1340, 1140, + /* 1200 */ 406, 142, 1701, 413, 421, 1144, 420, 422, 558, 1825, + /* 1210 */ 1151, 1811, 1149, 92, 1794, 579, 1796, 1797, 575, 577, + /* 1220 */ 570, 135, 426, 1871, 1762, 428, 576, 330, 1867, 157, + /* 1230 */ 1275, 1293, 431, 430, 439, 1296, 1793, 1295, 442, 181, + /* 1240 */ 183, 443, 444, 1297, 447, 445, 186, 188, 1294, 1898, + /* 1250 */ 448, 1825, 190, 1793, 72, 92, 1794, 579, 1796, 1797, + /* 1260 */ 575, 193, 570, 451, 1811, 1871, 470, 1742, 500, 330, + /* 1270 */ 1867, 1950, 577, 472, 1598, 304, 197, 1762, 1594, 576, + /* 1280 */ 1905, 1811, 199, 115, 137, 507, 138, 1596, 1592, 577, + /* 1290 */ 210, 139, 270, 501, 1762, 140, 576, 213, 511, 322, + /* 1300 */ 533, 217, 514, 129, 1825, 519, 226, 271, 92, 1794, + /* 1310 */ 579, 1796, 1797, 575, 1292, 570, 1793, 504, 1871, 520, + /* 1320 */ 1741, 1825, 330, 1867, 1950, 92, 1794, 579, 1796, 1797, + /* 1330 */ 575, 228, 570, 1928, 1711, 1871, 516, 130, 324, 330, + /* 1340 */ 1867, 1950, 80, 521, 1811, 1609, 536, 1902, 529, 531, + /* 1350 */ 1890, 235, 577, 239, 6, 532, 1912, 1762, 329, 576, + /* 1360 */ 545, 539, 530, 528, 527, 1397, 1793, 123, 249, 1291, + /* 1370 */ 1887, 562, 1911, 553, 559, 331, 1793, 48, 82, 1893, + /* 1380 */ 581, 1652, 1581, 658, 1825, 274, 659, 246, 286, 1794, + /* 1390 */ 579, 1796, 1797, 575, 1811, 570, 52, 265, 244, 248, + /* 1400 */ 151, 254, 577, 1933, 1811, 1953, 661, 1762, 247, 576, + /* 1410 */ 1852, 150, 577, 276, 1937, 287, 1756, 1762, 1793, 576, + /* 1420 */ 297, 278, 296, 553, 556, 563, 1755, 164, 257, 65, + /* 1430 */ 1754, 1934, 1753, 66, 1825, 259, 1750, 357, 286, 1794, + /* 1440 */ 579, 1796, 1797, 575, 1825, 570, 1811, 358, 93, 1794, + /* 1450 */ 579, 1796, 1797, 575, 574, 570, 1256, 1257, 1871, 1762, + /* 1460 */ 168, 576, 564, 1867, 1937, 362, 1748, 366, 364, 365, + /* 1470 */ 1747, 368, 1793, 370, 1745, 372, 1744, 162, 1746, 374, + /* 1480 */ 1232, 1934, 1231, 1722, 1793, 1721, 1825, 379, 1720, 380, + /* 1490 */ 294, 1794, 579, 1796, 1797, 575, 573, 570, 567, 1843, + /* 1500 */ 1811, 1719, 1201, 1694, 126, 1693, 1692, 1691, 577, 69, + /* 1510 */ 1690, 1689, 1811, 1762, 1688, 576, 1687, 1686, 395, 396, + /* 1520 */ 577, 1685, 398, 1684, 1683, 1762, 1682, 576, 1681, 1680, + /* 1530 */ 1679, 1678, 1677, 1676, 1675, 1674, 1673, 1672, 1671, 1670, + /* 1540 */ 1825, 1793, 127, 1669, 146, 1794, 579, 1796, 1797, 575, + /* 1550 */ 1668, 570, 1825, 180, 176, 1534, 93, 1794, 579, 1796, + /* 1560 */ 1797, 575, 1667, 570, 1666, 1793, 1871, 1203, 1664, 1811, + /* 1570 */ 1665, 1868, 1663, 1662, 323, 1661, 1535, 577, 177, 1532, + /* 1580 */ 1500, 117, 1762, 1793, 576, 1013, 179, 435, 554, 1951, + /* 1590 */ 155, 1012, 437, 1811, 1499, 118, 1735, 1729, 526, 1718, + /* 1600 */ 185, 577, 187, 1717, 1703, 1587, 1762, 1531, 576, 1825, + /* 1610 */ 1043, 1811, 1529, 295, 1794, 579, 1796, 1797, 575, 577, + /* 1620 */ 570, 452, 454, 1527, 1762, 453, 576, 456, 457, 458, + /* 1630 */ 1525, 461, 462, 1825, 1523, 460, 464, 295, 1794, 579, + /* 1640 */ 1796, 1797, 575, 1512, 570, 1793, 1511, 466, 1496, 465, + /* 1650 */ 1589, 1825, 50, 196, 1154, 290, 1794, 579, 1796, 1797, + /* 1660 */ 575, 1155, 570, 1793, 1588, 630, 1080, 632, 1077, 1075, + /* 1670 */ 1076, 1521, 1516, 1811, 318, 319, 486, 1514, 320, 489, + /* 1680 */ 1495, 577, 1494, 1493, 491, 495, 1762, 94, 576, 493, + /* 1690 */ 1734, 1811, 1238, 544, 1728, 502, 1716, 56, 141, 574, + /* 1700 */ 1714, 1715, 1713, 214, 1762, 1712, 576, 15, 503, 321, + /* 1710 */ 219, 1710, 1702, 1825, 225, 1793, 229, 146, 1794, 579, + /* 1720 */ 1796, 1797, 575, 227, 570, 508, 78, 79, 84, 517, + /* 1730 */ 41, 1825, 232, 1793, 23, 294, 1794, 579, 1796, 1797, + /* 1740 */ 575, 1248, 570, 1811, 1844, 1437, 16, 234, 338, 236, + /* 1750 */ 1419, 577, 47, 242, 238, 148, 1762, 1793, 576, 1421, + /* 1760 */ 1414, 1811, 1952, 241, 24, 243, 340, 1783, 83, 577, + /* 1770 */ 25, 1394, 252, 46, 1762, 1393, 576, 1782, 1454, 152, + /* 1780 */ 18, 1443, 1449, 1825, 1448, 1811, 332, 295, 1794, 579, + /* 1790 */ 1796, 1797, 575, 577, 570, 1453, 17, 1452, 1762, 333, + /* 1800 */ 576, 1825, 10, 1280, 1356, 295, 1794, 579, 1796, 1797, + /* 1810 */ 575, 19, 570, 1793, 45, 1331, 13, 1828, 569, 153, + /* 1820 */ 166, 1311, 580, 578, 1329, 1825, 1328, 1793, 31, 281, + /* 1830 */ 1794, 579, 1796, 1797, 575, 12, 570, 20, 582, 21, + /* 1840 */ 341, 1811, 1141, 584, 586, 1138, 587, 589, 1135, 577, + /* 1850 */ 590, 592, 595, 1129, 1762, 1811, 576, 1127, 593, 596, + /* 1860 */ 1118, 85, 1150, 577, 86, 62, 1133, 602, 1762, 1793, + /* 1870 */ 576, 263, 1132, 1146, 1072, 1041, 611, 1071, 1131, 1793, + /* 1880 */ 1070, 1825, 1068, 1066, 1130, 282, 1794, 579, 1796, 1797, + /* 1890 */ 575, 1065, 570, 1064, 1087, 1825, 264, 1811, 620, 289, + /* 1900 */ 1794, 579, 1796, 1797, 575, 577, 570, 1811, 1062, 1061, + /* 1910 */ 1762, 1060, 576, 1059, 1058, 577, 1057, 1056, 1084, 1082, + /* 1920 */ 1762, 1793, 576, 1053, 1047, 1528, 1052, 1526, 1049, 1048, + /* 1930 */ 1046, 640, 641, 644, 645, 1524, 642, 1825, 646, 648, + /* 1940 */ 650, 291, 1794, 579, 1796, 1797, 575, 1825, 570, 1811, + /* 1950 */ 649, 283, 1794, 579, 1796, 1797, 575, 577, 570, 1522, + /* 1960 */ 653, 652, 1762, 654, 576, 1510, 656, 1003, 1492, 267, + /* 1970 */ 660, 1467, 1266, 275, 1793, 663, 664, 1467, 1467, 1467, + /* 1980 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1825, + /* 1990 */ 1467, 1467, 1793, 292, 1794, 579, 1796, 1797, 575, 1467, + /* 2000 */ 570, 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2010 */ 577, 1467, 1467, 1467, 1467, 1762, 1467, 576, 1467, 1467, + /* 2020 */ 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 577, 1467, + /* 2030 */ 1467, 1467, 1467, 1762, 1467, 576, 1467, 1467, 1467, 1467, + /* 2040 */ 1467, 1467, 1825, 1467, 1793, 1467, 284, 1794, 579, 1796, + /* 2050 */ 1797, 575, 1467, 570, 1793, 1467, 1467, 1467, 1467, 1467, + /* 2060 */ 1825, 1467, 1467, 1467, 293, 1794, 579, 1796, 1797, 575, + /* 2070 */ 1793, 570, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2080 */ 577, 1467, 1811, 1467, 1467, 1762, 1467, 576, 1467, 1467, + /* 2090 */ 577, 1467, 1467, 1467, 1467, 1762, 1467, 576, 1811, 1467, + /* 2100 */ 1467, 1467, 1467, 1467, 1467, 1467, 577, 1467, 1467, 1467, + /* 2110 */ 1467, 1762, 1825, 576, 1467, 1467, 285, 1794, 579, 1796, + /* 2120 */ 1797, 575, 1825, 570, 1793, 1467, 298, 1794, 579, 1796, + /* 2130 */ 1797, 575, 1467, 570, 1467, 1467, 1467, 1467, 1825, 1467, + /* 2140 */ 1793, 1467, 299, 1794, 579, 1796, 1797, 575, 1467, 570, + /* 2150 */ 1793, 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2160 */ 577, 1467, 1467, 1467, 1467, 1762, 1793, 576, 1811, 1467, + /* 2170 */ 1467, 1467, 1467, 1467, 1467, 1467, 577, 1467, 1811, 1467, + /* 2180 */ 1467, 1762, 1467, 576, 1467, 1467, 577, 1467, 1467, 1467, + /* 2190 */ 1467, 1762, 1825, 576, 1811, 1467, 1805, 1794, 579, 1796, + /* 2200 */ 1797, 575, 577, 570, 1467, 1467, 1467, 1762, 1825, 576, + /* 2210 */ 1467, 1467, 1804, 1794, 579, 1796, 1797, 575, 1825, 570, + /* 2220 */ 1467, 1467, 1803, 1794, 579, 1796, 1797, 575, 1467, 570, + /* 2230 */ 1467, 1467, 1467, 1467, 1825, 1793, 1467, 1467, 310, 1794, + /* 2240 */ 579, 1796, 1797, 575, 1467, 570, 1467, 1467, 1467, 1467, + /* 2250 */ 1467, 1467, 1467, 1793, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2260 */ 1467, 1467, 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2270 */ 1467, 577, 1467, 1467, 1467, 1467, 1762, 1467, 576, 1467, + /* 2280 */ 1467, 1811, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 577, + /* 2290 */ 1467, 1467, 1467, 1467, 1762, 1467, 576, 1467, 1467, 1467, + /* 2300 */ 1467, 1467, 1467, 1825, 1467, 1793, 1467, 309, 1794, 579, + /* 2310 */ 1796, 1797, 575, 1467, 570, 1793, 1467, 1467, 1467, 1467, + /* 2320 */ 1467, 1825, 1467, 1467, 1467, 311, 1794, 579, 1796, 1797, + /* 2330 */ 575, 1467, 570, 1811, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2340 */ 1467, 577, 1467, 1811, 1467, 1467, 1762, 1467, 576, 1467, + /* 2350 */ 1467, 577, 1467, 1467, 1467, 1467, 1762, 1467, 576, 1467, + /* 2360 */ 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, 1467, + /* 2370 */ 1467, 1467, 1467, 1825, 1467, 1467, 1467, 308, 1794, 579, + /* 2380 */ 1796, 1797, 575, 1825, 570, 1467, 1467, 288, 1794, 579, + /* 2390 */ 1796, 1797, 575, 1467, 570, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 267, 361, 269, 270, 0, 4, 293, 283, 267, 271, - /* 10 */ 269, 270, 12, 13, 374, 291, 263, 304, 378, 361, - /* 20 */ 20, 0, 22, 306, 300, 12, 13, 14, 15, 16, - /* 30 */ 263, 314, 374, 33, 317, 35, 378, 299, 20, 20, - /* 40 */ 4, 22, 21, 330, 331, 24, 25, 26, 27, 28, - /* 50 */ 29, 30, 31, 32, 14, 342, 56, 304, 291, 302, - /* 60 */ 20, 61, 305, 306, 271, 273, 299, 263, 68, 50, - /* 70 */ 20, 304, 22, 306, 12, 13, 14, 339, 286, 291, - /* 80 */ 44, 45, 20, 0, 22, 35, 294, 320, 300, 89, - /* 90 */ 89, 353, 354, 355, 356, 33, 358, 35, 331, 271, - /* 100 */ 50, 308, 335, 336, 337, 338, 339, 340, 304, 342, - /* 110 */ 282, 111, 345, 14, 15, 16, 349, 350, 56, 60, - /* 120 */ 20, 346, 347, 61, 20, 125, 126, 299, 361, 21, - /* 130 */ 68, 121, 24, 25, 26, 27, 28, 29, 30, 31, - /* 140 */ 32, 374, 20, 125, 126, 378, 63, 64, 65, 66, + /* 0 */ 264, 358, 266, 267, 302, 303, 290, 280, 264, 268, + /* 10 */ 266, 267, 12, 13, 371, 288, 0, 301, 375, 358, + /* 20 */ 20, 0, 22, 303, 297, 12, 13, 14, 15, 16, + /* 30 */ 260, 311, 371, 33, 314, 35, 375, 296, 20, 20, + /* 40 */ 4, 22, 21, 327, 328, 24, 25, 26, 27, 28, + /* 50 */ 29, 30, 31, 32, 287, 339, 56, 272, 288, 299, + /* 60 */ 273, 61, 302, 303, 277, 270, 296, 300, 68, 50, + /* 70 */ 20, 301, 22, 303, 12, 13, 14, 336, 283, 294, + /* 80 */ 44, 45, 20, 0, 22, 35, 291, 317, 259, 89, + /* 90 */ 261, 350, 351, 352, 353, 33, 355, 35, 328, 20, + /* 100 */ 50, 4, 332, 333, 334, 335, 336, 337, 288, 339, + /* 110 */ 20, 111, 342, 14, 358, 295, 346, 347, 56, 20, + /* 120 */ 14, 15, 16, 61, 304, 125, 126, 371, 358, 21, + /* 130 */ 68, 375, 24, 25, 26, 27, 28, 29, 30, 31, + /* 140 */ 32, 371, 60, 125, 126, 375, 63, 64, 65, 66, /* 150 */ 67, 89, 69, 70, 71, 72, 73, 74, 75, 76, /* 160 */ 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - /* 170 */ 170, 333, 172, 111, 120, 121, 276, 8, 9, 361, - /* 180 */ 280, 12, 13, 14, 15, 16, 20, 125, 126, 89, - /* 190 */ 180, 181, 374, 89, 184, 357, 378, 197, 198, 320, + /* 170 */ 170, 37, 172, 111, 260, 8, 9, 257, 358, 12, + /* 180 */ 13, 14, 15, 16, 343, 344, 89, 125, 126, 265, + /* 190 */ 20, 371, 268, 193, 194, 375, 196, 197, 198, 199, /* 200 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - /* 210 */ 210, 211, 212, 213, 214, 215, 216, 217, 0, 89, - /* 220 */ 8, 9, 0, 56, 12, 13, 14, 15, 16, 275, - /* 230 */ 230, 230, 170, 0, 172, 181, 1, 2, 184, 22, - /* 240 */ 361, 79, 24, 25, 26, 27, 28, 29, 30, 31, - /* 250 */ 32, 297, 35, 374, 197, 89, 89, 378, 91, 197, - /* 260 */ 198, 165, 200, 201, 202, 203, 204, 205, 206, 207, - /* 270 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - /* 280 */ 12, 13, 60, 187, 188, 68, 301, 291, 20, 304, - /* 290 */ 22, 129, 130, 60, 263, 299, 239, 240, 241, 242, - /* 300 */ 243, 33, 90, 35, 102, 103, 104, 105, 106, 107, - /* 310 */ 108, 109, 110, 111, 112, 283, 114, 115, 116, 117, - /* 320 */ 118, 119, 291, 291, 56, 90, 155, 271, 111, 61, - /* 330 */ 299, 162, 300, 337, 230, 304, 68, 306, 282, 20, - /* 340 */ 8, 9, 12, 13, 12, 13, 14, 15, 16, 271, - /* 350 */ 20, 320, 22, 20, 320, 299, 262, 89, 264, 20, - /* 360 */ 230, 273, 331, 33, 89, 35, 335, 336, 337, 338, - /* 370 */ 339, 340, 271, 342, 271, 263, 345, 299, 56, 111, - /* 380 */ 349, 350, 294, 282, 89, 282, 56, 170, 293, 172, - /* 390 */ 305, 306, 361, 125, 126, 361, 230, 230, 68, 304, - /* 400 */ 299, 120, 299, 291, 263, 374, 235, 236, 374, 378, - /* 410 */ 88, 299, 378, 91, 197, 198, 304, 339, 306, 89, - /* 420 */ 35, 252, 90, 8, 9, 330, 331, 12, 13, 14, - /* 430 */ 15, 16, 354, 355, 356, 333, 358, 342, 170, 301, - /* 440 */ 172, 111, 304, 331, 169, 304, 171, 335, 336, 337, - /* 450 */ 338, 339, 340, 68, 342, 125, 126, 345, 43, 357, - /* 460 */ 263, 349, 350, 182, 183, 197, 198, 0, 200, 201, - /* 470 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - /* 480 */ 212, 213, 214, 215, 216, 217, 271, 8, 9, 22, - /* 490 */ 157, 12, 13, 14, 15, 16, 316, 282, 318, 33, - /* 500 */ 170, 304, 172, 8, 9, 230, 43, 12, 13, 14, - /* 510 */ 15, 16, 268, 47, 299, 271, 277, 278, 52, 53, - /* 520 */ 54, 55, 56, 263, 316, 230, 318, 197, 198, 320, - /* 530 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, - /* 540 */ 210, 211, 212, 213, 214, 215, 216, 217, 12, 13, - /* 550 */ 14, 291, 263, 18, 88, 20, 20, 91, 22, 299, - /* 560 */ 230, 299, 27, 4, 304, 30, 306, 2, 20, 33, - /* 570 */ 361, 35, 310, 8, 9, 21, 263, 12, 13, 14, - /* 580 */ 15, 16, 47, 374, 49, 90, 51, 378, 34, 263, - /* 590 */ 36, 331, 56, 304, 290, 335, 336, 337, 338, 339, - /* 600 */ 340, 293, 342, 306, 68, 345, 0, 303, 20, 349, - /* 610 */ 350, 351, 304, 271, 317, 263, 263, 304, 271, 153, - /* 620 */ 154, 271, 156, 88, 282, 89, 160, 291, 152, 282, - /* 630 */ 304, 371, 282, 61, 298, 100, 157, 271, 330, 331, - /* 640 */ 332, 299, 299, 307, 291, 179, 299, 111, 282, 299, - /* 650 */ 342, 175, 299, 310, 14, 289, 304, 304, 0, 306, - /* 660 */ 20, 125, 126, 128, 263, 299, 131, 132, 133, 134, - /* 670 */ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - /* 680 */ 145, 146, 147, 148, 331, 150, 151, 275, 335, 336, - /* 690 */ 337, 338, 339, 340, 218, 342, 268, 361, 345, 271, - /* 700 */ 288, 291, 349, 350, 351, 304, 170, 101, 172, 297, - /* 710 */ 374, 333, 249, 360, 378, 8, 9, 307, 3, 12, - /* 720 */ 13, 14, 15, 16, 60, 263, 120, 121, 122, 123, - /* 730 */ 124, 277, 278, 197, 198, 357, 200, 201, 202, 203, - /* 740 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, - /* 750 */ 214, 215, 216, 217, 12, 13, 4, 283, 19, 101, - /* 760 */ 291, 263, 20, 68, 22, 291, 304, 298, 61, 197, - /* 770 */ 320, 19, 33, 263, 300, 33, 307, 35, 120, 121, - /* 780 */ 122, 123, 124, 100, 263, 33, 47, 279, 39, 281, - /* 790 */ 231, 52, 53, 54, 55, 56, 293, 90, 56, 47, - /* 800 */ 37, 263, 304, 51, 271, 98, 2, 304, 56, 263, - /* 810 */ 68, 361, 8, 9, 304, 282, 12, 13, 14, 15, - /* 820 */ 16, 263, 289, 271, 374, 304, 20, 88, 378, 291, - /* 830 */ 91, 89, 299, 330, 331, 332, 20, 299, 271, 68, - /* 840 */ 88, 201, 304, 91, 306, 342, 14, 44, 45, 282, - /* 850 */ 304, 299, 20, 111, 291, 92, 43, 94, 95, 152, - /* 860 */ 97, 298, 304, 124, 101, 292, 299, 125, 126, 331, - /* 870 */ 307, 228, 229, 335, 336, 337, 338, 339, 340, 263, - /* 880 */ 342, 260, 175, 345, 42, 43, 123, 349, 350, 351, - /* 890 */ 43, 339, 8, 9, 271, 156, 12, 13, 14, 15, - /* 900 */ 16, 363, 0, 90, 292, 282, 354, 355, 356, 371, - /* 910 */ 358, 292, 170, 35, 172, 101, 177, 292, 179, 292, - /* 920 */ 304, 284, 299, 263, 287, 218, 219, 220, 221, 222, - /* 930 */ 223, 224, 225, 226, 227, 263, 263, 123, 292, 197, - /* 940 */ 198, 320, 200, 201, 202, 203, 204, 205, 206, 207, - /* 950 */ 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - /* 960 */ 12, 13, 247, 157, 304, 101, 64, 65, 20, 93, - /* 970 */ 22, 69, 96, 320, 72, 35, 304, 304, 229, 263, - /* 980 */ 78, 33, 361, 35, 120, 121, 122, 123, 124, 0, - /* 990 */ 292, 271, 64, 65, 43, 374, 0, 69, 271, 378, - /* 1000 */ 72, 271, 282, 0, 56, 56, 78, 291, 93, 282, - /* 1010 */ 93, 96, 282, 96, 361, 299, 68, 201, 22, 299, - /* 1020 */ 304, 271, 306, 18, 43, 22, 299, 374, 23, 299, - /* 1030 */ 43, 378, 282, 201, 324, 93, 47, 89, 96, 264, - /* 1040 */ 91, 90, 37, 38, 157, 158, 41, 331, 381, 299, - /* 1050 */ 172, 335, 336, 337, 338, 339, 340, 271, 342, 111, - /* 1060 */ 43, 345, 57, 58, 59, 349, 350, 351, 282, 271, - /* 1070 */ 43, 90, 43, 125, 126, 43, 360, 90, 372, 43, - /* 1080 */ 282, 1, 2, 8, 9, 299, 43, 12, 13, 14, - /* 1090 */ 15, 16, 125, 126, 89, 43, 46, 299, 251, 89, - /* 1100 */ 43, 13, 35, 13, 280, 272, 327, 90, 368, 99, - /* 1110 */ 291, 272, 172, 270, 303, 334, 359, 90, 170, 90, - /* 1120 */ 172, 352, 90, 35, 43, 35, 90, 43, 43, 43, - /* 1130 */ 43, 0, 127, 90, 375, 68, 61, 375, 362, 89, - /* 1140 */ 375, 232, 90, 20, 329, 197, 198, 90, 200, 201, - /* 1150 */ 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - /* 1160 */ 212, 213, 214, 215, 216, 217, 271, 162, 163, 164, - /* 1170 */ 35, 90, 167, 98, 90, 90, 90, 90, 173, 48, - /* 1180 */ 328, 47, 12, 13, 277, 322, 168, 42, 311, 263, - /* 1190 */ 271, 186, 22, 271, 189, 309, 191, 192, 193, 194, - /* 1200 */ 195, 196, 311, 33, 271, 35, 152, 309, 271, 271, - /* 1210 */ 20, 265, 265, 20, 326, 20, 275, 291, 306, 275, - /* 1220 */ 319, 271, 20, 319, 321, 299, 56, 152, 275, 275, - /* 1230 */ 304, 20, 306, 312, 275, 230, 275, 271, 68, 275, - /* 1240 */ 265, 271, 265, 291, 326, 273, 291, 291, 291, 299, - /* 1250 */ 175, 291, 178, 291, 291, 325, 291, 331, 273, 291, - /* 1260 */ 291, 335, 336, 337, 338, 339, 340, 291, 342, 271, - /* 1270 */ 320, 345, 271, 273, 237, 349, 350, 351, 304, 263, - /* 1280 */ 154, 111, 273, 304, 306, 299, 360, 304, 315, 339, - /* 1290 */ 319, 299, 304, 218, 219, 220, 221, 222, 223, 224, - /* 1300 */ 225, 226, 227, 304, 354, 355, 356, 291, 358, 315, - /* 1310 */ 304, 361, 287, 273, 312, 299, 20, 313, 334, 304, - /* 1320 */ 304, 238, 306, 315, 374, 367, 304, 304, 378, 263, - /* 1330 */ 304, 233, 304, 244, 315, 161, 320, 246, 245, 229, - /* 1340 */ 170, 329, 172, 299, 20, 250, 333, 331, 248, 367, - /* 1350 */ 370, 335, 336, 337, 338, 339, 340, 291, 342, 369, - /* 1360 */ 367, 366, 365, 89, 253, 299, 89, 197, 198, 304, - /* 1370 */ 304, 364, 306, 382, 295, 281, 271, 361, 348, 209, - /* 1380 */ 210, 211, 212, 213, 214, 215, 320, 273, 377, 36, - /* 1390 */ 374, 377, 323, 266, 378, 265, 263, 331, 377, 274, - /* 1400 */ 376, 335, 336, 337, 338, 339, 340, 376, 342, 376, - /* 1410 */ 318, 0, 261, 263, 285, 0, 180, 285, 0, 0, - /* 1420 */ 0, 285, 42, 76, 291, 0, 35, 361, 190, 35, - /* 1430 */ 271, 35, 299, 35, 190, 0, 35, 304, 35, 306, - /* 1440 */ 374, 291, 190, 0, 378, 190, 0, 35, 0, 299, - /* 1450 */ 0, 22, 35, 0, 304, 175, 306, 89, 299, 174, - /* 1460 */ 172, 170, 0, 0, 331, 166, 165, 263, 335, 336, - /* 1470 */ 337, 338, 339, 340, 0, 342, 0, 46, 345, 320, - /* 1480 */ 0, 331, 349, 350, 42, 335, 336, 337, 338, 339, - /* 1490 */ 340, 341, 342, 343, 344, 291, 0, 0, 339, 0, - /* 1500 */ 149, 0, 0, 299, 0, 0, 0, 144, 304, 0, - /* 1510 */ 306, 144, 35, 354, 355, 356, 0, 358, 0, 0, - /* 1520 */ 361, 263, 0, 0, 0, 0, 0, 0, 0, 0, - /* 1530 */ 0, 0, 0, 374, 42, 331, 22, 378, 0, 335, - /* 1540 */ 336, 337, 338, 339, 340, 263, 342, 0, 0, 291, - /* 1550 */ 0, 0, 0, 0, 0, 0, 0, 299, 0, 56, - /* 1560 */ 0, 0, 304, 56, 306, 0, 46, 46, 0, 0, - /* 1570 */ 0, 263, 0, 291, 39, 42, 14, 43, 296, 40, - /* 1580 */ 14, 299, 39, 379, 380, 39, 304, 161, 306, 331, - /* 1590 */ 0, 0, 0, 335, 336, 337, 338, 339, 340, 291, - /* 1600 */ 342, 0, 62, 345, 296, 0, 35, 299, 350, 0, - /* 1610 */ 47, 47, 304, 331, 306, 39, 35, 335, 336, 337, - /* 1620 */ 338, 339, 340, 39, 342, 0, 47, 39, 35, 263, - /* 1630 */ 0, 35, 47, 39, 0, 0, 0, 0, 35, 331, - /* 1640 */ 98, 263, 22, 335, 336, 337, 338, 339, 340, 35, - /* 1650 */ 342, 0, 35, 96, 43, 43, 35, 291, 0, 0, - /* 1660 */ 22, 22, 22, 0, 49, 299, 22, 35, 0, 291, - /* 1670 */ 304, 0, 306, 0, 22, 20, 35, 299, 35, 0, - /* 1680 */ 35, 0, 304, 22, 306, 0, 176, 0, 0, 0, - /* 1690 */ 0, 263, 90, 89, 157, 0, 185, 331, 157, 154, - /* 1700 */ 0, 335, 336, 337, 338, 339, 340, 89, 342, 331, - /* 1710 */ 46, 89, 153, 335, 336, 337, 338, 339, 340, 291, - /* 1720 */ 342, 39, 89, 99, 157, 234, 43, 299, 155, 43, - /* 1730 */ 46, 89, 304, 263, 306, 89, 159, 90, 90, 373, - /* 1740 */ 90, 43, 89, 46, 90, 263, 89, 43, 46, 89, - /* 1750 */ 43, 89, 46, 43, 46, 90, 89, 263, 380, 331, - /* 1760 */ 35, 291, 90, 335, 336, 337, 338, 339, 340, 299, - /* 1770 */ 342, 35, 344, 291, 304, 35, 306, 35, 296, 35, - /* 1780 */ 35, 299, 90, 234, 90, 291, 304, 2, 306, 90, - /* 1790 */ 296, 22, 197, 299, 43, 90, 46, 22, 304, 263, - /* 1800 */ 306, 331, 228, 89, 89, 335, 336, 337, 338, 339, - /* 1810 */ 340, 90, 342, 331, 234, 89, 89, 335, 336, 337, - /* 1820 */ 338, 339, 340, 90, 342, 331, 89, 291, 46, 335, - /* 1830 */ 336, 337, 338, 339, 340, 299, 342, 89, 100, 90, - /* 1840 */ 304, 35, 306, 35, 89, 35, 90, 89, 35, 90, - /* 1850 */ 89, 35, 263, 90, 89, 199, 90, 35, 22, 89, - /* 1860 */ 113, 101, 263, 89, 35, 113, 113, 331, 89, 89, - /* 1870 */ 113, 335, 336, 337, 338, 339, 340, 43, 342, 22, - /* 1880 */ 291, 62, 61, 35, 35, 35, 35, 35, 299, 87, - /* 1890 */ 291, 68, 22, 304, 35, 306, 35, 43, 299, 35, - /* 1900 */ 35, 22, 35, 304, 35, 306, 68, 35, 35, 35, - /* 1910 */ 35, 35, 263, 35, 22, 35, 0, 35, 47, 0, - /* 1920 */ 331, 35, 39, 39, 335, 336, 337, 338, 339, 340, - /* 1930 */ 331, 342, 47, 263, 335, 336, 337, 338, 339, 340, - /* 1940 */ 291, 342, 0, 35, 47, 0, 39, 35, 299, 47, - /* 1950 */ 39, 0, 35, 304, 0, 306, 35, 22, 21, 20, - /* 1960 */ 22, 291, 22, 383, 21, 383, 383, 383, 383, 299, - /* 1970 */ 383, 383, 383, 383, 304, 383, 306, 383, 383, 383, - /* 1980 */ 331, 383, 383, 263, 335, 336, 337, 338, 339, 340, - /* 1990 */ 383, 342, 383, 383, 383, 383, 383, 263, 383, 383, - /* 2000 */ 383, 331, 383, 383, 383, 335, 336, 337, 338, 339, - /* 2010 */ 340, 291, 342, 383, 383, 383, 383, 383, 383, 299, - /* 2020 */ 383, 383, 383, 383, 304, 291, 306, 383, 383, 383, - /* 2030 */ 383, 383, 383, 299, 383, 383, 383, 383, 304, 383, - /* 2040 */ 306, 383, 383, 383, 383, 383, 383, 383, 383, 263, - /* 2050 */ 383, 331, 383, 383, 383, 335, 336, 337, 338, 339, - /* 2060 */ 340, 383, 342, 263, 383, 331, 383, 383, 383, 335, - /* 2070 */ 336, 337, 338, 339, 340, 383, 342, 291, 383, 383, - /* 2080 */ 383, 383, 383, 383, 383, 299, 383, 383, 383, 383, - /* 2090 */ 304, 291, 306, 383, 383, 383, 383, 383, 383, 299, - /* 2100 */ 383, 383, 383, 383, 304, 383, 306, 383, 383, 383, - /* 2110 */ 383, 383, 383, 383, 383, 383, 263, 331, 383, 383, - /* 2120 */ 383, 335, 336, 337, 338, 339, 340, 383, 342, 383, - /* 2130 */ 383, 331, 383, 383, 383, 335, 336, 337, 338, 339, - /* 2140 */ 340, 383, 342, 383, 291, 383, 383, 383, 383, 383, - /* 2150 */ 383, 383, 299, 383, 383, 383, 383, 304, 383, 306, - /* 2160 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 263, - /* 2170 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - /* 2180 */ 383, 383, 383, 383, 331, 383, 383, 383, 335, 336, - /* 2190 */ 337, 338, 339, 340, 383, 342, 383, 291, 383, 383, - /* 2200 */ 383, 383, 383, 383, 383, 299, 383, 383, 383, 383, - /* 2210 */ 304, 383, 306, 383, 383, 383, 383, 383, 383, 263, - /* 2220 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - /* 2230 */ 383, 383, 383, 263, 383, 383, 383, 331, 383, 383, - /* 2240 */ 383, 335, 336, 337, 338, 339, 340, 291, 342, 383, - /* 2250 */ 383, 383, 383, 383, 383, 299, 383, 383, 383, 383, - /* 2260 */ 304, 291, 306, 383, 383, 383, 383, 383, 383, 299, - /* 2270 */ 383, 383, 383, 383, 304, 263, 306, 383, 383, 383, - /* 2280 */ 383, 383, 383, 383, 383, 383, 383, 331, 383, 263, - /* 2290 */ 383, 335, 336, 337, 338, 339, 340, 383, 342, 383, - /* 2300 */ 383, 331, 383, 291, 383, 335, 336, 337, 338, 339, - /* 2310 */ 340, 299, 342, 383, 383, 383, 304, 291, 306, 383, - /* 2320 */ 383, 383, 383, 383, 383, 299, 383, 383, 383, 383, - /* 2330 */ 304, 383, 306, 383, 383, 383, 383, 383, 383, 383, - /* 2340 */ 383, 263, 383, 331, 383, 383, 383, 335, 336, 337, - /* 2350 */ 338, 339, 340, 383, 342, 263, 383, 331, 383, 383, - /* 2360 */ 383, 335, 336, 337, 338, 339, 340, 383, 342, 291, - /* 2370 */ 383, 383, 383, 383, 383, 383, 383, 299, 383, 383, - /* 2380 */ 383, 383, 304, 291, 306, 383, 383, 383, 383, 383, - /* 2390 */ 383, 299, 383, 383, 383, 383, 304, 383, 306, 383, - /* 2400 */ 383, 383, 383, 383, 383, 383, 383, 383, 263, 331, - /* 2410 */ 383, 383, 383, 335, 336, 337, 338, 339, 340, 383, - /* 2420 */ 342, 383, 383, 331, 383, 383, 383, 335, 336, 337, - /* 2430 */ 338, 339, 340, 383, 342, 383, 291, 383, 383, 383, - /* 2440 */ 383, 383, 383, 383, 299, 383, 383, 383, 383, 304, - /* 2450 */ 383, 306, 383, 383, 383, 383, 383, 383, 383, 383, - /* 2460 */ 383, 263, 383, 383, 383, 383, 383, 383, 383, 383, - /* 2470 */ 383, 383, 383, 383, 383, 383, 331, 383, 383, 383, - /* 2480 */ 335, 336, 337, 338, 339, 340, 383, 342, 383, 291, - /* 2490 */ 383, 383, 383, 383, 383, 383, 383, 299, 383, 383, - /* 2500 */ 383, 383, 304, 383, 306, 383, 383, 383, 383, 383, - /* 2510 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 383, - /* 2520 */ 383, 383, 383, 383, 383, 383, 383, 383, 383, 331, - /* 2530 */ 383, 383, 383, 335, 336, 337, 338, 339, 340, 383, - /* 2540 */ 342, + /* 210 */ 210, 211, 212, 213, 0, 301, 8, 9, 60, 20, + /* 220 */ 12, 13, 14, 15, 16, 20, 92, 227, 94, 95, + /* 230 */ 101, 97, 170, 121, 172, 101, 193, 317, 24, 25, + /* 240 */ 26, 27, 28, 29, 30, 31, 32, 157, 268, 120, + /* 250 */ 121, 122, 123, 124, 89, 193, 194, 123, 196, 197, + /* 260 */ 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + /* 270 */ 208, 209, 210, 211, 212, 213, 12, 13, 358, 236, + /* 280 */ 237, 238, 239, 240, 20, 305, 22, 317, 89, 177, + /* 290 */ 178, 371, 120, 181, 260, 375, 197, 33, 90, 35, + /* 300 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + /* 310 */ 112, 4, 114, 115, 116, 117, 118, 119, 265, 288, + /* 320 */ 56, 268, 288, 155, 227, 61, 19, 296, 358, 162, + /* 330 */ 296, 296, 68, 20, 169, 301, 171, 303, 12, 13, + /* 340 */ 33, 371, 307, 89, 268, 375, 20, 89, 22, 268, + /* 350 */ 19, 179, 180, 89, 47, 260, 120, 121, 51, 33, + /* 360 */ 279, 35, 328, 56, 33, 334, 332, 333, 334, 335, + /* 370 */ 336, 337, 296, 339, 20, 111, 342, 296, 47, 288, + /* 380 */ 346, 347, 56, 52, 53, 54, 55, 56, 297, 125, + /* 390 */ 126, 68, 227, 22, 68, 88, 301, 56, 91, 260, + /* 400 */ 232, 233, 89, 12, 13, 14, 35, 290, 21, 260, + /* 410 */ 268, 20, 336, 22, 178, 89, 249, 181, 301, 88, + /* 420 */ 272, 34, 91, 36, 33, 20, 35, 351, 352, 353, + /* 430 */ 89, 355, 91, 285, 170, 14, 172, 111, 296, 68, + /* 440 */ 301, 20, 294, 89, 327, 328, 329, 56, 274, 275, + /* 450 */ 301, 125, 126, 1, 2, 124, 339, 193, 194, 68, + /* 460 */ 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, + /* 470 */ 206, 207, 208, 209, 210, 211, 212, 213, 336, 56, + /* 480 */ 89, 227, 111, 64, 65, 227, 56, 156, 0, 33, + /* 490 */ 71, 274, 275, 351, 352, 353, 170, 355, 172, 288, + /* 500 */ 81, 82, 111, 47, 3, 174, 295, 176, 52, 53, + /* 510 */ 54, 55, 56, 0, 91, 304, 125, 126, 88, 193, + /* 520 */ 194, 91, 196, 197, 198, 199, 200, 201, 202, 203, + /* 530 */ 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, + /* 540 */ 227, 170, 90, 172, 88, 0, 20, 91, 60, 270, + /* 550 */ 8, 9, 280, 227, 12, 13, 14, 15, 16, 0, + /* 560 */ 288, 170, 0, 172, 193, 194, 68, 317, 227, 297, + /* 570 */ 291, 296, 8, 9, 44, 45, 12, 13, 14, 15, + /* 580 */ 16, 227, 307, 100, 193, 194, 35, 196, 197, 198, + /* 590 */ 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, + /* 600 */ 209, 210, 211, 212, 213, 12, 13, 43, 358, 153, + /* 610 */ 154, 260, 156, 20, 101, 22, 160, 289, 197, 68, + /* 620 */ 303, 371, 60, 64, 65, 375, 33, 268, 35, 289, + /* 630 */ 71, 314, 176, 120, 121, 122, 123, 124, 279, 288, + /* 640 */ 81, 82, 39, 280, 268, 286, 101, 296, 260, 56, + /* 650 */ 14, 288, 301, 268, 303, 296, 20, 289, 77, 317, + /* 660 */ 297, 68, 317, 152, 279, 120, 121, 122, 123, 124, + /* 670 */ 8, 9, 296, 260, 12, 13, 14, 15, 16, 328, + /* 680 */ 260, 296, 89, 332, 333, 334, 335, 336, 337, 301, + /* 690 */ 339, 8, 9, 317, 321, 12, 13, 14, 15, 16, + /* 700 */ 358, 8, 9, 358, 111, 12, 13, 14, 15, 16, + /* 710 */ 129, 130, 336, 371, 301, 317, 371, 375, 125, 126, + /* 720 */ 375, 301, 313, 61, 315, 214, 260, 351, 352, 353, + /* 730 */ 268, 355, 12, 13, 358, 224, 260, 18, 330, 20, + /* 740 */ 20, 279, 22, 268, 61, 244, 27, 371, 286, 30, + /* 750 */ 289, 375, 90, 33, 279, 35, 358, 289, 296, 165, + /* 760 */ 98, 330, 354, 170, 0, 172, 47, 301, 49, 371, + /* 770 */ 51, 296, 260, 375, 260, 20, 56, 301, 184, 185, + /* 780 */ 313, 98, 315, 90, 260, 354, 193, 194, 68, 196, + /* 790 */ 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, + /* 800 */ 207, 208, 209, 210, 211, 212, 213, 88, 260, 89, + /* 810 */ 2, 288, 48, 301, 152, 301, 8, 9, 295, 100, + /* 820 */ 12, 13, 14, 15, 16, 301, 2, 304, 288, 226, + /* 830 */ 260, 111, 8, 9, 260, 152, 12, 13, 14, 15, + /* 840 */ 16, 276, 20, 278, 304, 125, 126, 128, 260, 301, + /* 850 */ 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, + /* 860 */ 141, 142, 143, 144, 145, 146, 147, 148, 260, 150, + /* 870 */ 151, 301, 101, 4, 260, 301, 214, 215, 216, 217, + /* 880 */ 218, 219, 220, 221, 222, 223, 224, 330, 298, 301, + /* 890 */ 170, 301, 172, 298, 123, 289, 301, 214, 215, 216, + /* 900 */ 217, 218, 219, 220, 221, 222, 223, 224, 260, 301, + /* 910 */ 260, 354, 157, 193, 194, 301, 196, 197, 198, 199, + /* 920 */ 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + /* 930 */ 210, 211, 212, 213, 268, 18, 268, 268, 288, 35, + /* 940 */ 23, 268, 225, 226, 268, 279, 296, 279, 279, 301, + /* 950 */ 289, 301, 279, 303, 37, 38, 281, 43, 41, 284, + /* 960 */ 42, 43, 296, 0, 296, 296, 261, 317, 93, 296, + /* 970 */ 268, 96, 296, 0, 57, 58, 59, 290, 328, 0, + /* 980 */ 43, 279, 332, 333, 334, 335, 336, 337, 301, 339, + /* 990 */ 61, 93, 342, 317, 96, 22, 346, 347, 296, 12, + /* 1000 */ 13, 22, 268, 43, 90, 43, 89, 43, 358, 22, + /* 1010 */ 47, 0, 336, 279, 327, 328, 329, 157, 158, 197, + /* 1020 */ 33, 371, 35, 1, 2, 375, 339, 351, 352, 353, + /* 1030 */ 296, 355, 378, 22, 358, 268, 93, 290, 93, 96, + /* 1040 */ 43, 96, 260, 56, 127, 43, 279, 371, 301, 43, + /* 1050 */ 90, 375, 8, 9, 90, 68, 12, 13, 14, 15, + /* 1060 */ 16, 8, 9, 296, 43, 12, 13, 14, 15, 16, + /* 1070 */ 288, 268, 125, 126, 327, 328, 172, 277, 296, 162, + /* 1080 */ 163, 164, 279, 301, 167, 303, 339, 90, 43, 46, + /* 1090 */ 13, 369, 90, 35, 89, 269, 90, 228, 111, 296, + /* 1100 */ 183, 324, 43, 186, 99, 188, 189, 190, 191, 192, + /* 1110 */ 328, 90, 35, 43, 332, 333, 334, 335, 336, 337, + /* 1120 */ 268, 339, 193, 268, 342, 268, 268, 268, 346, 347, + /* 1130 */ 348, 279, 89, 35, 279, 90, 279, 279, 279, 13, + /* 1140 */ 43, 260, 360, 90, 227, 365, 269, 267, 296, 90, + /* 1150 */ 368, 296, 43, 296, 296, 296, 288, 170, 43, 172, + /* 1160 */ 90, 35, 300, 43, 331, 43, 68, 356, 349, 288, + /* 1170 */ 372, 372, 359, 372, 43, 229, 326, 296, 325, 47, + /* 1180 */ 193, 194, 301, 260, 303, 248, 168, 90, 42, 319, + /* 1190 */ 308, 20, 205, 206, 207, 208, 209, 210, 211, 90, + /* 1200 */ 268, 157, 268, 308, 152, 90, 306, 306, 246, 328, + /* 1210 */ 90, 288, 90, 332, 333, 334, 335, 336, 337, 296, + /* 1220 */ 339, 90, 268, 342, 301, 268, 303, 346, 347, 348, + /* 1230 */ 172, 20, 262, 268, 262, 20, 260, 20, 323, 272, + /* 1240 */ 272, 303, 316, 20, 316, 318, 272, 272, 20, 368, + /* 1250 */ 309, 328, 272, 260, 272, 332, 333, 334, 335, 336, + /* 1260 */ 337, 272, 339, 268, 288, 342, 262, 301, 175, 346, + /* 1270 */ 347, 348, 296, 288, 288, 262, 288, 301, 288, 303, + /* 1280 */ 357, 288, 288, 268, 288, 268, 288, 288, 288, 296, + /* 1290 */ 270, 288, 323, 322, 301, 288, 303, 270, 268, 316, + /* 1300 */ 234, 270, 301, 312, 328, 154, 296, 284, 332, 333, + /* 1310 */ 334, 335, 336, 337, 20, 339, 260, 303, 342, 310, + /* 1320 */ 301, 328, 346, 347, 348, 332, 333, 334, 335, 336, + /* 1330 */ 337, 270, 339, 357, 301, 342, 301, 312, 301, 346, + /* 1340 */ 347, 348, 270, 309, 288, 296, 235, 331, 301, 301, + /* 1350 */ 357, 312, 296, 312, 241, 301, 364, 301, 301, 303, + /* 1360 */ 161, 301, 243, 242, 230, 226, 260, 296, 326, 20, + /* 1370 */ 330, 247, 364, 317, 245, 250, 260, 89, 89, 367, + /* 1380 */ 292, 301, 278, 36, 328, 268, 263, 363, 332, 333, + /* 1390 */ 334, 335, 336, 337, 288, 339, 320, 270, 366, 361, + /* 1400 */ 364, 373, 296, 374, 288, 379, 262, 301, 362, 303, + /* 1410 */ 345, 315, 296, 271, 358, 282, 0, 301, 260, 303, + /* 1420 */ 282, 258, 282, 317, 374, 374, 0, 371, 373, 177, + /* 1430 */ 0, 375, 0, 42, 328, 373, 0, 35, 332, 333, + /* 1440 */ 334, 335, 336, 337, 328, 339, 288, 187, 332, 333, + /* 1450 */ 334, 335, 336, 337, 296, 339, 35, 35, 342, 301, + /* 1460 */ 35, 303, 346, 347, 358, 187, 0, 187, 35, 35, + /* 1470 */ 0, 187, 260, 35, 0, 22, 0, 371, 0, 35, + /* 1480 */ 172, 375, 170, 0, 260, 0, 328, 166, 0, 165, + /* 1490 */ 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, + /* 1500 */ 288, 0, 46, 0, 42, 0, 0, 0, 296, 149, + /* 1510 */ 0, 0, 288, 301, 0, 303, 0, 0, 144, 35, + /* 1520 */ 296, 0, 144, 0, 0, 301, 0, 303, 0, 0, + /* 1530 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + /* 1540 */ 328, 260, 42, 0, 332, 333, 334, 335, 336, 337, + /* 1550 */ 0, 339, 328, 40, 56, 0, 332, 333, 334, 335, + /* 1560 */ 336, 337, 0, 339, 0, 260, 342, 22, 0, 288, + /* 1570 */ 0, 347, 0, 0, 293, 0, 0, 296, 56, 0, + /* 1580 */ 0, 39, 301, 260, 303, 14, 42, 46, 376, 377, + /* 1590 */ 43, 14, 46, 288, 0, 39, 0, 0, 293, 0, + /* 1600 */ 39, 296, 161, 0, 0, 0, 301, 0, 303, 328, + /* 1610 */ 62, 288, 0, 332, 333, 334, 335, 336, 337, 296, + /* 1620 */ 339, 35, 39, 0, 301, 47, 303, 35, 47, 39, + /* 1630 */ 0, 47, 39, 328, 0, 35, 35, 332, 333, 334, + /* 1640 */ 335, 336, 337, 0, 339, 260, 0, 39, 0, 47, + /* 1650 */ 0, 328, 98, 96, 22, 332, 333, 334, 335, 336, + /* 1660 */ 337, 35, 339, 260, 0, 43, 35, 43, 35, 22, + /* 1670 */ 35, 0, 0, 288, 22, 22, 49, 0, 22, 35, + /* 1680 */ 0, 296, 0, 0, 35, 22, 301, 20, 303, 35, + /* 1690 */ 0, 288, 35, 370, 0, 22, 0, 157, 173, 296, + /* 1700 */ 0, 0, 0, 154, 301, 0, 303, 89, 157, 157, + /* 1710 */ 90, 0, 0, 328, 89, 260, 153, 332, 333, 334, + /* 1720 */ 335, 336, 337, 39, 339, 159, 89, 89, 99, 155, + /* 1730 */ 43, 328, 46, 260, 89, 332, 333, 334, 335, 336, + /* 1740 */ 337, 182, 339, 288, 341, 90, 231, 89, 293, 90, + /* 1750 */ 90, 296, 43, 43, 89, 89, 301, 260, 303, 90, + /* 1760 */ 90, 288, 377, 89, 89, 46, 293, 46, 89, 296, + /* 1770 */ 43, 90, 46, 43, 301, 90, 303, 46, 90, 46, + /* 1780 */ 43, 90, 35, 328, 35, 288, 35, 332, 333, 334, + /* 1790 */ 335, 336, 337, 296, 339, 35, 231, 35, 301, 35, + /* 1800 */ 303, 328, 2, 22, 193, 332, 333, 334, 335, 336, + /* 1810 */ 337, 43, 339, 260, 225, 90, 231, 89, 89, 46, + /* 1820 */ 46, 22, 100, 195, 90, 328, 90, 260, 89, 332, + /* 1830 */ 333, 334, 335, 336, 337, 89, 339, 89, 35, 89, + /* 1840 */ 35, 288, 90, 89, 35, 90, 89, 35, 90, 296, + /* 1850 */ 89, 35, 35, 90, 301, 288, 303, 90, 89, 89, + /* 1860 */ 22, 89, 35, 296, 89, 89, 113, 101, 301, 260, + /* 1870 */ 303, 43, 113, 22, 35, 62, 61, 35, 113, 260, + /* 1880 */ 35, 328, 35, 35, 113, 332, 333, 334, 335, 336, + /* 1890 */ 337, 35, 339, 35, 68, 328, 43, 288, 87, 332, + /* 1900 */ 333, 334, 335, 336, 337, 296, 339, 288, 35, 35, + /* 1910 */ 301, 22, 303, 35, 22, 296, 35, 35, 68, 35, + /* 1920 */ 301, 260, 303, 35, 22, 0, 35, 0, 35, 35, + /* 1930 */ 35, 35, 47, 35, 47, 0, 39, 328, 39, 35, + /* 1940 */ 39, 332, 333, 334, 335, 336, 337, 328, 339, 288, + /* 1950 */ 47, 332, 333, 334, 335, 336, 337, 296, 339, 0, + /* 1960 */ 47, 35, 301, 39, 303, 0, 35, 35, 0, 22, + /* 1970 */ 21, 380, 22, 22, 260, 21, 20, 380, 380, 380, + /* 1980 */ 380, 380, 380, 380, 380, 380, 380, 380, 380, 328, + /* 1990 */ 380, 380, 260, 332, 333, 334, 335, 336, 337, 380, + /* 2000 */ 339, 380, 288, 380, 380, 380, 380, 380, 380, 380, + /* 2010 */ 296, 380, 380, 380, 380, 301, 380, 303, 380, 380, + /* 2020 */ 288, 380, 380, 380, 380, 380, 380, 380, 296, 380, + /* 2030 */ 380, 380, 380, 301, 380, 303, 380, 380, 380, 380, + /* 2040 */ 380, 380, 328, 380, 260, 380, 332, 333, 334, 335, + /* 2050 */ 336, 337, 380, 339, 260, 380, 380, 380, 380, 380, + /* 2060 */ 328, 380, 380, 380, 332, 333, 334, 335, 336, 337, + /* 2070 */ 260, 339, 288, 380, 380, 380, 380, 380, 380, 380, + /* 2080 */ 296, 380, 288, 380, 380, 301, 380, 303, 380, 380, + /* 2090 */ 296, 380, 380, 380, 380, 301, 380, 303, 288, 380, + /* 2100 */ 380, 380, 380, 380, 380, 380, 296, 380, 380, 380, + /* 2110 */ 380, 301, 328, 303, 380, 380, 332, 333, 334, 335, + /* 2120 */ 336, 337, 328, 339, 260, 380, 332, 333, 334, 335, + /* 2130 */ 336, 337, 380, 339, 380, 380, 380, 380, 328, 380, + /* 2140 */ 260, 380, 332, 333, 334, 335, 336, 337, 380, 339, + /* 2150 */ 260, 380, 288, 380, 380, 380, 380, 380, 380, 380, + /* 2160 */ 296, 380, 380, 380, 380, 301, 260, 303, 288, 380, + /* 2170 */ 380, 380, 380, 380, 380, 380, 296, 380, 288, 380, + /* 2180 */ 380, 301, 380, 303, 380, 380, 296, 380, 380, 380, + /* 2190 */ 380, 301, 328, 303, 288, 380, 332, 333, 334, 335, + /* 2200 */ 336, 337, 296, 339, 380, 380, 380, 301, 328, 303, + /* 2210 */ 380, 380, 332, 333, 334, 335, 336, 337, 328, 339, + /* 2220 */ 380, 380, 332, 333, 334, 335, 336, 337, 380, 339, + /* 2230 */ 380, 380, 380, 380, 328, 260, 380, 380, 332, 333, + /* 2240 */ 334, 335, 336, 337, 380, 339, 380, 380, 380, 380, + /* 2250 */ 380, 380, 380, 260, 380, 380, 380, 380, 380, 380, + /* 2260 */ 380, 380, 380, 288, 380, 380, 380, 380, 380, 380, + /* 2270 */ 380, 296, 380, 380, 380, 380, 301, 380, 303, 380, + /* 2280 */ 380, 288, 380, 380, 380, 380, 380, 380, 380, 296, + /* 2290 */ 380, 380, 380, 380, 301, 380, 303, 380, 380, 380, + /* 2300 */ 380, 380, 380, 328, 380, 260, 380, 332, 333, 334, + /* 2310 */ 335, 336, 337, 380, 339, 260, 380, 380, 380, 380, + /* 2320 */ 380, 328, 380, 380, 380, 332, 333, 334, 335, 336, + /* 2330 */ 337, 380, 339, 288, 380, 380, 380, 380, 380, 380, + /* 2340 */ 380, 296, 380, 288, 380, 380, 301, 380, 303, 380, + /* 2350 */ 380, 296, 380, 380, 380, 380, 301, 380, 303, 380, + /* 2360 */ 380, 380, 380, 380, 380, 380, 380, 380, 380, 380, + /* 2370 */ 380, 380, 380, 328, 380, 380, 380, 332, 333, 334, + /* 2380 */ 335, 336, 337, 328, 339, 380, 380, 332, 333, 334, + /* 2390 */ 335, 336, 337, 380, 339, }; -#define YY_SHIFT_COUNT (674) +#define YY_SHIFT_COUNT (665) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (1954) +#define YY_SHIFT_MAX (1968) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1005, 0, 0, 62, 62, 268, 268, 268, 330, 330, - /* 10 */ 268, 268, 536, 742, 948, 742, 742, 742, 742, 742, - /* 20 */ 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, - /* 30 */ 742, 742, 742, 742, 742, 742, 742, 742, 742, 742, - /* 40 */ 742, 742, 104, 104, 100, 100, 100, 1170, 1170, 166, - /* 50 */ 1170, 1170, 275, 167, 130, 295, 130, 122, 122, 36, - /* 60 */ 36, 1, 18, 130, 130, 122, 122, 122, 122, 122, - /* 70 */ 122, 122, 122, 122, 59, 122, 122, 122, 319, 339, - /* 80 */ 122, 122, 339, 548, 122, 339, 339, 339, 122, 664, - /* 90 */ 535, 707, 1075, 1075, 108, 217, 217, 217, 217, 217, - /* 100 */ 217, 217, 217, 217, 217, 217, 217, 217, 217, 217, - /* 110 */ 217, 217, 217, 217, 763, 928, 18, 40, 40, 222, - /* 120 */ 385, 233, 333, 333, 333, 385, 588, 588, 319, 4, - /* 130 */ 4, 339, 339, 695, 695, 683, 771, 202, 202, 202, - /* 140 */ 202, 202, 202, 202, 739, 21, 169, 902, 57, 50, - /* 150 */ 10, 171, 640, 832, 19, 803, 814, 806, 643, 749, - /* 160 */ 643, 842, 715, 715, 715, 559, 816, 909, 1123, 1134, - /* 170 */ 1135, 1018, 1145, 1123, 1123, 1145, 1054, 1054, 1123, 1123, - /* 180 */ 1123, 1190, 1190, 1193, 59, 319, 59, 1195, 1202, 59, - /* 190 */ 1195, 59, 1211, 59, 59, 1123, 59, 1190, 339, 339, - /* 200 */ 339, 339, 339, 339, 339, 339, 339, 339, 339, 1123, - /* 210 */ 1190, 695, 1193, 664, 1074, 319, 664, 1123, 1123, 1195, - /* 220 */ 664, 1037, 695, 695, 695, 695, 1037, 695, 1126, 588, - /* 230 */ 1211, 664, 683, 664, 588, 1296, 695, 1083, 1037, 695, - /* 240 */ 695, 1083, 1037, 695, 695, 339, 1089, 1174, 1083, 1091, - /* 250 */ 1093, 1098, 909, 1110, 588, 1324, 1095, 1100, 1111, 1095, - /* 260 */ 1100, 1095, 1100, 1274, 1277, 695, 771, 1123, 664, 1353, - /* 270 */ 1190, 2541, 2541, 2541, 2541, 2541, 2541, 2541, 83, 466, - /* 280 */ 218, 752, 212, 415, 332, 565, 804, 479, 495, 606, - /* 290 */ 884, 884, 884, 884, 884, 884, 884, 884, 658, 864, - /* 300 */ 13, 13, 54, 96, 322, 162, 554, 281, 235, 476, - /* 310 */ 99, 99, 99, 99, 813, 989, 951, 876, 915, 917, - /* 320 */ 942, 467, 996, 1003, 949, 887, 981, 987, 1017, 1027, - /* 330 */ 1029, 1032, 1036, 1080, 967, 463, 847, 1043, 878, 940, - /* 340 */ 572, 1052, 1050, 1057, 1081, 1084, 1085, 1086, 1087, 1010, - /* 350 */ 1088, 1090, 1067, 1131, 1411, 1415, 1236, 1418, 1419, 1380, - /* 360 */ 1420, 1347, 1425, 1391, 1238, 1394, 1396, 1398, 1244, 1435, - /* 370 */ 1401, 1403, 1252, 1443, 1255, 1446, 1412, 1448, 1429, 1450, - /* 380 */ 1417, 1453, 1368, 1280, 1285, 1288, 1291, 1462, 1463, 1299, - /* 390 */ 1301, 1474, 1476, 1431, 1480, 1442, 1496, 1497, 1499, 1351, - /* 400 */ 1501, 1502, 1504, 1505, 1506, 1363, 1477, 1509, 1367, 1516, - /* 410 */ 1518, 1519, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, - /* 420 */ 1530, 1531, 1532, 1492, 1538, 1547, 1548, 1550, 1551, 1552, - /* 430 */ 1514, 1553, 1554, 1555, 1556, 1558, 1503, 1560, 1507, 1561, - /* 440 */ 1565, 1533, 1535, 1534, 1562, 1520, 1566, 1521, 1568, 1539, - /* 450 */ 1543, 1569, 1570, 1572, 1546, 1426, 1590, 1591, 1592, 1540, - /* 460 */ 1601, 1605, 1571, 1563, 1576, 1609, 1581, 1564, 1584, 1625, - /* 470 */ 1593, 1579, 1588, 1630, 1596, 1585, 1594, 1634, 1635, 1636, - /* 480 */ 1637, 1542, 1557, 1603, 1620, 1651, 1614, 1611, 1612, 1617, - /* 490 */ 1621, 1638, 1658, 1639, 1659, 1640, 1615, 1663, 1644, 1632, - /* 500 */ 1668, 1641, 1671, 1643, 1673, 1652, 1655, 1679, 1537, 1645, - /* 510 */ 1681, 1510, 1661, 1541, 1545, 1685, 1687, 1567, 1577, 1688, - /* 520 */ 1689, 1690, 1604, 1602, 1511, 1695, 1618, 1573, 1622, 1700, - /* 530 */ 1682, 1559, 1633, 1624, 1664, 1683, 1491, 1642, 1647, 1646, - /* 540 */ 1648, 1650, 1653, 1686, 1654, 1657, 1660, 1662, 1665, 1698, - /* 550 */ 1684, 1697, 1667, 1704, 1549, 1672, 1692, 1702, 1574, 1707, - /* 560 */ 1706, 1708, 1694, 1710, 1580, 1699, 1725, 1736, 1740, 1742, - /* 570 */ 1744, 1745, 1699, 1785, 1769, 1595, 1751, 1714, 1705, 1715, - /* 580 */ 1721, 1726, 1733, 1750, 1727, 1737, 1782, 1775, 1656, 1748, - /* 590 */ 1738, 1749, 1806, 1808, 1755, 1756, 1810, 1758, 1759, 1813, - /* 600 */ 1761, 1763, 1816, 1765, 1766, 1822, 1770, 1747, 1752, 1753, - /* 610 */ 1757, 1836, 1760, 1774, 1779, 1829, 1780, 1834, 1834, 1857, - /* 620 */ 1819, 1821, 1848, 1849, 1850, 1851, 1852, 1823, 1802, 1854, - /* 630 */ 1859, 1861, 1864, 1870, 1865, 1879, 1867, 1869, 1838, 1611, - /* 640 */ 1872, 1612, 1873, 1874, 1875, 1876, 1878, 1892, 1880, 1916, - /* 650 */ 1882, 1871, 1883, 1919, 1886, 1885, 1884, 1942, 1908, 1897, - /* 660 */ 1907, 1945, 1912, 1902, 1911, 1951, 1917, 1921, 1954, 1935, - /* 670 */ 1937, 1938, 1940, 1943, 1939, + /* 0 */ 917, 0, 0, 62, 62, 264, 264, 264, 326, 326, + /* 10 */ 264, 264, 391, 593, 720, 593, 593, 593, 593, 593, + /* 20 */ 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, + /* 30 */ 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, + /* 40 */ 593, 593, 313, 313, 199, 199, 199, 987, 987, 354, + /* 50 */ 987, 987, 165, 341, 254, 258, 254, 79, 79, 36, + /* 60 */ 36, 97, 18, 254, 254, 79, 79, 79, 79, 79, + /* 70 */ 79, 79, 79, 79, 82, 79, 79, 79, 170, 205, + /* 80 */ 79, 79, 205, 405, 79, 205, 205, 205, 79, 158, + /* 90 */ 719, 662, 683, 683, 108, 371, 371, 371, 371, 371, + /* 100 */ 371, 371, 371, 371, 371, 371, 371, 371, 371, 371, + /* 110 */ 371, 371, 371, 371, 134, 419, 18, 636, 636, 488, + /* 120 */ 551, 562, 90, 90, 90, 551, 526, 526, 170, 16, + /* 130 */ 16, 205, 205, 323, 323, 483, 498, 198, 198, 198, + /* 140 */ 198, 198, 198, 198, 331, 21, 167, 559, 43, 50, + /* 150 */ 112, 168, 99, 421, 19, 530, 771, 755, 717, 603, + /* 160 */ 717, 918, 501, 501, 501, 869, 822, 946, 1132, 1018, + /* 170 */ 1146, 1171, 1171, 1146, 1052, 1052, 1171, 1171, 1171, 1211, + /* 180 */ 1211, 1215, 82, 170, 82, 1217, 1223, 82, 1217, 82, + /* 190 */ 1228, 82, 82, 1171, 82, 1211, 205, 205, 205, 205, + /* 200 */ 205, 205, 205, 205, 205, 205, 205, 1171, 1211, 323, + /* 210 */ 1215, 158, 1093, 170, 158, 1171, 1171, 1217, 158, 1066, + /* 220 */ 323, 323, 323, 323, 1066, 323, 1151, 526, 1228, 158, + /* 230 */ 483, 158, 526, 1294, 323, 1111, 1066, 323, 323, 1111, + /* 240 */ 1066, 323, 323, 205, 1113, 1199, 1111, 1119, 1121, 1134, + /* 250 */ 946, 1139, 526, 1349, 1124, 1129, 1125, 1124, 1129, 1124, + /* 260 */ 1129, 1288, 1289, 323, 498, 1171, 158, 1347, 1211, 2395, + /* 270 */ 2395, 2395, 2395, 2395, 2395, 2395, 83, 456, 214, 307, + /* 280 */ 208, 564, 693, 808, 824, 1044, 1053, 513, 542, 542, + /* 290 */ 542, 542, 542, 542, 542, 542, 545, 129, 13, 13, + /* 300 */ 236, 594, 430, 581, 387, 172, 452, 511, 106, 106, + /* 310 */ 106, 106, 914, 963, 875, 898, 943, 945, 973, 979, + /* 320 */ 1011, 423, 860, 960, 964, 997, 1002, 1021, 1045, 1059, + /* 330 */ 1022, 947, 962, 937, 1006, 904, 1058, 929, 1070, 1043, + /* 340 */ 1097, 1109, 1115, 1120, 1122, 1131, 1005, 1077, 1126, 1098, + /* 350 */ 764, 1416, 1426, 1252, 1430, 1432, 1391, 1436, 1402, 1260, + /* 360 */ 1421, 1422, 1425, 1278, 1466, 1433, 1434, 1280, 1470, 1284, + /* 370 */ 1478, 1438, 1474, 1453, 1476, 1444, 1308, 1312, 1483, 1485, + /* 380 */ 1321, 1324, 1488, 1501, 1456, 1503, 1462, 1505, 1506, 1507, + /* 390 */ 1360, 1510, 1511, 1514, 1516, 1517, 1374, 1484, 1521, 1378, + /* 400 */ 1523, 1524, 1526, 1528, 1529, 1530, 1531, 1532, 1533, 1534, + /* 410 */ 1535, 1536, 1537, 1538, 1500, 1539, 1543, 1550, 1562, 1564, + /* 420 */ 1570, 1545, 1568, 1572, 1573, 1575, 1576, 1498, 1555, 1522, + /* 430 */ 1579, 1580, 1544, 1542, 1547, 1571, 1541, 1577, 1546, 1594, + /* 440 */ 1513, 1556, 1596, 1597, 1599, 1561, 1441, 1603, 1604, 1605, + /* 450 */ 1548, 1607, 1612, 1586, 1578, 1583, 1623, 1592, 1581, 1590, + /* 460 */ 1630, 1600, 1584, 1593, 1634, 1601, 1602, 1608, 1643, 1646, + /* 470 */ 1648, 1650, 1554, 1557, 1626, 1632, 1664, 1631, 1622, 1624, + /* 480 */ 1633, 1635, 1647, 1671, 1652, 1672, 1653, 1627, 1677, 1656, + /* 490 */ 1644, 1680, 1649, 1682, 1654, 1683, 1663, 1667, 1690, 1540, + /* 500 */ 1657, 1694, 1525, 1673, 1551, 1549, 1696, 1700, 1552, 1566, + /* 510 */ 1701, 1702, 1705, 1618, 1620, 1559, 1711, 1625, 1574, 1637, + /* 520 */ 1712, 1684, 1563, 1638, 1629, 1686, 1687, 1515, 1645, 1655, + /* 530 */ 1658, 1659, 1660, 1665, 1709, 1669, 1666, 1674, 1675, 1670, + /* 540 */ 1710, 1719, 1721, 1679, 1727, 1565, 1681, 1685, 1726, 1589, + /* 550 */ 1730, 1731, 1733, 1688, 1737, 1585, 1691, 1747, 1749, 1751, + /* 560 */ 1760, 1762, 1764, 1691, 1800, 1781, 1611, 1768, 1728, 1725, + /* 570 */ 1729, 1734, 1739, 1736, 1773, 1746, 1748, 1774, 1799, 1628, + /* 580 */ 1750, 1722, 1752, 1803, 1805, 1754, 1755, 1809, 1757, 1758, + /* 590 */ 1812, 1761, 1763, 1816, 1769, 1767, 1817, 1770, 1753, 1759, + /* 600 */ 1765, 1771, 1838, 1766, 1772, 1775, 1827, 1776, 1828, 1828, + /* 610 */ 1851, 1813, 1815, 1839, 1842, 1845, 1847, 1848, 1856, 1858, + /* 620 */ 1826, 1811, 1853, 1873, 1874, 1889, 1878, 1892, 1881, 1882, + /* 630 */ 1850, 1622, 1884, 1624, 1888, 1891, 1893, 1894, 1902, 1895, + /* 640 */ 1925, 1896, 1885, 1897, 1927, 1898, 1887, 1899, 1935, 1904, + /* 650 */ 1903, 1901, 1959, 1926, 1913, 1924, 1965, 1931, 1932, 1968, + /* 660 */ 1947, 1949, 1950, 1951, 1954, 1956, }; -#define YY_REDUCE_COUNT (277) -#define YY_REDUCE_MIN (-360) -#define YY_REDUCE_MAX (2198) +#define YY_REDUCE_COUNT (275) +#define YY_REDUCE_MIN (-357) +#define YY_REDUCE_MAX (2055) static const short yy_reduce_ofst[] = { - /* 0 */ 621, -233, 31, 538, 260, 353, 716, 926, 1016, 1066, - /* 10 */ 112, 1133, 1150, 1204, 1258, 1282, 1308, 1366, 1378, 1428, - /* 20 */ 1482, 1494, 1470, 1536, 1589, 1599, 1649, 1670, 1720, 1734, - /* 30 */ 1786, 1800, 1853, 1906, 1956, 1970, 2012, 2026, 2078, 2092, - /* 40 */ 2145, 2198, 950, 1159, -262, 78, 552, 308, 503, 336, - /* 50 */ -287, 95, -121, 34, 209, 450, 653, 366, 533, -267, - /* 60 */ -259, -360, -243, -342, -182, -172, 56, 101, 103, 215, - /* 70 */ 342, 347, 350, 567, 412, 623, 720, 727, -283, -276, - /* 80 */ 730, 750, 469, -4, 786, 32, 563, 474, 798, -208, - /* 90 */ -207, -225, -225, -225, 94, -247, -196, 141, 197, 289, - /* 100 */ 313, 326, 352, 401, 462, 498, 510, 521, 546, 558, - /* 110 */ 616, 660, 672, 673, 304, -100, 85, 244, 428, -46, - /* 120 */ 239, 88, -162, 102, 378, 454, 262, 343, 297, 180, - /* 130 */ 208, -212, 410, -15, 138, 637, 508, 573, 612, 619, - /* 140 */ 625, 627, 646, 698, 710, 775, 667, 824, 706, 833, - /* 150 */ 779, 740, 819, 819, 839, 843, 811, 781, 757, 757, - /* 160 */ 757, 769, 759, 762, 765, 776, 819, 815, 895, 852, - /* 170 */ 907, 863, 877, 919, 922, 891, 886, 898, 933, 937, - /* 180 */ 938, 946, 947, 888, 941, 912, 944, 901, 903, 953, - /* 190 */ 904, 954, 921, 959, 961, 966, 964, 975, 952, 955, - /* 200 */ 956, 957, 960, 962, 963, 965, 968, 969, 976, 970, - /* 210 */ 977, 974, 918, 972, 930, 978, 985, 998, 1001, 971, - /* 220 */ 1000, 973, 979, 983, 988, 999, 994, 1006, 1004, 986, - /* 230 */ 1002, 1009, 1025, 1040, 992, 984, 1015, 958, 1008, 1022, - /* 240 */ 1023, 982, 1019, 1026, 1028, 819, 980, 990, 993, 995, - /* 250 */ 997, 1007, 1012, 757, 1044, 1013, 1011, 1024, 991, 1014, - /* 260 */ 1031, 1021, 1033, 1030, 1079, 1065, 1094, 1105, 1114, 1127, - /* 270 */ 1130, 1069, 1092, 1129, 1132, 1136, 1125, 1151, + /* 0 */ -80, -230, 650, 782, 881, 923, 976, 993, 1056, 1106, + /* 10 */ 34, 1116, 1158, 1212, 1224, 1281, 1305, 1323, 1385, 1403, + /* 20 */ 1455, 1473, 351, 1497, 1553, 1567, 1609, 1619, 1661, 1714, + /* 30 */ 1732, 1784, 1794, 1810, 1864, 1880, 1890, 1906, 1975, 1993, + /* 40 */ 2045, 2055, 376, 676, -259, 76, 142, 117, 687, -180, + /* 50 */ -284, 747, -30, 250, 342, 345, 398, 359, 462, -264, + /* 60 */ -256, -357, -240, -339, -244, 81, 385, 475, 666, 668, + /* 70 */ 669, 673, 702, 734, 148, 767, 803, 852, -280, -273, + /* 80 */ 855, 857, 211, 31, 858, 272, 523, 363, 859, -205, + /* 90 */ -20, -159, -159, -159, -171, -86, 95, 139, 149, 388, + /* 100 */ 413, 420, 466, 476, 512, 514, 524, 548, 570, 574, + /* 110 */ 588, 608, 614, 648, -233, -213, -298, -76, 53, -215, + /* 120 */ 174, 279, 408, 431, 557, 217, 35, 275, 317, 409, + /* 130 */ 467, 91, 540, 590, 595, 675, 565, 328, 340, 368, + /* 140 */ 461, 468, 606, 661, 373, 705, 654, 800, 722, 826, + /* 150 */ 777, 780, 868, 868, 877, 880, 862, 833, 811, 811, + /* 160 */ 811, 819, 798, 799, 801, 813, 868, 850, 853, 870, + /* 170 */ 882, 932, 934, 895, 900, 901, 954, 957, 965, 970, + /* 180 */ 972, 915, 967, 938, 968, 926, 927, 974, 928, 975, + /* 190 */ 941, 980, 982, 995, 989, 1004, 985, 986, 988, 990, + /* 200 */ 994, 996, 998, 999, 1000, 1003, 1007, 1015, 1013, 966, + /* 210 */ 969, 1020, 971, 1014, 1027, 1017, 1030, 983, 1031, 991, + /* 220 */ 1001, 1019, 1033, 1035, 1025, 1037, 1009, 1010, 1034, 1061, + /* 230 */ 1023, 1072, 1049, 1016, 1047, 992, 1039, 1048, 1054, 1008, + /* 240 */ 1041, 1057, 1060, 868, 1012, 1032, 1036, 1024, 1046, 1038, + /* 250 */ 1042, 811, 1071, 1040, 1029, 1028, 1026, 1050, 1055, 1051, + /* 260 */ 1062, 1065, 1088, 1080, 1104, 1117, 1127, 1123, 1144, 1076, + /* 270 */ 1096, 1133, 1138, 1140, 1142, 1163, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 10 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 20 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 30 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 40 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 50 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 60 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 70 */ 1476, 1476, 1476, 1476, 1550, 1476, 1476, 1476, 1476, 1476, - /* 80 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1548, - /* 90 */ 1706, 1476, 1886, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 100 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 110 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1550, - /* 120 */ 1476, 1548, 1898, 1898, 1898, 1476, 1476, 1476, 1476, 1750, - /* 130 */ 1750, 1476, 1476, 1476, 1476, 1648, 1476, 1476, 1476, 1476, - /* 140 */ 1476, 1476, 1476, 1476, 1742, 1476, 1967, 1476, 1476, 1476, - /* 150 */ 1748, 1921, 1476, 1476, 1476, 1476, 1601, 1913, 1890, 1904, - /* 160 */ 1891, 1888, 1952, 1952, 1952, 1907, 1476, 1917, 1476, 1476, - /* 170 */ 1476, 1734, 1711, 1476, 1476, 1711, 1708, 1708, 1476, 1476, - /* 180 */ 1476, 1476, 1476, 1476, 1550, 1476, 1550, 1476, 1476, 1550, - /* 190 */ 1476, 1550, 1476, 1550, 1550, 1476, 1550, 1476, 1476, 1476, - /* 200 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 210 */ 1476, 1476, 1476, 1548, 1744, 1476, 1548, 1476, 1476, 1476, - /* 220 */ 1548, 1926, 1476, 1476, 1476, 1476, 1926, 1476, 1476, 1476, - /* 230 */ 1476, 1548, 1476, 1548, 1476, 1476, 1476, 1928, 1926, 1476, - /* 240 */ 1476, 1928, 1926, 1476, 1476, 1476, 1940, 1936, 1928, 1944, - /* 250 */ 1942, 1919, 1917, 1904, 1476, 1476, 1958, 1954, 1970, 1958, - /* 260 */ 1954, 1958, 1954, 1476, 1617, 1476, 1476, 1476, 1548, 1508, - /* 270 */ 1476, 1736, 1750, 1651, 1651, 1651, 1551, 1481, 1476, 1476, - /* 280 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 290 */ 1823, 1939, 1938, 1862, 1861, 1860, 1858, 1822, 1476, 1613, - /* 300 */ 1821, 1820, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 310 */ 1814, 1815, 1813, 1812, 1476, 1476, 1476, 1476, 1476, 1476, - /* 320 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 330 */ 1476, 1476, 1476, 1887, 1476, 1955, 1959, 1476, 1476, 1476, - /* 340 */ 1476, 1476, 1797, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 350 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 360 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 370 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 380 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 390 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 400 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 410 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 420 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 430 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 440 */ 1476, 1476, 1476, 1513, 1476, 1476, 1476, 1476, 1476, 1476, - /* 450 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 460 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 470 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 480 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1585, 1584, 1476, - /* 490 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 500 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 510 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 520 */ 1476, 1476, 1476, 1476, 1476, 1754, 1476, 1476, 1476, 1476, - /* 530 */ 1476, 1476, 1476, 1476, 1476, 1920, 1476, 1476, 1476, 1476, - /* 540 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 550 */ 1476, 1797, 1476, 1937, 1476, 1897, 1893, 1476, 1476, 1889, - /* 560 */ 1796, 1476, 1476, 1953, 1476, 1476, 1476, 1476, 1476, 1476, - /* 570 */ 1476, 1476, 1476, 1882, 1476, 1476, 1855, 1840, 1476, 1476, - /* 580 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1808, 1476, - /* 590 */ 1476, 1476, 1476, 1476, 1645, 1476, 1476, 1476, 1476, 1476, - /* 600 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1630, 1628, 1627, - /* 610 */ 1626, 1476, 1623, 1476, 1476, 1476, 1476, 1654, 1653, 1476, - /* 620 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1571, - /* 630 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1562, - /* 640 */ 1476, 1561, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 650 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 660 */ 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, 1476, - /* 670 */ 1476, 1476, 1476, 1476, 1476, + /* 0 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 10 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 20 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 30 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 40 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 50 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 60 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 70 */ 1465, 1465, 1465, 1465, 1539, 1465, 1465, 1465, 1465, 1465, + /* 80 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1537, + /* 90 */ 1695, 1465, 1873, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 100 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 110 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1539, + /* 120 */ 1465, 1537, 1885, 1885, 1885, 1465, 1465, 1465, 1465, 1738, + /* 130 */ 1738, 1465, 1465, 1465, 1465, 1637, 1465, 1465, 1465, 1465, + /* 140 */ 1465, 1465, 1465, 1465, 1730, 1465, 1954, 1465, 1465, 1465, + /* 150 */ 1736, 1908, 1465, 1465, 1465, 1465, 1590, 1900, 1877, 1891, + /* 160 */ 1878, 1875, 1939, 1939, 1939, 1894, 1465, 1904, 1465, 1723, + /* 170 */ 1700, 1465, 1465, 1700, 1697, 1697, 1465, 1465, 1465, 1465, + /* 180 */ 1465, 1465, 1539, 1465, 1539, 1465, 1465, 1539, 1465, 1539, + /* 190 */ 1465, 1539, 1539, 1465, 1539, 1465, 1465, 1465, 1465, 1465, + /* 200 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 210 */ 1465, 1537, 1732, 1465, 1537, 1465, 1465, 1465, 1537, 1913, + /* 220 */ 1465, 1465, 1465, 1465, 1913, 1465, 1465, 1465, 1465, 1537, + /* 230 */ 1465, 1537, 1465, 1465, 1465, 1915, 1913, 1465, 1465, 1915, + /* 240 */ 1913, 1465, 1465, 1465, 1927, 1923, 1915, 1931, 1929, 1906, + /* 250 */ 1904, 1891, 1465, 1465, 1945, 1941, 1957, 1945, 1941, 1945, + /* 260 */ 1941, 1465, 1606, 1465, 1465, 1465, 1537, 1497, 1465, 1725, + /* 270 */ 1738, 1640, 1640, 1640, 1540, 1470, 1465, 1465, 1465, 1465, + /* 280 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1810, 1926, + /* 290 */ 1925, 1849, 1848, 1847, 1845, 1809, 1465, 1602, 1808, 1807, + /* 300 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1801, 1802, + /* 310 */ 1800, 1799, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 320 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 330 */ 1874, 1465, 1942, 1946, 1465, 1465, 1465, 1465, 1465, 1784, + /* 340 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 350 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 360 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 370 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 380 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 390 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 400 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 410 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 420 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 430 */ 1465, 1465, 1465, 1465, 1502, 1465, 1465, 1465, 1465, 1465, + /* 440 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 450 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 460 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 470 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1574, 1573, + /* 480 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 490 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 500 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 510 */ 1465, 1465, 1465, 1465, 1465, 1465, 1742, 1465, 1465, 1465, + /* 520 */ 1465, 1465, 1465, 1465, 1465, 1465, 1907, 1465, 1465, 1465, + /* 530 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 540 */ 1465, 1465, 1784, 1465, 1924, 1465, 1884, 1880, 1465, 1465, + /* 550 */ 1876, 1783, 1465, 1465, 1940, 1465, 1465, 1465, 1465, 1465, + /* 560 */ 1465, 1465, 1465, 1465, 1869, 1465, 1465, 1842, 1827, 1465, + /* 570 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1795, + /* 580 */ 1465, 1465, 1465, 1465, 1465, 1634, 1465, 1465, 1465, 1465, + /* 590 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1619, 1617, + /* 600 */ 1616, 1615, 1465, 1612, 1465, 1465, 1465, 1465, 1643, 1642, + /* 610 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 620 */ 1465, 1465, 1558, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 630 */ 1465, 1550, 1465, 1549, 1465, 1465, 1465, 1465, 1465, 1465, + /* 640 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 650 */ 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, 1465, + /* 660 */ 1465, 1465, 1465, 1465, 1465, 1465, }; /********** End of lemon-generated parsing tables *****************************/ @@ -994,7 +962,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* COMP => nothing */ 0, /* DURATION => nothing */ 0, /* NK_VARIABLE => nothing */ - 0, /* FSYNC => nothing */ 0, /* MAXROWS => nothing */ 0, /* MINROWS => nothing */ 0, /* KEEP => nothing */ @@ -1003,11 +970,12 @@ static const YYCODETYPE yyFallback[] = { 0, /* PRECISION => nothing */ 0, /* REPLICA => nothing */ 0, /* STRICT => nothing */ - 0, /* WAL => nothing */ 0, /* VGROUPS => nothing */ 0, /* SINGLE_STABLE => nothing */ 0, /* RETENTIONS => nothing */ 0, /* SCHEMALESS => nothing */ + 0, /* WAL_LEVEL => nothing */ + 0, /* WAL_FSYNC_PERIOD => nothing */ 0, /* WAL_RETENTION_PERIOD => nothing */ 0, /* WAL_RETENTION_SIZE => nothing */ 0, /* WAL_ROLL_PERIOD => nothing */ @@ -1098,9 +1066,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* NK_BOOL => nothing */ 0, /* RATIO => nothing */ 0, /* NK_FLOAT => nothing */ - 0, /* COMPACT => nothing */ - 0, /* VNODES => nothing */ - 0, /* IN => nothing */ 0, /* OUTPUTTYPE => nothing */ 0, /* AGGREGATE => nothing */ 0, /* BUFSIZE => nothing */ @@ -1119,7 +1084,6 @@ static const YYCODETYPE yyFallback[] = { 0, /* MERGE => nothing */ 0, /* REDISTRIBUTE => nothing */ 0, /* SPLIT => nothing */ - 0, /* SYNCDB => nothing */ 0, /* DELETE => nothing */ 0, /* INSERT => nothing */ 0, /* NULL => nothing */ @@ -1153,6 +1117,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* MATCH => nothing */ 0, /* NMATCH => nothing */ 0, /* CONTAINS => nothing */ + 0, /* IN => nothing */ 0, /* JOIN => nothing */ 0, /* INNER => nothing */ 0, /* SELECT => nothing */ @@ -1180,11 +1145,11 @@ static const YYCODETYPE yyFallback[] = { 0, /* ASC => nothing */ 0, /* NULLS => nothing */ 0, /* ID => nothing */ - 254, /* NK_BITNOT => ID */ - 254, /* VALUES => ID */ - 254, /* IMPORT => ID */ - 254, /* NK_SEMI => ID */ - 254, /* FILE => ID */ + 251, /* NK_BITNOT => ID */ + 251, /* VALUES => ID */ + 251, /* IMPORT => ID */ + 251, /* NK_SEMI => ID */ + 251, /* FILE => ID */ }; #endif /* YYFALLBACK */ @@ -1341,20 +1306,20 @@ static const char *const yyTokenName[] = { /* 66 */ "COMP", /* 67 */ "DURATION", /* 68 */ "NK_VARIABLE", - /* 69 */ "FSYNC", - /* 70 */ "MAXROWS", - /* 71 */ "MINROWS", - /* 72 */ "KEEP", - /* 73 */ "PAGES", - /* 74 */ "PAGESIZE", - /* 75 */ "PRECISION", - /* 76 */ "REPLICA", - /* 77 */ "STRICT", - /* 78 */ "WAL", - /* 79 */ "VGROUPS", - /* 80 */ "SINGLE_STABLE", - /* 81 */ "RETENTIONS", - /* 82 */ "SCHEMALESS", + /* 69 */ "MAXROWS", + /* 70 */ "MINROWS", + /* 71 */ "KEEP", + /* 72 */ "PAGES", + /* 73 */ "PAGESIZE", + /* 74 */ "PRECISION", + /* 75 */ "REPLICA", + /* 76 */ "STRICT", + /* 77 */ "VGROUPS", + /* 78 */ "SINGLE_STABLE", + /* 79 */ "RETENTIONS", + /* 80 */ "SCHEMALESS", + /* 81 */ "WAL_LEVEL", + /* 82 */ "WAL_FSYNC_PERIOD", /* 83 */ "WAL_RETENTION_PERIOD", /* 84 */ "WAL_RETENTION_SIZE", /* 85 */ "WAL_ROLL_PERIOD", @@ -1445,216 +1410,213 @@ static const char *const yyTokenName[] = { /* 170 */ "NK_BOOL", /* 171 */ "RATIO", /* 172 */ "NK_FLOAT", - /* 173 */ "COMPACT", - /* 174 */ "VNODES", - /* 175 */ "IN", - /* 176 */ "OUTPUTTYPE", - /* 177 */ "AGGREGATE", - /* 178 */ "BUFSIZE", - /* 179 */ "STREAM", - /* 180 */ "INTO", - /* 181 */ "TRIGGER", - /* 182 */ "AT_ONCE", - /* 183 */ "WINDOW_CLOSE", - /* 184 */ "IGNORE", - /* 185 */ "EXPIRED", - /* 186 */ "KILL", - /* 187 */ "CONNECTION", - /* 188 */ "TRANSACTION", - /* 189 */ "BALANCE", - /* 190 */ "VGROUP", - /* 191 */ "MERGE", - /* 192 */ "REDISTRIBUTE", - /* 193 */ "SPLIT", - /* 194 */ "SYNCDB", - /* 195 */ "DELETE", - /* 196 */ "INSERT", - /* 197 */ "NULL", - /* 198 */ "NK_QUESTION", - /* 199 */ "NK_ARROW", - /* 200 */ "ROWTS", - /* 201 */ "TBNAME", - /* 202 */ "QSTART", - /* 203 */ "QEND", - /* 204 */ "QDURATION", - /* 205 */ "WSTART", - /* 206 */ "WEND", - /* 207 */ "WDURATION", - /* 208 */ "CAST", - /* 209 */ "NOW", - /* 210 */ "TODAY", - /* 211 */ "TIMEZONE", - /* 212 */ "CLIENT_VERSION", - /* 213 */ "SERVER_VERSION", - /* 214 */ "SERVER_STATUS", - /* 215 */ "CURRENT_USER", - /* 216 */ "COUNT", - /* 217 */ "LAST_ROW", - /* 218 */ "BETWEEN", - /* 219 */ "IS", - /* 220 */ "NK_LT", - /* 221 */ "NK_GT", - /* 222 */ "NK_LE", - /* 223 */ "NK_GE", - /* 224 */ "NK_NE", - /* 225 */ "MATCH", - /* 226 */ "NMATCH", - /* 227 */ "CONTAINS", - /* 228 */ "JOIN", - /* 229 */ "INNER", - /* 230 */ "SELECT", - /* 231 */ "DISTINCT", - /* 232 */ "WHERE", - /* 233 */ "PARTITION", - /* 234 */ "BY", - /* 235 */ "SESSION", - /* 236 */ "STATE_WINDOW", - /* 237 */ "SLIDING", - /* 238 */ "FILL", - /* 239 */ "VALUE", - /* 240 */ "NONE", - /* 241 */ "PREV", - /* 242 */ "LINEAR", - /* 243 */ "NEXT", - /* 244 */ "HAVING", - /* 245 */ "RANGE", - /* 246 */ "EVERY", - /* 247 */ "ORDER", - /* 248 */ "SLIMIT", - /* 249 */ "SOFFSET", - /* 250 */ "LIMIT", - /* 251 */ "OFFSET", - /* 252 */ "ASC", - /* 253 */ "NULLS", - /* 254 */ "ID", - /* 255 */ "NK_BITNOT", - /* 256 */ "VALUES", - /* 257 */ "IMPORT", - /* 258 */ "NK_SEMI", - /* 259 */ "FILE", - /* 260 */ "cmd", - /* 261 */ "account_options", - /* 262 */ "alter_account_options", - /* 263 */ "literal", - /* 264 */ "alter_account_option", - /* 265 */ "user_name", - /* 266 */ "sysinfo_opt", - /* 267 */ "privileges", - /* 268 */ "priv_level", - /* 269 */ "priv_type_list", - /* 270 */ "priv_type", - /* 271 */ "db_name", - /* 272 */ "dnode_endpoint", - /* 273 */ "not_exists_opt", - /* 274 */ "db_options", - /* 275 */ "exists_opt", - /* 276 */ "alter_db_options", - /* 277 */ "integer_list", - /* 278 */ "variable_list", - /* 279 */ "retention_list", - /* 280 */ "alter_db_option", - /* 281 */ "retention", - /* 282 */ "full_table_name", - /* 283 */ "column_def_list", - /* 284 */ "tags_def_opt", - /* 285 */ "table_options", - /* 286 */ "multi_create_clause", - /* 287 */ "tags_def", - /* 288 */ "multi_drop_clause", - /* 289 */ "alter_table_clause", - /* 290 */ "alter_table_options", - /* 291 */ "column_name", - /* 292 */ "type_name", - /* 293 */ "signed_literal", - /* 294 */ "create_subtable_clause", - /* 295 */ "specific_cols_opt", - /* 296 */ "expression_list", - /* 297 */ "drop_table_clause", - /* 298 */ "col_name_list", - /* 299 */ "table_name", - /* 300 */ "column_def", - /* 301 */ "duration_list", - /* 302 */ "rollup_func_list", - /* 303 */ "alter_table_option", - /* 304 */ "duration_literal", - /* 305 */ "rollup_func_name", - /* 306 */ "function_name", - /* 307 */ "col_name", - /* 308 */ "db_name_cond_opt", - /* 309 */ "like_pattern_opt", - /* 310 */ "table_name_cond", - /* 311 */ "from_db_opt", - /* 312 */ "index_name", - /* 313 */ "index_options", - /* 314 */ "func_list", - /* 315 */ "sliding_opt", - /* 316 */ "sma_stream_opt", - /* 317 */ "func", - /* 318 */ "stream_options", - /* 319 */ "topic_name", - /* 320 */ "query_expression", - /* 321 */ "cgroup_name", - /* 322 */ "analyze_opt", - /* 323 */ "explain_options", - /* 324 */ "agg_func_opt", - /* 325 */ "bufsize_opt", - /* 326 */ "stream_name", - /* 327 */ "into_opt", - /* 328 */ "dnode_list", - /* 329 */ "where_clause_opt", - /* 330 */ "signed", - /* 331 */ "literal_func", - /* 332 */ "literal_list", - /* 333 */ "table_alias", - /* 334 */ "column_alias", - /* 335 */ "expression", - /* 336 */ "pseudo_column", - /* 337 */ "column_reference", - /* 338 */ "function_expression", - /* 339 */ "subquery", - /* 340 */ "star_func", - /* 341 */ "star_func_para_list", - /* 342 */ "noarg_func", - /* 343 */ "other_para_list", - /* 344 */ "star_func_para", - /* 345 */ "predicate", - /* 346 */ "compare_op", - /* 347 */ "in_op", - /* 348 */ "in_predicate_value", - /* 349 */ "boolean_value_expression", - /* 350 */ "boolean_primary", - /* 351 */ "common_expression", - /* 352 */ "from_clause_opt", - /* 353 */ "table_reference_list", - /* 354 */ "table_reference", - /* 355 */ "table_primary", - /* 356 */ "joined_table", - /* 357 */ "alias_opt", - /* 358 */ "parenthesized_joined_table", - /* 359 */ "join_type", - /* 360 */ "search_condition", - /* 361 */ "query_specification", - /* 362 */ "set_quantifier_opt", - /* 363 */ "select_list", - /* 364 */ "partition_by_clause_opt", - /* 365 */ "range_opt", - /* 366 */ "every_opt", - /* 367 */ "fill_opt", - /* 368 */ "twindow_clause_opt", - /* 369 */ "group_by_clause_opt", - /* 370 */ "having_clause_opt", - /* 371 */ "select_item", - /* 372 */ "fill_mode", - /* 373 */ "group_by_list", - /* 374 */ "query_expression_body", - /* 375 */ "order_by_clause_opt", - /* 376 */ "slimit_clause_opt", - /* 377 */ "limit_clause_opt", - /* 378 */ "query_primary", - /* 379 */ "sort_specification_list", - /* 380 */ "sort_specification", - /* 381 */ "ordering_specification_opt", - /* 382 */ "null_ordering_opt", + /* 173 */ "OUTPUTTYPE", + /* 174 */ "AGGREGATE", + /* 175 */ "BUFSIZE", + /* 176 */ "STREAM", + /* 177 */ "INTO", + /* 178 */ "TRIGGER", + /* 179 */ "AT_ONCE", + /* 180 */ "WINDOW_CLOSE", + /* 181 */ "IGNORE", + /* 182 */ "EXPIRED", + /* 183 */ "KILL", + /* 184 */ "CONNECTION", + /* 185 */ "TRANSACTION", + /* 186 */ "BALANCE", + /* 187 */ "VGROUP", + /* 188 */ "MERGE", + /* 189 */ "REDISTRIBUTE", + /* 190 */ "SPLIT", + /* 191 */ "DELETE", + /* 192 */ "INSERT", + /* 193 */ "NULL", + /* 194 */ "NK_QUESTION", + /* 195 */ "NK_ARROW", + /* 196 */ "ROWTS", + /* 197 */ "TBNAME", + /* 198 */ "QSTART", + /* 199 */ "QEND", + /* 200 */ "QDURATION", + /* 201 */ "WSTART", + /* 202 */ "WEND", + /* 203 */ "WDURATION", + /* 204 */ "CAST", + /* 205 */ "NOW", + /* 206 */ "TODAY", + /* 207 */ "TIMEZONE", + /* 208 */ "CLIENT_VERSION", + /* 209 */ "SERVER_VERSION", + /* 210 */ "SERVER_STATUS", + /* 211 */ "CURRENT_USER", + /* 212 */ "COUNT", + /* 213 */ "LAST_ROW", + /* 214 */ "BETWEEN", + /* 215 */ "IS", + /* 216 */ "NK_LT", + /* 217 */ "NK_GT", + /* 218 */ "NK_LE", + /* 219 */ "NK_GE", + /* 220 */ "NK_NE", + /* 221 */ "MATCH", + /* 222 */ "NMATCH", + /* 223 */ "CONTAINS", + /* 224 */ "IN", + /* 225 */ "JOIN", + /* 226 */ "INNER", + /* 227 */ "SELECT", + /* 228 */ "DISTINCT", + /* 229 */ "WHERE", + /* 230 */ "PARTITION", + /* 231 */ "BY", + /* 232 */ "SESSION", + /* 233 */ "STATE_WINDOW", + /* 234 */ "SLIDING", + /* 235 */ "FILL", + /* 236 */ "VALUE", + /* 237 */ "NONE", + /* 238 */ "PREV", + /* 239 */ "LINEAR", + /* 240 */ "NEXT", + /* 241 */ "HAVING", + /* 242 */ "RANGE", + /* 243 */ "EVERY", + /* 244 */ "ORDER", + /* 245 */ "SLIMIT", + /* 246 */ "SOFFSET", + /* 247 */ "LIMIT", + /* 248 */ "OFFSET", + /* 249 */ "ASC", + /* 250 */ "NULLS", + /* 251 */ "ID", + /* 252 */ "NK_BITNOT", + /* 253 */ "VALUES", + /* 254 */ "IMPORT", + /* 255 */ "NK_SEMI", + /* 256 */ "FILE", + /* 257 */ "cmd", + /* 258 */ "account_options", + /* 259 */ "alter_account_options", + /* 260 */ "literal", + /* 261 */ "alter_account_option", + /* 262 */ "user_name", + /* 263 */ "sysinfo_opt", + /* 264 */ "privileges", + /* 265 */ "priv_level", + /* 266 */ "priv_type_list", + /* 267 */ "priv_type", + /* 268 */ "db_name", + /* 269 */ "dnode_endpoint", + /* 270 */ "not_exists_opt", + /* 271 */ "db_options", + /* 272 */ "exists_opt", + /* 273 */ "alter_db_options", + /* 274 */ "integer_list", + /* 275 */ "variable_list", + /* 276 */ "retention_list", + /* 277 */ "alter_db_option", + /* 278 */ "retention", + /* 279 */ "full_table_name", + /* 280 */ "column_def_list", + /* 281 */ "tags_def_opt", + /* 282 */ "table_options", + /* 283 */ "multi_create_clause", + /* 284 */ "tags_def", + /* 285 */ "multi_drop_clause", + /* 286 */ "alter_table_clause", + /* 287 */ "alter_table_options", + /* 288 */ "column_name", + /* 289 */ "type_name", + /* 290 */ "signed_literal", + /* 291 */ "create_subtable_clause", + /* 292 */ "specific_cols_opt", + /* 293 */ "expression_list", + /* 294 */ "drop_table_clause", + /* 295 */ "col_name_list", + /* 296 */ "table_name", + /* 297 */ "column_def", + /* 298 */ "duration_list", + /* 299 */ "rollup_func_list", + /* 300 */ "alter_table_option", + /* 301 */ "duration_literal", + /* 302 */ "rollup_func_name", + /* 303 */ "function_name", + /* 304 */ "col_name", + /* 305 */ "db_name_cond_opt", + /* 306 */ "like_pattern_opt", + /* 307 */ "table_name_cond", + /* 308 */ "from_db_opt", + /* 309 */ "index_name", + /* 310 */ "index_options", + /* 311 */ "func_list", + /* 312 */ "sliding_opt", + /* 313 */ "sma_stream_opt", + /* 314 */ "func", + /* 315 */ "stream_options", + /* 316 */ "topic_name", + /* 317 */ "query_expression", + /* 318 */ "cgroup_name", + /* 319 */ "analyze_opt", + /* 320 */ "explain_options", + /* 321 */ "agg_func_opt", + /* 322 */ "bufsize_opt", + /* 323 */ "stream_name", + /* 324 */ "into_opt", + /* 325 */ "dnode_list", + /* 326 */ "where_clause_opt", + /* 327 */ "signed", + /* 328 */ "literal_func", + /* 329 */ "literal_list", + /* 330 */ "table_alias", + /* 331 */ "column_alias", + /* 332 */ "expression", + /* 333 */ "pseudo_column", + /* 334 */ "column_reference", + /* 335 */ "function_expression", + /* 336 */ "subquery", + /* 337 */ "star_func", + /* 338 */ "star_func_para_list", + /* 339 */ "noarg_func", + /* 340 */ "other_para_list", + /* 341 */ "star_func_para", + /* 342 */ "predicate", + /* 343 */ "compare_op", + /* 344 */ "in_op", + /* 345 */ "in_predicate_value", + /* 346 */ "boolean_value_expression", + /* 347 */ "boolean_primary", + /* 348 */ "common_expression", + /* 349 */ "from_clause_opt", + /* 350 */ "table_reference_list", + /* 351 */ "table_reference", + /* 352 */ "table_primary", + /* 353 */ "joined_table", + /* 354 */ "alias_opt", + /* 355 */ "parenthesized_joined_table", + /* 356 */ "join_type", + /* 357 */ "search_condition", + /* 358 */ "query_specification", + /* 359 */ "set_quantifier_opt", + /* 360 */ "select_list", + /* 361 */ "partition_by_clause_opt", + /* 362 */ "range_opt", + /* 363 */ "every_opt", + /* 364 */ "fill_opt", + /* 365 */ "twindow_clause_opt", + /* 366 */ "group_by_clause_opt", + /* 367 */ "having_clause_opt", + /* 368 */ "select_item", + /* 369 */ "fill_mode", + /* 370 */ "group_by_list", + /* 371 */ "query_expression_body", + /* 372 */ "order_by_clause_opt", + /* 373 */ "slimit_clause_opt", + /* 374 */ "limit_clause_opt", + /* 375 */ "query_primary", + /* 376 */ "sort_specification_list", + /* 377 */ "sort_specification", + /* 378 */ "ordering_specification_opt", + /* 379 */ "null_ordering_opt", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -1741,21 +1703,21 @@ static const char *const yyRuleName[] = { /* 76 */ "db_options ::= db_options COMP NK_INTEGER", /* 77 */ "db_options ::= db_options DURATION NK_INTEGER", /* 78 */ "db_options ::= db_options DURATION NK_VARIABLE", - /* 79 */ "db_options ::= db_options FSYNC NK_INTEGER", - /* 80 */ "db_options ::= db_options MAXROWS NK_INTEGER", - /* 81 */ "db_options ::= db_options MINROWS NK_INTEGER", - /* 82 */ "db_options ::= db_options KEEP integer_list", - /* 83 */ "db_options ::= db_options KEEP variable_list", - /* 84 */ "db_options ::= db_options PAGES NK_INTEGER", - /* 85 */ "db_options ::= db_options PAGESIZE NK_INTEGER", - /* 86 */ "db_options ::= db_options PRECISION NK_STRING", - /* 87 */ "db_options ::= db_options REPLICA NK_INTEGER", - /* 88 */ "db_options ::= db_options STRICT NK_STRING", - /* 89 */ "db_options ::= db_options WAL NK_INTEGER", - /* 90 */ "db_options ::= db_options VGROUPS NK_INTEGER", - /* 91 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", - /* 92 */ "db_options ::= db_options RETENTIONS retention_list", - /* 93 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", + /* 79 */ "db_options ::= db_options MAXROWS NK_INTEGER", + /* 80 */ "db_options ::= db_options MINROWS NK_INTEGER", + /* 81 */ "db_options ::= db_options KEEP integer_list", + /* 82 */ "db_options ::= db_options KEEP variable_list", + /* 83 */ "db_options ::= db_options PAGES NK_INTEGER", + /* 84 */ "db_options ::= db_options PAGESIZE NK_INTEGER", + /* 85 */ "db_options ::= db_options PRECISION NK_STRING", + /* 86 */ "db_options ::= db_options REPLICA NK_INTEGER", + /* 87 */ "db_options ::= db_options STRICT NK_STRING", + /* 88 */ "db_options ::= db_options VGROUPS NK_INTEGER", + /* 89 */ "db_options ::= db_options SINGLE_STABLE NK_INTEGER", + /* 90 */ "db_options ::= db_options RETENTIONS retention_list", + /* 91 */ "db_options ::= db_options SCHEMALESS NK_INTEGER", + /* 92 */ "db_options ::= db_options WAL_LEVEL NK_INTEGER", + /* 93 */ "db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER", /* 94 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER", /* 95 */ "db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER", /* 96 */ "db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER", @@ -1766,10 +1728,10 @@ static const char *const yyRuleName[] = { /* 101 */ "alter_db_options ::= alter_db_options alter_db_option", /* 102 */ "alter_db_option ::= CACHEMODEL NK_STRING", /* 103 */ "alter_db_option ::= CACHESIZE NK_INTEGER", - /* 104 */ "alter_db_option ::= FSYNC NK_INTEGER", + /* 104 */ "alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER", /* 105 */ "alter_db_option ::= KEEP integer_list", /* 106 */ "alter_db_option ::= KEEP variable_list", - /* 107 */ "alter_db_option ::= WAL NK_INTEGER", + /* 107 */ "alter_db_option ::= WAL_LEVEL NK_INTEGER", /* 108 */ "integer_list ::= NK_INTEGER", /* 109 */ "integer_list ::= integer_list NK_COMMA NK_INTEGER", /* 110 */ "variable_list ::= NK_VARIABLE", @@ -1922,240 +1884,238 @@ static const char *const yyRuleName[] = { /* 257 */ "explain_options ::=", /* 258 */ "explain_options ::= explain_options VERBOSE NK_BOOL", /* 259 */ "explain_options ::= explain_options RATIO NK_FLOAT", - /* 260 */ "cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP", - /* 261 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", - /* 262 */ "cmd ::= DROP FUNCTION exists_opt function_name", - /* 263 */ "agg_func_opt ::=", - /* 264 */ "agg_func_opt ::= AGGREGATE", - /* 265 */ "bufsize_opt ::=", - /* 266 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", - /* 267 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", - /* 268 */ "cmd ::= DROP STREAM exists_opt stream_name", - /* 269 */ "into_opt ::=", - /* 270 */ "into_opt ::= INTO full_table_name", - /* 271 */ "stream_options ::=", - /* 272 */ "stream_options ::= stream_options TRIGGER AT_ONCE", - /* 273 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", - /* 274 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", - /* 275 */ "stream_options ::= stream_options WATERMARK duration_literal", - /* 276 */ "stream_options ::= stream_options IGNORE EXPIRED", - /* 277 */ "cmd ::= KILL CONNECTION NK_INTEGER", - /* 278 */ "cmd ::= KILL QUERY NK_STRING", - /* 279 */ "cmd ::= KILL TRANSACTION NK_INTEGER", - /* 280 */ "cmd ::= BALANCE VGROUP", - /* 281 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", - /* 282 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", - /* 283 */ "cmd ::= SPLIT VGROUP NK_INTEGER", - /* 284 */ "dnode_list ::= DNODE NK_INTEGER", - /* 285 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", - /* 286 */ "cmd ::= SYNCDB db_name REPLICA", - /* 287 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", - /* 288 */ "cmd ::= query_expression", - /* 289 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression", - /* 290 */ "cmd ::= INSERT INTO full_table_name query_expression", - /* 291 */ "literal ::= NK_INTEGER", - /* 292 */ "literal ::= NK_FLOAT", - /* 293 */ "literal ::= NK_STRING", - /* 294 */ "literal ::= NK_BOOL", - /* 295 */ "literal ::= TIMESTAMP NK_STRING", - /* 296 */ "literal ::= duration_literal", - /* 297 */ "literal ::= NULL", - /* 298 */ "literal ::= NK_QUESTION", - /* 299 */ "duration_literal ::= NK_VARIABLE", - /* 300 */ "signed ::= NK_INTEGER", - /* 301 */ "signed ::= NK_PLUS NK_INTEGER", - /* 302 */ "signed ::= NK_MINUS NK_INTEGER", - /* 303 */ "signed ::= NK_FLOAT", - /* 304 */ "signed ::= NK_PLUS NK_FLOAT", - /* 305 */ "signed ::= NK_MINUS NK_FLOAT", - /* 306 */ "signed_literal ::= signed", - /* 307 */ "signed_literal ::= NK_STRING", - /* 308 */ "signed_literal ::= NK_BOOL", - /* 309 */ "signed_literal ::= TIMESTAMP NK_STRING", - /* 310 */ "signed_literal ::= duration_literal", - /* 311 */ "signed_literal ::= NULL", - /* 312 */ "signed_literal ::= literal_func", - /* 313 */ "signed_literal ::= NK_QUESTION", - /* 314 */ "literal_list ::= signed_literal", - /* 315 */ "literal_list ::= literal_list NK_COMMA signed_literal", - /* 316 */ "db_name ::= NK_ID", - /* 317 */ "table_name ::= NK_ID", - /* 318 */ "column_name ::= NK_ID", - /* 319 */ "function_name ::= NK_ID", - /* 320 */ "table_alias ::= NK_ID", - /* 321 */ "column_alias ::= NK_ID", - /* 322 */ "user_name ::= NK_ID", - /* 323 */ "index_name ::= NK_ID", - /* 324 */ "topic_name ::= NK_ID", - /* 325 */ "stream_name ::= NK_ID", - /* 326 */ "cgroup_name ::= NK_ID", - /* 327 */ "expression ::= literal", - /* 328 */ "expression ::= pseudo_column", - /* 329 */ "expression ::= column_reference", - /* 330 */ "expression ::= function_expression", - /* 331 */ "expression ::= subquery", - /* 332 */ "expression ::= NK_LP expression NK_RP", - /* 333 */ "expression ::= NK_PLUS expression", - /* 334 */ "expression ::= NK_MINUS expression", - /* 335 */ "expression ::= expression NK_PLUS expression", - /* 336 */ "expression ::= expression NK_MINUS expression", - /* 337 */ "expression ::= expression NK_STAR expression", - /* 338 */ "expression ::= expression NK_SLASH expression", - /* 339 */ "expression ::= expression NK_REM expression", - /* 340 */ "expression ::= column_reference NK_ARROW NK_STRING", - /* 341 */ "expression ::= expression NK_BITAND expression", - /* 342 */ "expression ::= expression NK_BITOR expression", - /* 343 */ "expression_list ::= expression", - /* 344 */ "expression_list ::= expression_list NK_COMMA expression", - /* 345 */ "column_reference ::= column_name", - /* 346 */ "column_reference ::= table_name NK_DOT column_name", - /* 347 */ "pseudo_column ::= ROWTS", - /* 348 */ "pseudo_column ::= TBNAME", - /* 349 */ "pseudo_column ::= table_name NK_DOT TBNAME", - /* 350 */ "pseudo_column ::= QSTART", - /* 351 */ "pseudo_column ::= QEND", - /* 352 */ "pseudo_column ::= QDURATION", - /* 353 */ "pseudo_column ::= WSTART", - /* 354 */ "pseudo_column ::= WEND", - /* 355 */ "pseudo_column ::= WDURATION", - /* 356 */ "function_expression ::= function_name NK_LP expression_list NK_RP", - /* 357 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", - /* 358 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", - /* 359 */ "function_expression ::= literal_func", - /* 360 */ "literal_func ::= noarg_func NK_LP NK_RP", - /* 361 */ "literal_func ::= NOW", - /* 362 */ "noarg_func ::= NOW", - /* 363 */ "noarg_func ::= TODAY", - /* 364 */ "noarg_func ::= TIMEZONE", - /* 365 */ "noarg_func ::= DATABASE", - /* 366 */ "noarg_func ::= CLIENT_VERSION", - /* 367 */ "noarg_func ::= SERVER_VERSION", - /* 368 */ "noarg_func ::= SERVER_STATUS", - /* 369 */ "noarg_func ::= CURRENT_USER", - /* 370 */ "noarg_func ::= USER", - /* 371 */ "star_func ::= COUNT", - /* 372 */ "star_func ::= FIRST", - /* 373 */ "star_func ::= LAST", - /* 374 */ "star_func ::= LAST_ROW", - /* 375 */ "star_func_para_list ::= NK_STAR", - /* 376 */ "star_func_para_list ::= other_para_list", - /* 377 */ "other_para_list ::= star_func_para", - /* 378 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", - /* 379 */ "star_func_para ::= expression", - /* 380 */ "star_func_para ::= table_name NK_DOT NK_STAR", - /* 381 */ "predicate ::= expression compare_op expression", - /* 382 */ "predicate ::= expression BETWEEN expression AND expression", - /* 383 */ "predicate ::= expression NOT BETWEEN expression AND expression", - /* 384 */ "predicate ::= expression IS NULL", - /* 385 */ "predicate ::= expression IS NOT NULL", - /* 386 */ "predicate ::= expression in_op in_predicate_value", - /* 387 */ "compare_op ::= NK_LT", - /* 388 */ "compare_op ::= NK_GT", - /* 389 */ "compare_op ::= NK_LE", - /* 390 */ "compare_op ::= NK_GE", - /* 391 */ "compare_op ::= NK_NE", - /* 392 */ "compare_op ::= NK_EQ", - /* 393 */ "compare_op ::= LIKE", - /* 394 */ "compare_op ::= NOT LIKE", - /* 395 */ "compare_op ::= MATCH", - /* 396 */ "compare_op ::= NMATCH", - /* 397 */ "compare_op ::= CONTAINS", - /* 398 */ "in_op ::= IN", - /* 399 */ "in_op ::= NOT IN", - /* 400 */ "in_predicate_value ::= NK_LP literal_list NK_RP", - /* 401 */ "boolean_value_expression ::= boolean_primary", - /* 402 */ "boolean_value_expression ::= NOT boolean_primary", - /* 403 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", - /* 404 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", - /* 405 */ "boolean_primary ::= predicate", - /* 406 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", - /* 407 */ "common_expression ::= expression", - /* 408 */ "common_expression ::= boolean_value_expression", - /* 409 */ "from_clause_opt ::=", - /* 410 */ "from_clause_opt ::= FROM table_reference_list", - /* 411 */ "table_reference_list ::= table_reference", - /* 412 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", - /* 413 */ "table_reference ::= table_primary", - /* 414 */ "table_reference ::= joined_table", - /* 415 */ "table_primary ::= table_name alias_opt", - /* 416 */ "table_primary ::= db_name NK_DOT table_name alias_opt", - /* 417 */ "table_primary ::= subquery alias_opt", - /* 418 */ "table_primary ::= parenthesized_joined_table", - /* 419 */ "alias_opt ::=", - /* 420 */ "alias_opt ::= table_alias", - /* 421 */ "alias_opt ::= AS table_alias", - /* 422 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", - /* 423 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", - /* 424 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", - /* 425 */ "join_type ::=", - /* 426 */ "join_type ::= INNER", - /* 427 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", - /* 428 */ "set_quantifier_opt ::=", - /* 429 */ "set_quantifier_opt ::= DISTINCT", - /* 430 */ "set_quantifier_opt ::= ALL", - /* 431 */ "select_list ::= select_item", - /* 432 */ "select_list ::= select_list NK_COMMA select_item", - /* 433 */ "select_item ::= NK_STAR", - /* 434 */ "select_item ::= common_expression", - /* 435 */ "select_item ::= common_expression column_alias", - /* 436 */ "select_item ::= common_expression AS column_alias", - /* 437 */ "select_item ::= table_name NK_DOT NK_STAR", - /* 438 */ "where_clause_opt ::=", - /* 439 */ "where_clause_opt ::= WHERE search_condition", - /* 440 */ "partition_by_clause_opt ::=", - /* 441 */ "partition_by_clause_opt ::= PARTITION BY expression_list", - /* 442 */ "twindow_clause_opt ::=", - /* 443 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", - /* 444 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", - /* 445 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", - /* 446 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", - /* 447 */ "sliding_opt ::=", - /* 448 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", - /* 449 */ "fill_opt ::=", - /* 450 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", - /* 451 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", - /* 452 */ "fill_mode ::= NONE", - /* 453 */ "fill_mode ::= PREV", - /* 454 */ "fill_mode ::= NULL", - /* 455 */ "fill_mode ::= LINEAR", - /* 456 */ "fill_mode ::= NEXT", - /* 457 */ "group_by_clause_opt ::=", - /* 458 */ "group_by_clause_opt ::= GROUP BY group_by_list", - /* 459 */ "group_by_list ::= expression", - /* 460 */ "group_by_list ::= group_by_list NK_COMMA expression", - /* 461 */ "having_clause_opt ::=", - /* 462 */ "having_clause_opt ::= HAVING search_condition", - /* 463 */ "range_opt ::=", - /* 464 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", - /* 465 */ "every_opt ::=", - /* 466 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", - /* 467 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", - /* 468 */ "query_expression_body ::= query_primary", - /* 469 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", - /* 470 */ "query_expression_body ::= query_expression_body UNION query_expression_body", - /* 471 */ "query_primary ::= query_specification", - /* 472 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", - /* 473 */ "order_by_clause_opt ::=", - /* 474 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", - /* 475 */ "slimit_clause_opt ::=", - /* 476 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", - /* 477 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", - /* 478 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 479 */ "limit_clause_opt ::=", - /* 480 */ "limit_clause_opt ::= LIMIT NK_INTEGER", - /* 481 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", - /* 482 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", - /* 483 */ "subquery ::= NK_LP query_expression NK_RP", - /* 484 */ "search_condition ::= common_expression", - /* 485 */ "sort_specification_list ::= sort_specification", - /* 486 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", - /* 487 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", - /* 488 */ "ordering_specification_opt ::=", - /* 489 */ "ordering_specification_opt ::= ASC", - /* 490 */ "ordering_specification_opt ::= DESC", - /* 491 */ "null_ordering_opt ::=", - /* 492 */ "null_ordering_opt ::= NULLS FIRST", - /* 493 */ "null_ordering_opt ::= NULLS LAST", + /* 260 */ "cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt", + /* 261 */ "cmd ::= DROP FUNCTION exists_opt function_name", + /* 262 */ "agg_func_opt ::=", + /* 263 */ "agg_func_opt ::= AGGREGATE", + /* 264 */ "bufsize_opt ::=", + /* 265 */ "bufsize_opt ::= BUFSIZE NK_INTEGER", + /* 266 */ "cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression", + /* 267 */ "cmd ::= DROP STREAM exists_opt stream_name", + /* 268 */ "into_opt ::=", + /* 269 */ "into_opt ::= INTO full_table_name", + /* 270 */ "stream_options ::=", + /* 271 */ "stream_options ::= stream_options TRIGGER AT_ONCE", + /* 272 */ "stream_options ::= stream_options TRIGGER WINDOW_CLOSE", + /* 273 */ "stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal", + /* 274 */ "stream_options ::= stream_options WATERMARK duration_literal", + /* 275 */ "stream_options ::= stream_options IGNORE EXPIRED", + /* 276 */ "cmd ::= KILL CONNECTION NK_INTEGER", + /* 277 */ "cmd ::= KILL QUERY NK_STRING", + /* 278 */ "cmd ::= KILL TRANSACTION NK_INTEGER", + /* 279 */ "cmd ::= BALANCE VGROUP", + /* 280 */ "cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER", + /* 281 */ "cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list", + /* 282 */ "cmd ::= SPLIT VGROUP NK_INTEGER", + /* 283 */ "dnode_list ::= DNODE NK_INTEGER", + /* 284 */ "dnode_list ::= dnode_list DNODE NK_INTEGER", + /* 285 */ "cmd ::= DELETE FROM full_table_name where_clause_opt", + /* 286 */ "cmd ::= query_expression", + /* 287 */ "cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression", + /* 288 */ "cmd ::= INSERT INTO full_table_name query_expression", + /* 289 */ "literal ::= NK_INTEGER", + /* 290 */ "literal ::= NK_FLOAT", + /* 291 */ "literal ::= NK_STRING", + /* 292 */ "literal ::= NK_BOOL", + /* 293 */ "literal ::= TIMESTAMP NK_STRING", + /* 294 */ "literal ::= duration_literal", + /* 295 */ "literal ::= NULL", + /* 296 */ "literal ::= NK_QUESTION", + /* 297 */ "duration_literal ::= NK_VARIABLE", + /* 298 */ "signed ::= NK_INTEGER", + /* 299 */ "signed ::= NK_PLUS NK_INTEGER", + /* 300 */ "signed ::= NK_MINUS NK_INTEGER", + /* 301 */ "signed ::= NK_FLOAT", + /* 302 */ "signed ::= NK_PLUS NK_FLOAT", + /* 303 */ "signed ::= NK_MINUS NK_FLOAT", + /* 304 */ "signed_literal ::= signed", + /* 305 */ "signed_literal ::= NK_STRING", + /* 306 */ "signed_literal ::= NK_BOOL", + /* 307 */ "signed_literal ::= TIMESTAMP NK_STRING", + /* 308 */ "signed_literal ::= duration_literal", + /* 309 */ "signed_literal ::= NULL", + /* 310 */ "signed_literal ::= literal_func", + /* 311 */ "signed_literal ::= NK_QUESTION", + /* 312 */ "literal_list ::= signed_literal", + /* 313 */ "literal_list ::= literal_list NK_COMMA signed_literal", + /* 314 */ "db_name ::= NK_ID", + /* 315 */ "table_name ::= NK_ID", + /* 316 */ "column_name ::= NK_ID", + /* 317 */ "function_name ::= NK_ID", + /* 318 */ "table_alias ::= NK_ID", + /* 319 */ "column_alias ::= NK_ID", + /* 320 */ "user_name ::= NK_ID", + /* 321 */ "index_name ::= NK_ID", + /* 322 */ "topic_name ::= NK_ID", + /* 323 */ "stream_name ::= NK_ID", + /* 324 */ "cgroup_name ::= NK_ID", + /* 325 */ "expression ::= literal", + /* 326 */ "expression ::= pseudo_column", + /* 327 */ "expression ::= column_reference", + /* 328 */ "expression ::= function_expression", + /* 329 */ "expression ::= subquery", + /* 330 */ "expression ::= NK_LP expression NK_RP", + /* 331 */ "expression ::= NK_PLUS expression", + /* 332 */ "expression ::= NK_MINUS expression", + /* 333 */ "expression ::= expression NK_PLUS expression", + /* 334 */ "expression ::= expression NK_MINUS expression", + /* 335 */ "expression ::= expression NK_STAR expression", + /* 336 */ "expression ::= expression NK_SLASH expression", + /* 337 */ "expression ::= expression NK_REM expression", + /* 338 */ "expression ::= column_reference NK_ARROW NK_STRING", + /* 339 */ "expression ::= expression NK_BITAND expression", + /* 340 */ "expression ::= expression NK_BITOR expression", + /* 341 */ "expression_list ::= expression", + /* 342 */ "expression_list ::= expression_list NK_COMMA expression", + /* 343 */ "column_reference ::= column_name", + /* 344 */ "column_reference ::= table_name NK_DOT column_name", + /* 345 */ "pseudo_column ::= ROWTS", + /* 346 */ "pseudo_column ::= TBNAME", + /* 347 */ "pseudo_column ::= table_name NK_DOT TBNAME", + /* 348 */ "pseudo_column ::= QSTART", + /* 349 */ "pseudo_column ::= QEND", + /* 350 */ "pseudo_column ::= QDURATION", + /* 351 */ "pseudo_column ::= WSTART", + /* 352 */ "pseudo_column ::= WEND", + /* 353 */ "pseudo_column ::= WDURATION", + /* 354 */ "function_expression ::= function_name NK_LP expression_list NK_RP", + /* 355 */ "function_expression ::= star_func NK_LP star_func_para_list NK_RP", + /* 356 */ "function_expression ::= CAST NK_LP expression AS type_name NK_RP", + /* 357 */ "function_expression ::= literal_func", + /* 358 */ "literal_func ::= noarg_func NK_LP NK_RP", + /* 359 */ "literal_func ::= NOW", + /* 360 */ "noarg_func ::= NOW", + /* 361 */ "noarg_func ::= TODAY", + /* 362 */ "noarg_func ::= TIMEZONE", + /* 363 */ "noarg_func ::= DATABASE", + /* 364 */ "noarg_func ::= CLIENT_VERSION", + /* 365 */ "noarg_func ::= SERVER_VERSION", + /* 366 */ "noarg_func ::= SERVER_STATUS", + /* 367 */ "noarg_func ::= CURRENT_USER", + /* 368 */ "noarg_func ::= USER", + /* 369 */ "star_func ::= COUNT", + /* 370 */ "star_func ::= FIRST", + /* 371 */ "star_func ::= LAST", + /* 372 */ "star_func ::= LAST_ROW", + /* 373 */ "star_func_para_list ::= NK_STAR", + /* 374 */ "star_func_para_list ::= other_para_list", + /* 375 */ "other_para_list ::= star_func_para", + /* 376 */ "other_para_list ::= other_para_list NK_COMMA star_func_para", + /* 377 */ "star_func_para ::= expression", + /* 378 */ "star_func_para ::= table_name NK_DOT NK_STAR", + /* 379 */ "predicate ::= expression compare_op expression", + /* 380 */ "predicate ::= expression BETWEEN expression AND expression", + /* 381 */ "predicate ::= expression NOT BETWEEN expression AND expression", + /* 382 */ "predicate ::= expression IS NULL", + /* 383 */ "predicate ::= expression IS NOT NULL", + /* 384 */ "predicate ::= expression in_op in_predicate_value", + /* 385 */ "compare_op ::= NK_LT", + /* 386 */ "compare_op ::= NK_GT", + /* 387 */ "compare_op ::= NK_LE", + /* 388 */ "compare_op ::= NK_GE", + /* 389 */ "compare_op ::= NK_NE", + /* 390 */ "compare_op ::= NK_EQ", + /* 391 */ "compare_op ::= LIKE", + /* 392 */ "compare_op ::= NOT LIKE", + /* 393 */ "compare_op ::= MATCH", + /* 394 */ "compare_op ::= NMATCH", + /* 395 */ "compare_op ::= CONTAINS", + /* 396 */ "in_op ::= IN", + /* 397 */ "in_op ::= NOT IN", + /* 398 */ "in_predicate_value ::= NK_LP literal_list NK_RP", + /* 399 */ "boolean_value_expression ::= boolean_primary", + /* 400 */ "boolean_value_expression ::= NOT boolean_primary", + /* 401 */ "boolean_value_expression ::= boolean_value_expression OR boolean_value_expression", + /* 402 */ "boolean_value_expression ::= boolean_value_expression AND boolean_value_expression", + /* 403 */ "boolean_primary ::= predicate", + /* 404 */ "boolean_primary ::= NK_LP boolean_value_expression NK_RP", + /* 405 */ "common_expression ::= expression", + /* 406 */ "common_expression ::= boolean_value_expression", + /* 407 */ "from_clause_opt ::=", + /* 408 */ "from_clause_opt ::= FROM table_reference_list", + /* 409 */ "table_reference_list ::= table_reference", + /* 410 */ "table_reference_list ::= table_reference_list NK_COMMA table_reference", + /* 411 */ "table_reference ::= table_primary", + /* 412 */ "table_reference ::= joined_table", + /* 413 */ "table_primary ::= table_name alias_opt", + /* 414 */ "table_primary ::= db_name NK_DOT table_name alias_opt", + /* 415 */ "table_primary ::= subquery alias_opt", + /* 416 */ "table_primary ::= parenthesized_joined_table", + /* 417 */ "alias_opt ::=", + /* 418 */ "alias_opt ::= table_alias", + /* 419 */ "alias_opt ::= AS table_alias", + /* 420 */ "parenthesized_joined_table ::= NK_LP joined_table NK_RP", + /* 421 */ "parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP", + /* 422 */ "joined_table ::= table_reference join_type JOIN table_reference ON search_condition", + /* 423 */ "join_type ::=", + /* 424 */ "join_type ::= INNER", + /* 425 */ "query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt", + /* 426 */ "set_quantifier_opt ::=", + /* 427 */ "set_quantifier_opt ::= DISTINCT", + /* 428 */ "set_quantifier_opt ::= ALL", + /* 429 */ "select_list ::= select_item", + /* 430 */ "select_list ::= select_list NK_COMMA select_item", + /* 431 */ "select_item ::= NK_STAR", + /* 432 */ "select_item ::= common_expression", + /* 433 */ "select_item ::= common_expression column_alias", + /* 434 */ "select_item ::= common_expression AS column_alias", + /* 435 */ "select_item ::= table_name NK_DOT NK_STAR", + /* 436 */ "where_clause_opt ::=", + /* 437 */ "where_clause_opt ::= WHERE search_condition", + /* 438 */ "partition_by_clause_opt ::=", + /* 439 */ "partition_by_clause_opt ::= PARTITION BY expression_list", + /* 440 */ "twindow_clause_opt ::=", + /* 441 */ "twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP", + /* 442 */ "twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP", + /* 443 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt", + /* 444 */ "twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt", + /* 445 */ "sliding_opt ::=", + /* 446 */ "sliding_opt ::= SLIDING NK_LP duration_literal NK_RP", + /* 447 */ "fill_opt ::=", + /* 448 */ "fill_opt ::= FILL NK_LP fill_mode NK_RP", + /* 449 */ "fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP", + /* 450 */ "fill_mode ::= NONE", + /* 451 */ "fill_mode ::= PREV", + /* 452 */ "fill_mode ::= NULL", + /* 453 */ "fill_mode ::= LINEAR", + /* 454 */ "fill_mode ::= NEXT", + /* 455 */ "group_by_clause_opt ::=", + /* 456 */ "group_by_clause_opt ::= GROUP BY group_by_list", + /* 457 */ "group_by_list ::= expression", + /* 458 */ "group_by_list ::= group_by_list NK_COMMA expression", + /* 459 */ "having_clause_opt ::=", + /* 460 */ "having_clause_opt ::= HAVING search_condition", + /* 461 */ "range_opt ::=", + /* 462 */ "range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP", + /* 463 */ "every_opt ::=", + /* 464 */ "every_opt ::= EVERY NK_LP duration_literal NK_RP", + /* 465 */ "query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt", + /* 466 */ "query_expression_body ::= query_primary", + /* 467 */ "query_expression_body ::= query_expression_body UNION ALL query_expression_body", + /* 468 */ "query_expression_body ::= query_expression_body UNION query_expression_body", + /* 469 */ "query_primary ::= query_specification", + /* 470 */ "query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP", + /* 471 */ "order_by_clause_opt ::=", + /* 472 */ "order_by_clause_opt ::= ORDER BY sort_specification_list", + /* 473 */ "slimit_clause_opt ::=", + /* 474 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER", + /* 475 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER", + /* 476 */ "slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 477 */ "limit_clause_opt ::=", + /* 478 */ "limit_clause_opt ::= LIMIT NK_INTEGER", + /* 479 */ "limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER", + /* 480 */ "limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER", + /* 481 */ "subquery ::= NK_LP query_expression NK_RP", + /* 482 */ "search_condition ::= common_expression", + /* 483 */ "sort_specification_list ::= sort_specification", + /* 484 */ "sort_specification_list ::= sort_specification_list NK_COMMA sort_specification", + /* 485 */ "sort_specification ::= expression ordering_specification_opt null_ordering_opt", + /* 486 */ "ordering_specification_opt ::=", + /* 487 */ "ordering_specification_opt ::= ASC", + /* 488 */ "ordering_specification_opt ::= DESC", + /* 489 */ "null_ordering_opt ::=", + /* 490 */ "null_ordering_opt ::= NULLS FIRST", + /* 491 */ "null_ordering_opt ::= NULLS LAST", }; #endif /* NDEBUG */ @@ -2282,181 +2242,181 @@ static void yy_destructor( */ /********* Begin destructor definitions ***************************************/ /* Default NON-TERMINAL Destructor */ - case 260: /* cmd */ - case 263: /* literal */ - case 274: /* db_options */ - case 276: /* alter_db_options */ - case 281: /* retention */ - case 282: /* full_table_name */ - case 285: /* table_options */ - case 289: /* alter_table_clause */ - case 290: /* alter_table_options */ - case 293: /* signed_literal */ - case 294: /* create_subtable_clause */ - case 297: /* drop_table_clause */ - case 300: /* column_def */ - case 304: /* duration_literal */ - case 305: /* rollup_func_name */ - case 307: /* col_name */ - case 308: /* db_name_cond_opt */ - case 309: /* like_pattern_opt */ - case 310: /* table_name_cond */ - case 311: /* from_db_opt */ - case 313: /* index_options */ - case 315: /* sliding_opt */ - case 316: /* sma_stream_opt */ - case 317: /* func */ - case 318: /* stream_options */ - case 320: /* query_expression */ - case 323: /* explain_options */ - case 327: /* into_opt */ - case 329: /* where_clause_opt */ - case 330: /* signed */ - case 331: /* literal_func */ - case 335: /* expression */ - case 336: /* pseudo_column */ - case 337: /* column_reference */ - case 338: /* function_expression */ - case 339: /* subquery */ - case 344: /* star_func_para */ - case 345: /* predicate */ - case 348: /* in_predicate_value */ - case 349: /* boolean_value_expression */ - case 350: /* boolean_primary */ - case 351: /* common_expression */ - case 352: /* from_clause_opt */ - case 353: /* table_reference_list */ - case 354: /* table_reference */ - case 355: /* table_primary */ - case 356: /* joined_table */ - case 358: /* parenthesized_joined_table */ - case 360: /* search_condition */ - case 361: /* query_specification */ - case 365: /* range_opt */ - case 366: /* every_opt */ - case 367: /* fill_opt */ - case 368: /* twindow_clause_opt */ - case 370: /* having_clause_opt */ - case 371: /* select_item */ - case 374: /* query_expression_body */ - case 376: /* slimit_clause_opt */ - case 377: /* limit_clause_opt */ - case 378: /* query_primary */ - case 380: /* sort_specification */ + case 257: /* cmd */ + case 260: /* literal */ + case 271: /* db_options */ + case 273: /* alter_db_options */ + case 278: /* retention */ + case 279: /* full_table_name */ + case 282: /* table_options */ + case 286: /* alter_table_clause */ + case 287: /* alter_table_options */ + case 290: /* signed_literal */ + case 291: /* create_subtable_clause */ + case 294: /* drop_table_clause */ + case 297: /* column_def */ + case 301: /* duration_literal */ + case 302: /* rollup_func_name */ + case 304: /* col_name */ + case 305: /* db_name_cond_opt */ + case 306: /* like_pattern_opt */ + case 307: /* table_name_cond */ + case 308: /* from_db_opt */ + case 310: /* index_options */ + case 312: /* sliding_opt */ + case 313: /* sma_stream_opt */ + case 314: /* func */ + case 315: /* stream_options */ + case 317: /* query_expression */ + case 320: /* explain_options */ + case 324: /* into_opt */ + case 326: /* where_clause_opt */ + case 327: /* signed */ + case 328: /* literal_func */ + case 332: /* expression */ + case 333: /* pseudo_column */ + case 334: /* column_reference */ + case 335: /* function_expression */ + case 336: /* subquery */ + case 341: /* star_func_para */ + case 342: /* predicate */ + case 345: /* in_predicate_value */ + case 346: /* boolean_value_expression */ + case 347: /* boolean_primary */ + case 348: /* common_expression */ + case 349: /* from_clause_opt */ + case 350: /* table_reference_list */ + case 351: /* table_reference */ + case 352: /* table_primary */ + case 353: /* joined_table */ + case 355: /* parenthesized_joined_table */ + case 357: /* search_condition */ + case 358: /* query_specification */ + case 362: /* range_opt */ + case 363: /* every_opt */ + case 364: /* fill_opt */ + case 365: /* twindow_clause_opt */ + case 367: /* having_clause_opt */ + case 368: /* select_item */ + case 371: /* query_expression_body */ + case 373: /* slimit_clause_opt */ + case 374: /* limit_clause_opt */ + case 375: /* query_primary */ + case 377: /* sort_specification */ { - nodesDestroyNode((yypminor->yy160)); + nodesDestroyNode((yypminor->yy712)); } break; - case 261: /* account_options */ - case 262: /* alter_account_options */ - case 264: /* alter_account_option */ - case 325: /* bufsize_opt */ + case 258: /* account_options */ + case 259: /* alter_account_options */ + case 261: /* alter_account_option */ + case 322: /* bufsize_opt */ { } break; - case 265: /* user_name */ - case 268: /* priv_level */ - case 271: /* db_name */ - case 272: /* dnode_endpoint */ - case 291: /* column_name */ - case 299: /* table_name */ - case 306: /* function_name */ - case 312: /* index_name */ - case 319: /* topic_name */ - case 321: /* cgroup_name */ - case 326: /* stream_name */ - case 333: /* table_alias */ - case 334: /* column_alias */ - case 340: /* star_func */ - case 342: /* noarg_func */ - case 357: /* alias_opt */ + case 262: /* user_name */ + case 265: /* priv_level */ + case 268: /* db_name */ + case 269: /* dnode_endpoint */ + case 288: /* column_name */ + case 296: /* table_name */ + case 303: /* function_name */ + case 309: /* index_name */ + case 316: /* topic_name */ + case 318: /* cgroup_name */ + case 323: /* stream_name */ + case 330: /* table_alias */ + case 331: /* column_alias */ + case 337: /* star_func */ + case 339: /* noarg_func */ + case 354: /* alias_opt */ { } break; - case 266: /* sysinfo_opt */ + case 263: /* sysinfo_opt */ { } break; - case 267: /* privileges */ - case 269: /* priv_type_list */ - case 270: /* priv_type */ + case 264: /* privileges */ + case 266: /* priv_type_list */ + case 267: /* priv_type */ { } break; - case 273: /* not_exists_opt */ - case 275: /* exists_opt */ - case 322: /* analyze_opt */ - case 324: /* agg_func_opt */ - case 362: /* set_quantifier_opt */ + case 270: /* not_exists_opt */ + case 272: /* exists_opt */ + case 319: /* analyze_opt */ + case 321: /* agg_func_opt */ + case 359: /* set_quantifier_opt */ { } break; - case 277: /* integer_list */ - case 278: /* variable_list */ - case 279: /* retention_list */ - case 283: /* column_def_list */ - case 284: /* tags_def_opt */ - case 286: /* multi_create_clause */ - case 287: /* tags_def */ - case 288: /* multi_drop_clause */ - case 295: /* specific_cols_opt */ - case 296: /* expression_list */ - case 298: /* col_name_list */ - case 301: /* duration_list */ - case 302: /* rollup_func_list */ - case 314: /* func_list */ - case 328: /* dnode_list */ - case 332: /* literal_list */ - case 341: /* star_func_para_list */ - case 343: /* other_para_list */ - case 363: /* select_list */ - case 364: /* partition_by_clause_opt */ - case 369: /* group_by_clause_opt */ - case 373: /* group_by_list */ - case 375: /* order_by_clause_opt */ - case 379: /* sort_specification_list */ + case 274: /* integer_list */ + case 275: /* variable_list */ + case 276: /* retention_list */ + case 280: /* column_def_list */ + case 281: /* tags_def_opt */ + case 283: /* multi_create_clause */ + case 284: /* tags_def */ + case 285: /* multi_drop_clause */ + case 292: /* specific_cols_opt */ + case 293: /* expression_list */ + case 295: /* col_name_list */ + case 298: /* duration_list */ + case 299: /* rollup_func_list */ + case 311: /* func_list */ + case 325: /* dnode_list */ + case 329: /* literal_list */ + case 338: /* star_func_para_list */ + case 340: /* other_para_list */ + case 360: /* select_list */ + case 361: /* partition_by_clause_opt */ + case 366: /* group_by_clause_opt */ + case 370: /* group_by_list */ + case 372: /* order_by_clause_opt */ + case 376: /* sort_specification_list */ { - nodesDestroyList((yypminor->yy180)); + nodesDestroyList((yypminor->yy464)); } break; - case 280: /* alter_db_option */ - case 303: /* alter_table_option */ + case 277: /* alter_db_option */ + case 300: /* alter_table_option */ { } break; - case 292: /* type_name */ + case 289: /* type_name */ { } break; - case 346: /* compare_op */ - case 347: /* in_op */ + case 343: /* compare_op */ + case 344: /* in_op */ { } break; - case 359: /* join_type */ + case 356: /* join_type */ { } break; - case 372: /* fill_mode */ + case 369: /* fill_mode */ { } break; - case 381: /* ordering_specification_opt */ + case 378: /* ordering_specification_opt */ { } break; - case 382: /* null_ordering_opt */ + case 379: /* null_ordering_opt */ { } @@ -2755,500 +2715,498 @@ 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[] = { - { 260, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ - { 260, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ - { 261, 0 }, /* (2) account_options ::= */ - { 261, -3 }, /* (3) account_options ::= account_options PPS literal */ - { 261, -3 }, /* (4) account_options ::= account_options TSERIES literal */ - { 261, -3 }, /* (5) account_options ::= account_options STORAGE literal */ - { 261, -3 }, /* (6) account_options ::= account_options STREAMS literal */ - { 261, -3 }, /* (7) account_options ::= account_options QTIME literal */ - { 261, -3 }, /* (8) account_options ::= account_options DBS literal */ - { 261, -3 }, /* (9) account_options ::= account_options USERS literal */ - { 261, -3 }, /* (10) account_options ::= account_options CONNS literal */ - { 261, -3 }, /* (11) account_options ::= account_options STATE literal */ - { 262, -1 }, /* (12) alter_account_options ::= alter_account_option */ - { 262, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ - { 264, -2 }, /* (14) alter_account_option ::= PASS literal */ - { 264, -2 }, /* (15) alter_account_option ::= PPS literal */ - { 264, -2 }, /* (16) alter_account_option ::= TSERIES literal */ - { 264, -2 }, /* (17) alter_account_option ::= STORAGE literal */ - { 264, -2 }, /* (18) alter_account_option ::= STREAMS literal */ - { 264, -2 }, /* (19) alter_account_option ::= QTIME literal */ - { 264, -2 }, /* (20) alter_account_option ::= DBS literal */ - { 264, -2 }, /* (21) alter_account_option ::= USERS literal */ - { 264, -2 }, /* (22) alter_account_option ::= CONNS literal */ - { 264, -2 }, /* (23) alter_account_option ::= STATE literal */ - { 260, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ - { 260, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ - { 260, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ - { 260, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ - { 260, -3 }, /* (28) cmd ::= DROP USER user_name */ - { 266, 0 }, /* (29) sysinfo_opt ::= */ - { 266, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ - { 260, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ - { 260, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ - { 267, -1 }, /* (33) privileges ::= ALL */ - { 267, -1 }, /* (34) privileges ::= priv_type_list */ - { 269, -1 }, /* (35) priv_type_list ::= priv_type */ - { 269, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ - { 270, -1 }, /* (37) priv_type ::= READ */ - { 270, -1 }, /* (38) priv_type ::= WRITE */ - { 268, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ - { 268, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ - { 260, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ - { 260, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ - { 260, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ - { 260, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ - { 260, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ - { 260, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ - { 260, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ - { 260, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ - { 272, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ - { 272, -1 }, /* (50) dnode_endpoint ::= NK_ID */ - { 272, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ - { 260, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ - { 260, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ - { 260, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ - { 260, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ - { 260, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ - { 260, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ - { 260, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ - { 260, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ - { 260, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ - { 260, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ - { 260, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ - { 260, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ - { 260, -2 }, /* (64) cmd ::= USE db_name */ - { 260, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ - { 260, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ - { 260, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */ - { 273, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ - { 273, 0 }, /* (69) not_exists_opt ::= */ - { 275, -2 }, /* (70) exists_opt ::= IF EXISTS */ - { 275, 0 }, /* (71) exists_opt ::= */ - { 274, 0 }, /* (72) db_options ::= */ - { 274, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ - { 274, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */ - { 274, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */ - { 274, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ - { 274, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ - { 274, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ - { 274, -3 }, /* (79) db_options ::= db_options FSYNC NK_INTEGER */ - { 274, -3 }, /* (80) db_options ::= db_options MAXROWS NK_INTEGER */ - { 274, -3 }, /* (81) db_options ::= db_options MINROWS NK_INTEGER */ - { 274, -3 }, /* (82) db_options ::= db_options KEEP integer_list */ - { 274, -3 }, /* (83) db_options ::= db_options KEEP variable_list */ - { 274, -3 }, /* (84) db_options ::= db_options PAGES NK_INTEGER */ - { 274, -3 }, /* (85) db_options ::= db_options PAGESIZE NK_INTEGER */ - { 274, -3 }, /* (86) db_options ::= db_options PRECISION NK_STRING */ - { 274, -3 }, /* (87) db_options ::= db_options REPLICA NK_INTEGER */ - { 274, -3 }, /* (88) db_options ::= db_options STRICT NK_STRING */ - { 274, -3 }, /* (89) db_options ::= db_options WAL NK_INTEGER */ - { 274, -3 }, /* (90) db_options ::= db_options VGROUPS NK_INTEGER */ - { 274, -3 }, /* (91) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ - { 274, -3 }, /* (92) db_options ::= db_options RETENTIONS retention_list */ - { 274, -3 }, /* (93) db_options ::= db_options SCHEMALESS NK_INTEGER */ - { 274, -3 }, /* (94) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ - { 274, -4 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ - { 274, -3 }, /* (96) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ - { 274, -4 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ - { 274, -3 }, /* (98) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ - { 274, -3 }, /* (99) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ - { 276, -1 }, /* (100) alter_db_options ::= alter_db_option */ - { 276, -2 }, /* (101) alter_db_options ::= alter_db_options alter_db_option */ - { 280, -2 }, /* (102) alter_db_option ::= CACHEMODEL NK_STRING */ - { 280, -2 }, /* (103) alter_db_option ::= CACHESIZE NK_INTEGER */ - { 280, -2 }, /* (104) alter_db_option ::= FSYNC NK_INTEGER */ - { 280, -2 }, /* (105) alter_db_option ::= KEEP integer_list */ - { 280, -2 }, /* (106) alter_db_option ::= KEEP variable_list */ - { 280, -2 }, /* (107) alter_db_option ::= WAL NK_INTEGER */ - { 277, -1 }, /* (108) integer_list ::= NK_INTEGER */ - { 277, -3 }, /* (109) integer_list ::= integer_list NK_COMMA NK_INTEGER */ - { 278, -1 }, /* (110) variable_list ::= NK_VARIABLE */ - { 278, -3 }, /* (111) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ - { 279, -1 }, /* (112) retention_list ::= retention */ - { 279, -3 }, /* (113) retention_list ::= retention_list NK_COMMA retention */ - { 281, -3 }, /* (114) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ - { 260, -9 }, /* (115) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ - { 260, -3 }, /* (116) cmd ::= CREATE TABLE multi_create_clause */ - { 260, -9 }, /* (117) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ - { 260, -3 }, /* (118) cmd ::= DROP TABLE multi_drop_clause */ - { 260, -4 }, /* (119) cmd ::= DROP STABLE exists_opt full_table_name */ - { 260, -3 }, /* (120) cmd ::= ALTER TABLE alter_table_clause */ - { 260, -3 }, /* (121) cmd ::= ALTER STABLE alter_table_clause */ - { 289, -2 }, /* (122) alter_table_clause ::= full_table_name alter_table_options */ - { 289, -5 }, /* (123) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ - { 289, -4 }, /* (124) alter_table_clause ::= full_table_name DROP COLUMN column_name */ - { 289, -5 }, /* (125) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ - { 289, -5 }, /* (126) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ - { 289, -5 }, /* (127) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ - { 289, -4 }, /* (128) alter_table_clause ::= full_table_name DROP TAG column_name */ - { 289, -5 }, /* (129) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ - { 289, -5 }, /* (130) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ - { 289, -6 }, /* (131) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ - { 286, -1 }, /* (132) multi_create_clause ::= create_subtable_clause */ - { 286, -2 }, /* (133) multi_create_clause ::= multi_create_clause create_subtable_clause */ - { 294, -10 }, /* (134) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ - { 288, -1 }, /* (135) multi_drop_clause ::= drop_table_clause */ - { 288, -2 }, /* (136) multi_drop_clause ::= multi_drop_clause drop_table_clause */ - { 297, -2 }, /* (137) drop_table_clause ::= exists_opt full_table_name */ - { 295, 0 }, /* (138) specific_cols_opt ::= */ - { 295, -3 }, /* (139) specific_cols_opt ::= NK_LP col_name_list NK_RP */ - { 282, -1 }, /* (140) full_table_name ::= table_name */ - { 282, -3 }, /* (141) full_table_name ::= db_name NK_DOT table_name */ - { 283, -1 }, /* (142) column_def_list ::= column_def */ - { 283, -3 }, /* (143) column_def_list ::= column_def_list NK_COMMA column_def */ - { 300, -2 }, /* (144) column_def ::= column_name type_name */ - { 300, -4 }, /* (145) column_def ::= column_name type_name COMMENT NK_STRING */ - { 292, -1 }, /* (146) type_name ::= BOOL */ - { 292, -1 }, /* (147) type_name ::= TINYINT */ - { 292, -1 }, /* (148) type_name ::= SMALLINT */ - { 292, -1 }, /* (149) type_name ::= INT */ - { 292, -1 }, /* (150) type_name ::= INTEGER */ - { 292, -1 }, /* (151) type_name ::= BIGINT */ - { 292, -1 }, /* (152) type_name ::= FLOAT */ - { 292, -1 }, /* (153) type_name ::= DOUBLE */ - { 292, -4 }, /* (154) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ - { 292, -1 }, /* (155) type_name ::= TIMESTAMP */ - { 292, -4 }, /* (156) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ - { 292, -2 }, /* (157) type_name ::= TINYINT UNSIGNED */ - { 292, -2 }, /* (158) type_name ::= SMALLINT UNSIGNED */ - { 292, -2 }, /* (159) type_name ::= INT UNSIGNED */ - { 292, -2 }, /* (160) type_name ::= BIGINT UNSIGNED */ - { 292, -1 }, /* (161) type_name ::= JSON */ - { 292, -4 }, /* (162) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ - { 292, -1 }, /* (163) type_name ::= MEDIUMBLOB */ - { 292, -1 }, /* (164) type_name ::= BLOB */ - { 292, -4 }, /* (165) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ - { 292, -1 }, /* (166) type_name ::= DECIMAL */ - { 292, -4 }, /* (167) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ - { 292, -6 }, /* (168) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ - { 284, 0 }, /* (169) tags_def_opt ::= */ - { 284, -1 }, /* (170) tags_def_opt ::= tags_def */ - { 287, -4 }, /* (171) tags_def ::= TAGS NK_LP column_def_list NK_RP */ - { 285, 0 }, /* (172) table_options ::= */ - { 285, -3 }, /* (173) table_options ::= table_options COMMENT NK_STRING */ - { 285, -3 }, /* (174) table_options ::= table_options MAX_DELAY duration_list */ - { 285, -3 }, /* (175) table_options ::= table_options WATERMARK duration_list */ - { 285, -5 }, /* (176) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ - { 285, -3 }, /* (177) table_options ::= table_options TTL NK_INTEGER */ - { 285, -5 }, /* (178) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ - { 290, -1 }, /* (179) alter_table_options ::= alter_table_option */ - { 290, -2 }, /* (180) alter_table_options ::= alter_table_options alter_table_option */ - { 303, -2 }, /* (181) alter_table_option ::= COMMENT NK_STRING */ - { 303, -2 }, /* (182) alter_table_option ::= TTL NK_INTEGER */ - { 301, -1 }, /* (183) duration_list ::= duration_literal */ - { 301, -3 }, /* (184) duration_list ::= duration_list NK_COMMA duration_literal */ - { 302, -1 }, /* (185) rollup_func_list ::= rollup_func_name */ - { 302, -3 }, /* (186) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ - { 305, -1 }, /* (187) rollup_func_name ::= function_name */ - { 305, -1 }, /* (188) rollup_func_name ::= FIRST */ - { 305, -1 }, /* (189) rollup_func_name ::= LAST */ - { 298, -1 }, /* (190) col_name_list ::= col_name */ - { 298, -3 }, /* (191) col_name_list ::= col_name_list NK_COMMA col_name */ - { 307, -1 }, /* (192) col_name ::= column_name */ - { 260, -2 }, /* (193) cmd ::= SHOW DNODES */ - { 260, -2 }, /* (194) cmd ::= SHOW USERS */ - { 260, -2 }, /* (195) cmd ::= SHOW DATABASES */ - { 260, -4 }, /* (196) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ - { 260, -4 }, /* (197) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ - { 260, -3 }, /* (198) cmd ::= SHOW db_name_cond_opt VGROUPS */ - { 260, -2 }, /* (199) cmd ::= SHOW MNODES */ - { 260, -2 }, /* (200) cmd ::= SHOW MODULES */ - { 260, -2 }, /* (201) cmd ::= SHOW QNODES */ - { 260, -2 }, /* (202) cmd ::= SHOW FUNCTIONS */ - { 260, -5 }, /* (203) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ - { 260, -2 }, /* (204) cmd ::= SHOW STREAMS */ - { 260, -2 }, /* (205) cmd ::= SHOW ACCOUNTS */ - { 260, -2 }, /* (206) cmd ::= SHOW APPS */ - { 260, -2 }, /* (207) cmd ::= SHOW CONNECTIONS */ - { 260, -2 }, /* (208) cmd ::= SHOW LICENCE */ - { 260, -2 }, /* (209) cmd ::= SHOW GRANTS */ - { 260, -4 }, /* (210) cmd ::= SHOW CREATE DATABASE db_name */ - { 260, -4 }, /* (211) cmd ::= SHOW CREATE TABLE full_table_name */ - { 260, -4 }, /* (212) cmd ::= SHOW CREATE STABLE full_table_name */ - { 260, -2 }, /* (213) cmd ::= SHOW QUERIES */ - { 260, -2 }, /* (214) cmd ::= SHOW SCORES */ - { 260, -2 }, /* (215) cmd ::= SHOW TOPICS */ - { 260, -2 }, /* (216) cmd ::= SHOW VARIABLES */ - { 260, -3 }, /* (217) cmd ::= SHOW LOCAL VARIABLES */ - { 260, -4 }, /* (218) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ - { 260, -2 }, /* (219) cmd ::= SHOW BNODES */ - { 260, -2 }, /* (220) cmd ::= SHOW SNODES */ - { 260, -2 }, /* (221) cmd ::= SHOW CLUSTER */ - { 260, -2 }, /* (222) cmd ::= SHOW TRANSACTIONS */ - { 260, -4 }, /* (223) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ - { 260, -2 }, /* (224) cmd ::= SHOW CONSUMERS */ - { 260, -2 }, /* (225) cmd ::= SHOW SUBSCRIPTIONS */ - { 260, -5 }, /* (226) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ - { 308, 0 }, /* (227) db_name_cond_opt ::= */ - { 308, -2 }, /* (228) db_name_cond_opt ::= db_name NK_DOT */ - { 309, 0 }, /* (229) like_pattern_opt ::= */ - { 309, -2 }, /* (230) like_pattern_opt ::= LIKE NK_STRING */ - { 310, -1 }, /* (231) table_name_cond ::= table_name */ - { 311, 0 }, /* (232) from_db_opt ::= */ - { 311, -2 }, /* (233) from_db_opt ::= FROM db_name */ - { 260, -8 }, /* (234) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ - { 260, -4 }, /* (235) cmd ::= DROP INDEX exists_opt index_name */ - { 313, -10 }, /* (236) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ - { 313, -12 }, /* (237) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ - { 314, -1 }, /* (238) func_list ::= func */ - { 314, -3 }, /* (239) func_list ::= func_list NK_COMMA func */ - { 317, -4 }, /* (240) func ::= function_name NK_LP expression_list NK_RP */ - { 316, 0 }, /* (241) sma_stream_opt ::= */ - { 316, -3 }, /* (242) sma_stream_opt ::= stream_options WATERMARK duration_literal */ - { 316, -3 }, /* (243) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ - { 260, -6 }, /* (244) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ - { 260, -7 }, /* (245) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ - { 260, -9 }, /* (246) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ - { 260, -7 }, /* (247) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ - { 260, -9 }, /* (248) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ - { 260, -4 }, /* (249) cmd ::= DROP TOPIC exists_opt topic_name */ - { 260, -7 }, /* (250) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ - { 260, -2 }, /* (251) cmd ::= DESC full_table_name */ - { 260, -2 }, /* (252) cmd ::= DESCRIBE full_table_name */ - { 260, -3 }, /* (253) cmd ::= RESET QUERY CACHE */ - { 260, -4 }, /* (254) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ - { 322, 0 }, /* (255) analyze_opt ::= */ - { 322, -1 }, /* (256) analyze_opt ::= ANALYZE */ - { 323, 0 }, /* (257) explain_options ::= */ - { 323, -3 }, /* (258) explain_options ::= explain_options VERBOSE NK_BOOL */ - { 323, -3 }, /* (259) explain_options ::= explain_options RATIO NK_FLOAT */ - { 260, -6 }, /* (260) cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ - { 260, -10 }, /* (261) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ - { 260, -4 }, /* (262) cmd ::= DROP FUNCTION exists_opt function_name */ - { 324, 0 }, /* (263) agg_func_opt ::= */ - { 324, -1 }, /* (264) agg_func_opt ::= AGGREGATE */ - { 325, 0 }, /* (265) bufsize_opt ::= */ - { 325, -2 }, /* (266) bufsize_opt ::= BUFSIZE NK_INTEGER */ - { 260, -8 }, /* (267) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ - { 260, -4 }, /* (268) cmd ::= DROP STREAM exists_opt stream_name */ - { 327, 0 }, /* (269) into_opt ::= */ - { 327, -2 }, /* (270) into_opt ::= INTO full_table_name */ - { 318, 0 }, /* (271) stream_options ::= */ - { 318, -3 }, /* (272) stream_options ::= stream_options TRIGGER AT_ONCE */ - { 318, -3 }, /* (273) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ - { 318, -4 }, /* (274) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ - { 318, -3 }, /* (275) stream_options ::= stream_options WATERMARK duration_literal */ - { 318, -3 }, /* (276) stream_options ::= stream_options IGNORE EXPIRED */ - { 260, -3 }, /* (277) cmd ::= KILL CONNECTION NK_INTEGER */ - { 260, -3 }, /* (278) cmd ::= KILL QUERY NK_STRING */ - { 260, -3 }, /* (279) cmd ::= KILL TRANSACTION NK_INTEGER */ - { 260, -2 }, /* (280) cmd ::= BALANCE VGROUP */ - { 260, -4 }, /* (281) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ - { 260, -4 }, /* (282) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ - { 260, -3 }, /* (283) cmd ::= SPLIT VGROUP NK_INTEGER */ - { 328, -2 }, /* (284) dnode_list ::= DNODE NK_INTEGER */ - { 328, -3 }, /* (285) dnode_list ::= dnode_list DNODE NK_INTEGER */ - { 260, -3 }, /* (286) cmd ::= SYNCDB db_name REPLICA */ - { 260, -4 }, /* (287) cmd ::= DELETE FROM full_table_name where_clause_opt */ - { 260, -1 }, /* (288) cmd ::= query_expression */ - { 260, -7 }, /* (289) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ - { 260, -4 }, /* (290) cmd ::= INSERT INTO full_table_name query_expression */ - { 263, -1 }, /* (291) literal ::= NK_INTEGER */ - { 263, -1 }, /* (292) literal ::= NK_FLOAT */ - { 263, -1 }, /* (293) literal ::= NK_STRING */ - { 263, -1 }, /* (294) literal ::= NK_BOOL */ - { 263, -2 }, /* (295) literal ::= TIMESTAMP NK_STRING */ - { 263, -1 }, /* (296) literal ::= duration_literal */ - { 263, -1 }, /* (297) literal ::= NULL */ - { 263, -1 }, /* (298) literal ::= NK_QUESTION */ - { 304, -1 }, /* (299) duration_literal ::= NK_VARIABLE */ - { 330, -1 }, /* (300) signed ::= NK_INTEGER */ - { 330, -2 }, /* (301) signed ::= NK_PLUS NK_INTEGER */ - { 330, -2 }, /* (302) signed ::= NK_MINUS NK_INTEGER */ - { 330, -1 }, /* (303) signed ::= NK_FLOAT */ - { 330, -2 }, /* (304) signed ::= NK_PLUS NK_FLOAT */ - { 330, -2 }, /* (305) signed ::= NK_MINUS NK_FLOAT */ - { 293, -1 }, /* (306) signed_literal ::= signed */ - { 293, -1 }, /* (307) signed_literal ::= NK_STRING */ - { 293, -1 }, /* (308) signed_literal ::= NK_BOOL */ - { 293, -2 }, /* (309) signed_literal ::= TIMESTAMP NK_STRING */ - { 293, -1 }, /* (310) signed_literal ::= duration_literal */ - { 293, -1 }, /* (311) signed_literal ::= NULL */ - { 293, -1 }, /* (312) signed_literal ::= literal_func */ - { 293, -1 }, /* (313) signed_literal ::= NK_QUESTION */ - { 332, -1 }, /* (314) literal_list ::= signed_literal */ - { 332, -3 }, /* (315) literal_list ::= literal_list NK_COMMA signed_literal */ - { 271, -1 }, /* (316) db_name ::= NK_ID */ - { 299, -1 }, /* (317) table_name ::= NK_ID */ - { 291, -1 }, /* (318) column_name ::= NK_ID */ - { 306, -1 }, /* (319) function_name ::= NK_ID */ - { 333, -1 }, /* (320) table_alias ::= NK_ID */ - { 334, -1 }, /* (321) column_alias ::= NK_ID */ - { 265, -1 }, /* (322) user_name ::= NK_ID */ - { 312, -1 }, /* (323) index_name ::= NK_ID */ - { 319, -1 }, /* (324) topic_name ::= NK_ID */ - { 326, -1 }, /* (325) stream_name ::= NK_ID */ - { 321, -1 }, /* (326) cgroup_name ::= NK_ID */ - { 335, -1 }, /* (327) expression ::= literal */ - { 335, -1 }, /* (328) expression ::= pseudo_column */ - { 335, -1 }, /* (329) expression ::= column_reference */ - { 335, -1 }, /* (330) expression ::= function_expression */ - { 335, -1 }, /* (331) expression ::= subquery */ - { 335, -3 }, /* (332) expression ::= NK_LP expression NK_RP */ - { 335, -2 }, /* (333) expression ::= NK_PLUS expression */ - { 335, -2 }, /* (334) expression ::= NK_MINUS expression */ - { 335, -3 }, /* (335) expression ::= expression NK_PLUS expression */ - { 335, -3 }, /* (336) expression ::= expression NK_MINUS expression */ - { 335, -3 }, /* (337) expression ::= expression NK_STAR expression */ - { 335, -3 }, /* (338) expression ::= expression NK_SLASH expression */ - { 335, -3 }, /* (339) expression ::= expression NK_REM expression */ - { 335, -3 }, /* (340) expression ::= column_reference NK_ARROW NK_STRING */ - { 335, -3 }, /* (341) expression ::= expression NK_BITAND expression */ - { 335, -3 }, /* (342) expression ::= expression NK_BITOR expression */ - { 296, -1 }, /* (343) expression_list ::= expression */ - { 296, -3 }, /* (344) expression_list ::= expression_list NK_COMMA expression */ - { 337, -1 }, /* (345) column_reference ::= column_name */ - { 337, -3 }, /* (346) column_reference ::= table_name NK_DOT column_name */ - { 336, -1 }, /* (347) pseudo_column ::= ROWTS */ - { 336, -1 }, /* (348) pseudo_column ::= TBNAME */ - { 336, -3 }, /* (349) pseudo_column ::= table_name NK_DOT TBNAME */ - { 336, -1 }, /* (350) pseudo_column ::= QSTART */ - { 336, -1 }, /* (351) pseudo_column ::= QEND */ - { 336, -1 }, /* (352) pseudo_column ::= QDURATION */ - { 336, -1 }, /* (353) pseudo_column ::= WSTART */ - { 336, -1 }, /* (354) pseudo_column ::= WEND */ - { 336, -1 }, /* (355) pseudo_column ::= WDURATION */ - { 338, -4 }, /* (356) function_expression ::= function_name NK_LP expression_list NK_RP */ - { 338, -4 }, /* (357) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ - { 338, -6 }, /* (358) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ - { 338, -1 }, /* (359) function_expression ::= literal_func */ - { 331, -3 }, /* (360) literal_func ::= noarg_func NK_LP NK_RP */ - { 331, -1 }, /* (361) literal_func ::= NOW */ - { 342, -1 }, /* (362) noarg_func ::= NOW */ - { 342, -1 }, /* (363) noarg_func ::= TODAY */ - { 342, -1 }, /* (364) noarg_func ::= TIMEZONE */ - { 342, -1 }, /* (365) noarg_func ::= DATABASE */ - { 342, -1 }, /* (366) noarg_func ::= CLIENT_VERSION */ - { 342, -1 }, /* (367) noarg_func ::= SERVER_VERSION */ - { 342, -1 }, /* (368) noarg_func ::= SERVER_STATUS */ - { 342, -1 }, /* (369) noarg_func ::= CURRENT_USER */ - { 342, -1 }, /* (370) noarg_func ::= USER */ - { 340, -1 }, /* (371) star_func ::= COUNT */ - { 340, -1 }, /* (372) star_func ::= FIRST */ - { 340, -1 }, /* (373) star_func ::= LAST */ - { 340, -1 }, /* (374) star_func ::= LAST_ROW */ - { 341, -1 }, /* (375) star_func_para_list ::= NK_STAR */ - { 341, -1 }, /* (376) star_func_para_list ::= other_para_list */ - { 343, -1 }, /* (377) other_para_list ::= star_func_para */ - { 343, -3 }, /* (378) other_para_list ::= other_para_list NK_COMMA star_func_para */ - { 344, -1 }, /* (379) star_func_para ::= expression */ - { 344, -3 }, /* (380) star_func_para ::= table_name NK_DOT NK_STAR */ - { 345, -3 }, /* (381) predicate ::= expression compare_op expression */ - { 345, -5 }, /* (382) predicate ::= expression BETWEEN expression AND expression */ - { 345, -6 }, /* (383) predicate ::= expression NOT BETWEEN expression AND expression */ - { 345, -3 }, /* (384) predicate ::= expression IS NULL */ - { 345, -4 }, /* (385) predicate ::= expression IS NOT NULL */ - { 345, -3 }, /* (386) predicate ::= expression in_op in_predicate_value */ - { 346, -1 }, /* (387) compare_op ::= NK_LT */ - { 346, -1 }, /* (388) compare_op ::= NK_GT */ - { 346, -1 }, /* (389) compare_op ::= NK_LE */ - { 346, -1 }, /* (390) compare_op ::= NK_GE */ - { 346, -1 }, /* (391) compare_op ::= NK_NE */ - { 346, -1 }, /* (392) compare_op ::= NK_EQ */ - { 346, -1 }, /* (393) compare_op ::= LIKE */ - { 346, -2 }, /* (394) compare_op ::= NOT LIKE */ - { 346, -1 }, /* (395) compare_op ::= MATCH */ - { 346, -1 }, /* (396) compare_op ::= NMATCH */ - { 346, -1 }, /* (397) compare_op ::= CONTAINS */ - { 347, -1 }, /* (398) in_op ::= IN */ - { 347, -2 }, /* (399) in_op ::= NOT IN */ - { 348, -3 }, /* (400) in_predicate_value ::= NK_LP literal_list NK_RP */ - { 349, -1 }, /* (401) boolean_value_expression ::= boolean_primary */ - { 349, -2 }, /* (402) boolean_value_expression ::= NOT boolean_primary */ - { 349, -3 }, /* (403) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ - { 349, -3 }, /* (404) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ - { 350, -1 }, /* (405) boolean_primary ::= predicate */ - { 350, -3 }, /* (406) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ - { 351, -1 }, /* (407) common_expression ::= expression */ - { 351, -1 }, /* (408) common_expression ::= boolean_value_expression */ - { 352, 0 }, /* (409) from_clause_opt ::= */ - { 352, -2 }, /* (410) from_clause_opt ::= FROM table_reference_list */ - { 353, -1 }, /* (411) table_reference_list ::= table_reference */ - { 353, -3 }, /* (412) table_reference_list ::= table_reference_list NK_COMMA table_reference */ - { 354, -1 }, /* (413) table_reference ::= table_primary */ - { 354, -1 }, /* (414) table_reference ::= joined_table */ - { 355, -2 }, /* (415) table_primary ::= table_name alias_opt */ - { 355, -4 }, /* (416) table_primary ::= db_name NK_DOT table_name alias_opt */ - { 355, -2 }, /* (417) table_primary ::= subquery alias_opt */ - { 355, -1 }, /* (418) table_primary ::= parenthesized_joined_table */ - { 357, 0 }, /* (419) alias_opt ::= */ - { 357, -1 }, /* (420) alias_opt ::= table_alias */ - { 357, -2 }, /* (421) alias_opt ::= AS table_alias */ - { 358, -3 }, /* (422) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - { 358, -3 }, /* (423) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ - { 356, -6 }, /* (424) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ - { 359, 0 }, /* (425) join_type ::= */ - { 359, -1 }, /* (426) join_type ::= INNER */ - { 361, -12 }, /* (427) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ - { 362, 0 }, /* (428) set_quantifier_opt ::= */ - { 362, -1 }, /* (429) set_quantifier_opt ::= DISTINCT */ - { 362, -1 }, /* (430) set_quantifier_opt ::= ALL */ - { 363, -1 }, /* (431) select_list ::= select_item */ - { 363, -3 }, /* (432) select_list ::= select_list NK_COMMA select_item */ - { 371, -1 }, /* (433) select_item ::= NK_STAR */ - { 371, -1 }, /* (434) select_item ::= common_expression */ - { 371, -2 }, /* (435) select_item ::= common_expression column_alias */ - { 371, -3 }, /* (436) select_item ::= common_expression AS column_alias */ - { 371, -3 }, /* (437) select_item ::= table_name NK_DOT NK_STAR */ - { 329, 0 }, /* (438) where_clause_opt ::= */ - { 329, -2 }, /* (439) where_clause_opt ::= WHERE search_condition */ - { 364, 0 }, /* (440) partition_by_clause_opt ::= */ - { 364, -3 }, /* (441) partition_by_clause_opt ::= PARTITION BY expression_list */ - { 368, 0 }, /* (442) twindow_clause_opt ::= */ - { 368, -6 }, /* (443) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ - { 368, -4 }, /* (444) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ - { 368, -6 }, /* (445) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ - { 368, -8 }, /* (446) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ - { 315, 0 }, /* (447) sliding_opt ::= */ - { 315, -4 }, /* (448) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - { 367, 0 }, /* (449) fill_opt ::= */ - { 367, -4 }, /* (450) fill_opt ::= FILL NK_LP fill_mode NK_RP */ - { 367, -6 }, /* (451) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ - { 372, -1 }, /* (452) fill_mode ::= NONE */ - { 372, -1 }, /* (453) fill_mode ::= PREV */ - { 372, -1 }, /* (454) fill_mode ::= NULL */ - { 372, -1 }, /* (455) fill_mode ::= LINEAR */ - { 372, -1 }, /* (456) fill_mode ::= NEXT */ - { 369, 0 }, /* (457) group_by_clause_opt ::= */ - { 369, -3 }, /* (458) group_by_clause_opt ::= GROUP BY group_by_list */ - { 373, -1 }, /* (459) group_by_list ::= expression */ - { 373, -3 }, /* (460) group_by_list ::= group_by_list NK_COMMA expression */ - { 370, 0 }, /* (461) having_clause_opt ::= */ - { 370, -2 }, /* (462) having_clause_opt ::= HAVING search_condition */ - { 365, 0 }, /* (463) range_opt ::= */ - { 365, -6 }, /* (464) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ - { 366, 0 }, /* (465) every_opt ::= */ - { 366, -4 }, /* (466) every_opt ::= EVERY NK_LP duration_literal NK_RP */ - { 320, -4 }, /* (467) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ - { 374, -1 }, /* (468) query_expression_body ::= query_primary */ - { 374, -4 }, /* (469) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ - { 374, -3 }, /* (470) query_expression_body ::= query_expression_body UNION query_expression_body */ - { 378, -1 }, /* (471) query_primary ::= query_specification */ - { 378, -6 }, /* (472) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ - { 375, 0 }, /* (473) order_by_clause_opt ::= */ - { 375, -3 }, /* (474) order_by_clause_opt ::= ORDER BY sort_specification_list */ - { 376, 0 }, /* (475) slimit_clause_opt ::= */ - { 376, -2 }, /* (476) slimit_clause_opt ::= SLIMIT NK_INTEGER */ - { 376, -4 }, /* (477) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - { 376, -4 }, /* (478) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 377, 0 }, /* (479) limit_clause_opt ::= */ - { 377, -2 }, /* (480) limit_clause_opt ::= LIMIT NK_INTEGER */ - { 377, -4 }, /* (481) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ - { 377, -4 }, /* (482) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - { 339, -3 }, /* (483) subquery ::= NK_LP query_expression NK_RP */ - { 360, -1 }, /* (484) search_condition ::= common_expression */ - { 379, -1 }, /* (485) sort_specification_list ::= sort_specification */ - { 379, -3 }, /* (486) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ - { 380, -3 }, /* (487) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ - { 381, 0 }, /* (488) ordering_specification_opt ::= */ - { 381, -1 }, /* (489) ordering_specification_opt ::= ASC */ - { 381, -1 }, /* (490) ordering_specification_opt ::= DESC */ - { 382, 0 }, /* (491) null_ordering_opt ::= */ - { 382, -2 }, /* (492) null_ordering_opt ::= NULLS FIRST */ - { 382, -2 }, /* (493) null_ordering_opt ::= NULLS LAST */ + { 257, -6 }, /* (0) cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ + { 257, -4 }, /* (1) cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ + { 258, 0 }, /* (2) account_options ::= */ + { 258, -3 }, /* (3) account_options ::= account_options PPS literal */ + { 258, -3 }, /* (4) account_options ::= account_options TSERIES literal */ + { 258, -3 }, /* (5) account_options ::= account_options STORAGE literal */ + { 258, -3 }, /* (6) account_options ::= account_options STREAMS literal */ + { 258, -3 }, /* (7) account_options ::= account_options QTIME literal */ + { 258, -3 }, /* (8) account_options ::= account_options DBS literal */ + { 258, -3 }, /* (9) account_options ::= account_options USERS literal */ + { 258, -3 }, /* (10) account_options ::= account_options CONNS literal */ + { 258, -3 }, /* (11) account_options ::= account_options STATE literal */ + { 259, -1 }, /* (12) alter_account_options ::= alter_account_option */ + { 259, -2 }, /* (13) alter_account_options ::= alter_account_options alter_account_option */ + { 261, -2 }, /* (14) alter_account_option ::= PASS literal */ + { 261, -2 }, /* (15) alter_account_option ::= PPS literal */ + { 261, -2 }, /* (16) alter_account_option ::= TSERIES literal */ + { 261, -2 }, /* (17) alter_account_option ::= STORAGE literal */ + { 261, -2 }, /* (18) alter_account_option ::= STREAMS literal */ + { 261, -2 }, /* (19) alter_account_option ::= QTIME literal */ + { 261, -2 }, /* (20) alter_account_option ::= DBS literal */ + { 261, -2 }, /* (21) alter_account_option ::= USERS literal */ + { 261, -2 }, /* (22) alter_account_option ::= CONNS literal */ + { 261, -2 }, /* (23) alter_account_option ::= STATE literal */ + { 257, -6 }, /* (24) cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ + { 257, -5 }, /* (25) cmd ::= ALTER USER user_name PASS NK_STRING */ + { 257, -5 }, /* (26) cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ + { 257, -5 }, /* (27) cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ + { 257, -3 }, /* (28) cmd ::= DROP USER user_name */ + { 263, 0 }, /* (29) sysinfo_opt ::= */ + { 263, -2 }, /* (30) sysinfo_opt ::= SYSINFO NK_INTEGER */ + { 257, -6 }, /* (31) cmd ::= GRANT privileges ON priv_level TO user_name */ + { 257, -6 }, /* (32) cmd ::= REVOKE privileges ON priv_level FROM user_name */ + { 264, -1 }, /* (33) privileges ::= ALL */ + { 264, -1 }, /* (34) privileges ::= priv_type_list */ + { 266, -1 }, /* (35) priv_type_list ::= priv_type */ + { 266, -3 }, /* (36) priv_type_list ::= priv_type_list NK_COMMA priv_type */ + { 267, -1 }, /* (37) priv_type ::= READ */ + { 267, -1 }, /* (38) priv_type ::= WRITE */ + { 265, -3 }, /* (39) priv_level ::= NK_STAR NK_DOT NK_STAR */ + { 265, -3 }, /* (40) priv_level ::= db_name NK_DOT NK_STAR */ + { 257, -3 }, /* (41) cmd ::= CREATE DNODE dnode_endpoint */ + { 257, -5 }, /* (42) cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ + { 257, -3 }, /* (43) cmd ::= DROP DNODE NK_INTEGER */ + { 257, -3 }, /* (44) cmd ::= DROP DNODE dnode_endpoint */ + { 257, -4 }, /* (45) cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ + { 257, -5 }, /* (46) cmd ::= ALTER DNODE NK_INTEGER NK_STRING NK_STRING */ + { 257, -4 }, /* (47) cmd ::= ALTER ALL DNODES NK_STRING */ + { 257, -5 }, /* (48) cmd ::= ALTER ALL DNODES NK_STRING NK_STRING */ + { 269, -1 }, /* (49) dnode_endpoint ::= NK_STRING */ + { 269, -1 }, /* (50) dnode_endpoint ::= NK_ID */ + { 269, -1 }, /* (51) dnode_endpoint ::= NK_IPTOKEN */ + { 257, -3 }, /* (52) cmd ::= ALTER LOCAL NK_STRING */ + { 257, -4 }, /* (53) cmd ::= ALTER LOCAL NK_STRING NK_STRING */ + { 257, -5 }, /* (54) cmd ::= CREATE QNODE ON DNODE NK_INTEGER */ + { 257, -5 }, /* (55) cmd ::= DROP QNODE ON DNODE NK_INTEGER */ + { 257, -5 }, /* (56) cmd ::= CREATE BNODE ON DNODE NK_INTEGER */ + { 257, -5 }, /* (57) cmd ::= DROP BNODE ON DNODE NK_INTEGER */ + { 257, -5 }, /* (58) cmd ::= CREATE SNODE ON DNODE NK_INTEGER */ + { 257, -5 }, /* (59) cmd ::= DROP SNODE ON DNODE NK_INTEGER */ + { 257, -5 }, /* (60) cmd ::= CREATE MNODE ON DNODE NK_INTEGER */ + { 257, -5 }, /* (61) cmd ::= DROP MNODE ON DNODE NK_INTEGER */ + { 257, -5 }, /* (62) cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ + { 257, -4 }, /* (63) cmd ::= DROP DATABASE exists_opt db_name */ + { 257, -2 }, /* (64) cmd ::= USE db_name */ + { 257, -4 }, /* (65) cmd ::= ALTER DATABASE db_name alter_db_options */ + { 257, -3 }, /* (66) cmd ::= FLUSH DATABASE db_name */ + { 257, -3 }, /* (67) cmd ::= TRIM DATABASE db_name */ + { 270, -3 }, /* (68) not_exists_opt ::= IF NOT EXISTS */ + { 270, 0 }, /* (69) not_exists_opt ::= */ + { 272, -2 }, /* (70) exists_opt ::= IF EXISTS */ + { 272, 0 }, /* (71) exists_opt ::= */ + { 271, 0 }, /* (72) db_options ::= */ + { 271, -3 }, /* (73) db_options ::= db_options BUFFER NK_INTEGER */ + { 271, -3 }, /* (74) db_options ::= db_options CACHEMODEL NK_STRING */ + { 271, -3 }, /* (75) db_options ::= db_options CACHESIZE NK_INTEGER */ + { 271, -3 }, /* (76) db_options ::= db_options COMP NK_INTEGER */ + { 271, -3 }, /* (77) db_options ::= db_options DURATION NK_INTEGER */ + { 271, -3 }, /* (78) db_options ::= db_options DURATION NK_VARIABLE */ + { 271, -3 }, /* (79) db_options ::= db_options MAXROWS NK_INTEGER */ + { 271, -3 }, /* (80) db_options ::= db_options MINROWS NK_INTEGER */ + { 271, -3 }, /* (81) db_options ::= db_options KEEP integer_list */ + { 271, -3 }, /* (82) db_options ::= db_options KEEP variable_list */ + { 271, -3 }, /* (83) db_options ::= db_options PAGES NK_INTEGER */ + { 271, -3 }, /* (84) db_options ::= db_options PAGESIZE NK_INTEGER */ + { 271, -3 }, /* (85) db_options ::= db_options PRECISION NK_STRING */ + { 271, -3 }, /* (86) db_options ::= db_options REPLICA NK_INTEGER */ + { 271, -3 }, /* (87) db_options ::= db_options STRICT NK_STRING */ + { 271, -3 }, /* (88) db_options ::= db_options VGROUPS NK_INTEGER */ + { 271, -3 }, /* (89) db_options ::= db_options SINGLE_STABLE NK_INTEGER */ + { 271, -3 }, /* (90) db_options ::= db_options RETENTIONS retention_list */ + { 271, -3 }, /* (91) db_options ::= db_options SCHEMALESS NK_INTEGER */ + { 271, -3 }, /* (92) db_options ::= db_options WAL_LEVEL NK_INTEGER */ + { 271, -3 }, /* (93) db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ + { 271, -3 }, /* (94) db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ + { 271, -4 }, /* (95) db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ + { 271, -3 }, /* (96) db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ + { 271, -4 }, /* (97) db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ + { 271, -3 }, /* (98) db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ + { 271, -3 }, /* (99) db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ + { 273, -1 }, /* (100) alter_db_options ::= alter_db_option */ + { 273, -2 }, /* (101) alter_db_options ::= alter_db_options alter_db_option */ + { 277, -2 }, /* (102) alter_db_option ::= CACHEMODEL NK_STRING */ + { 277, -2 }, /* (103) alter_db_option ::= CACHESIZE NK_INTEGER */ + { 277, -2 }, /* (104) alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ + { 277, -2 }, /* (105) alter_db_option ::= KEEP integer_list */ + { 277, -2 }, /* (106) alter_db_option ::= KEEP variable_list */ + { 277, -2 }, /* (107) alter_db_option ::= WAL_LEVEL NK_INTEGER */ + { 274, -1 }, /* (108) integer_list ::= NK_INTEGER */ + { 274, -3 }, /* (109) integer_list ::= integer_list NK_COMMA NK_INTEGER */ + { 275, -1 }, /* (110) variable_list ::= NK_VARIABLE */ + { 275, -3 }, /* (111) variable_list ::= variable_list NK_COMMA NK_VARIABLE */ + { 276, -1 }, /* (112) retention_list ::= retention */ + { 276, -3 }, /* (113) retention_list ::= retention_list NK_COMMA retention */ + { 278, -3 }, /* (114) retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ + { 257, -9 }, /* (115) cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ + { 257, -3 }, /* (116) cmd ::= CREATE TABLE multi_create_clause */ + { 257, -9 }, /* (117) cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ + { 257, -3 }, /* (118) cmd ::= DROP TABLE multi_drop_clause */ + { 257, -4 }, /* (119) cmd ::= DROP STABLE exists_opt full_table_name */ + { 257, -3 }, /* (120) cmd ::= ALTER TABLE alter_table_clause */ + { 257, -3 }, /* (121) cmd ::= ALTER STABLE alter_table_clause */ + { 286, -2 }, /* (122) alter_table_clause ::= full_table_name alter_table_options */ + { 286, -5 }, /* (123) alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ + { 286, -4 }, /* (124) alter_table_clause ::= full_table_name DROP COLUMN column_name */ + { 286, -5 }, /* (125) alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ + { 286, -5 }, /* (126) alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ + { 286, -5 }, /* (127) alter_table_clause ::= full_table_name ADD TAG column_name type_name */ + { 286, -4 }, /* (128) alter_table_clause ::= full_table_name DROP TAG column_name */ + { 286, -5 }, /* (129) alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ + { 286, -5 }, /* (130) alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ + { 286, -6 }, /* (131) alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ + { 283, -1 }, /* (132) multi_create_clause ::= create_subtable_clause */ + { 283, -2 }, /* (133) multi_create_clause ::= multi_create_clause create_subtable_clause */ + { 291, -10 }, /* (134) create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ + { 285, -1 }, /* (135) multi_drop_clause ::= drop_table_clause */ + { 285, -2 }, /* (136) multi_drop_clause ::= multi_drop_clause drop_table_clause */ + { 294, -2 }, /* (137) drop_table_clause ::= exists_opt full_table_name */ + { 292, 0 }, /* (138) specific_cols_opt ::= */ + { 292, -3 }, /* (139) specific_cols_opt ::= NK_LP col_name_list NK_RP */ + { 279, -1 }, /* (140) full_table_name ::= table_name */ + { 279, -3 }, /* (141) full_table_name ::= db_name NK_DOT table_name */ + { 280, -1 }, /* (142) column_def_list ::= column_def */ + { 280, -3 }, /* (143) column_def_list ::= column_def_list NK_COMMA column_def */ + { 297, -2 }, /* (144) column_def ::= column_name type_name */ + { 297, -4 }, /* (145) column_def ::= column_name type_name COMMENT NK_STRING */ + { 289, -1 }, /* (146) type_name ::= BOOL */ + { 289, -1 }, /* (147) type_name ::= TINYINT */ + { 289, -1 }, /* (148) type_name ::= SMALLINT */ + { 289, -1 }, /* (149) type_name ::= INT */ + { 289, -1 }, /* (150) type_name ::= INTEGER */ + { 289, -1 }, /* (151) type_name ::= BIGINT */ + { 289, -1 }, /* (152) type_name ::= FLOAT */ + { 289, -1 }, /* (153) type_name ::= DOUBLE */ + { 289, -4 }, /* (154) type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ + { 289, -1 }, /* (155) type_name ::= TIMESTAMP */ + { 289, -4 }, /* (156) type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ + { 289, -2 }, /* (157) type_name ::= TINYINT UNSIGNED */ + { 289, -2 }, /* (158) type_name ::= SMALLINT UNSIGNED */ + { 289, -2 }, /* (159) type_name ::= INT UNSIGNED */ + { 289, -2 }, /* (160) type_name ::= BIGINT UNSIGNED */ + { 289, -1 }, /* (161) type_name ::= JSON */ + { 289, -4 }, /* (162) type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ + { 289, -1 }, /* (163) type_name ::= MEDIUMBLOB */ + { 289, -1 }, /* (164) type_name ::= BLOB */ + { 289, -4 }, /* (165) type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ + { 289, -1 }, /* (166) type_name ::= DECIMAL */ + { 289, -4 }, /* (167) type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ + { 289, -6 }, /* (168) type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ + { 281, 0 }, /* (169) tags_def_opt ::= */ + { 281, -1 }, /* (170) tags_def_opt ::= tags_def */ + { 284, -4 }, /* (171) tags_def ::= TAGS NK_LP column_def_list NK_RP */ + { 282, 0 }, /* (172) table_options ::= */ + { 282, -3 }, /* (173) table_options ::= table_options COMMENT NK_STRING */ + { 282, -3 }, /* (174) table_options ::= table_options MAX_DELAY duration_list */ + { 282, -3 }, /* (175) table_options ::= table_options WATERMARK duration_list */ + { 282, -5 }, /* (176) table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ + { 282, -3 }, /* (177) table_options ::= table_options TTL NK_INTEGER */ + { 282, -5 }, /* (178) table_options ::= table_options SMA NK_LP col_name_list NK_RP */ + { 287, -1 }, /* (179) alter_table_options ::= alter_table_option */ + { 287, -2 }, /* (180) alter_table_options ::= alter_table_options alter_table_option */ + { 300, -2 }, /* (181) alter_table_option ::= COMMENT NK_STRING */ + { 300, -2 }, /* (182) alter_table_option ::= TTL NK_INTEGER */ + { 298, -1 }, /* (183) duration_list ::= duration_literal */ + { 298, -3 }, /* (184) duration_list ::= duration_list NK_COMMA duration_literal */ + { 299, -1 }, /* (185) rollup_func_list ::= rollup_func_name */ + { 299, -3 }, /* (186) rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ + { 302, -1 }, /* (187) rollup_func_name ::= function_name */ + { 302, -1 }, /* (188) rollup_func_name ::= FIRST */ + { 302, -1 }, /* (189) rollup_func_name ::= LAST */ + { 295, -1 }, /* (190) col_name_list ::= col_name */ + { 295, -3 }, /* (191) col_name_list ::= col_name_list NK_COMMA col_name */ + { 304, -1 }, /* (192) col_name ::= column_name */ + { 257, -2 }, /* (193) cmd ::= SHOW DNODES */ + { 257, -2 }, /* (194) cmd ::= SHOW USERS */ + { 257, -2 }, /* (195) cmd ::= SHOW DATABASES */ + { 257, -4 }, /* (196) cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ + { 257, -4 }, /* (197) cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ + { 257, -3 }, /* (198) cmd ::= SHOW db_name_cond_opt VGROUPS */ + { 257, -2 }, /* (199) cmd ::= SHOW MNODES */ + { 257, -2 }, /* (200) cmd ::= SHOW MODULES */ + { 257, -2 }, /* (201) cmd ::= SHOW QNODES */ + { 257, -2 }, /* (202) cmd ::= SHOW FUNCTIONS */ + { 257, -5 }, /* (203) cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ + { 257, -2 }, /* (204) cmd ::= SHOW STREAMS */ + { 257, -2 }, /* (205) cmd ::= SHOW ACCOUNTS */ + { 257, -2 }, /* (206) cmd ::= SHOW APPS */ + { 257, -2 }, /* (207) cmd ::= SHOW CONNECTIONS */ + { 257, -2 }, /* (208) cmd ::= SHOW LICENCE */ + { 257, -2 }, /* (209) cmd ::= SHOW GRANTS */ + { 257, -4 }, /* (210) cmd ::= SHOW CREATE DATABASE db_name */ + { 257, -4 }, /* (211) cmd ::= SHOW CREATE TABLE full_table_name */ + { 257, -4 }, /* (212) cmd ::= SHOW CREATE STABLE full_table_name */ + { 257, -2 }, /* (213) cmd ::= SHOW QUERIES */ + { 257, -2 }, /* (214) cmd ::= SHOW SCORES */ + { 257, -2 }, /* (215) cmd ::= SHOW TOPICS */ + { 257, -2 }, /* (216) cmd ::= SHOW VARIABLES */ + { 257, -3 }, /* (217) cmd ::= SHOW LOCAL VARIABLES */ + { 257, -4 }, /* (218) cmd ::= SHOW DNODE NK_INTEGER VARIABLES */ + { 257, -2 }, /* (219) cmd ::= SHOW BNODES */ + { 257, -2 }, /* (220) cmd ::= SHOW SNODES */ + { 257, -2 }, /* (221) cmd ::= SHOW CLUSTER */ + { 257, -2 }, /* (222) cmd ::= SHOW TRANSACTIONS */ + { 257, -4 }, /* (223) cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ + { 257, -2 }, /* (224) cmd ::= SHOW CONSUMERS */ + { 257, -2 }, /* (225) cmd ::= SHOW SUBSCRIPTIONS */ + { 257, -5 }, /* (226) cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ + { 305, 0 }, /* (227) db_name_cond_opt ::= */ + { 305, -2 }, /* (228) db_name_cond_opt ::= db_name NK_DOT */ + { 306, 0 }, /* (229) like_pattern_opt ::= */ + { 306, -2 }, /* (230) like_pattern_opt ::= LIKE NK_STRING */ + { 307, -1 }, /* (231) table_name_cond ::= table_name */ + { 308, 0 }, /* (232) from_db_opt ::= */ + { 308, -2 }, /* (233) from_db_opt ::= FROM db_name */ + { 257, -8 }, /* (234) cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ + { 257, -4 }, /* (235) cmd ::= DROP INDEX exists_opt index_name */ + { 310, -10 }, /* (236) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ + { 310, -12 }, /* (237) index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ + { 311, -1 }, /* (238) func_list ::= func */ + { 311, -3 }, /* (239) func_list ::= func_list NK_COMMA func */ + { 314, -4 }, /* (240) func ::= function_name NK_LP expression_list NK_RP */ + { 313, 0 }, /* (241) sma_stream_opt ::= */ + { 313, -3 }, /* (242) sma_stream_opt ::= stream_options WATERMARK duration_literal */ + { 313, -3 }, /* (243) sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ + { 257, -6 }, /* (244) cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ + { 257, -7 }, /* (245) cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ + { 257, -9 }, /* (246) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ + { 257, -7 }, /* (247) cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ + { 257, -9 }, /* (248) cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ + { 257, -4 }, /* (249) cmd ::= DROP TOPIC exists_opt topic_name */ + { 257, -7 }, /* (250) cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ + { 257, -2 }, /* (251) cmd ::= DESC full_table_name */ + { 257, -2 }, /* (252) cmd ::= DESCRIBE full_table_name */ + { 257, -3 }, /* (253) cmd ::= RESET QUERY CACHE */ + { 257, -4 }, /* (254) cmd ::= EXPLAIN analyze_opt explain_options query_expression */ + { 319, 0 }, /* (255) analyze_opt ::= */ + { 319, -1 }, /* (256) analyze_opt ::= ANALYZE */ + { 320, 0 }, /* (257) explain_options ::= */ + { 320, -3 }, /* (258) explain_options ::= explain_options VERBOSE NK_BOOL */ + { 320, -3 }, /* (259) explain_options ::= explain_options RATIO NK_FLOAT */ + { 257, -10 }, /* (260) cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ + { 257, -4 }, /* (261) cmd ::= DROP FUNCTION exists_opt function_name */ + { 321, 0 }, /* (262) agg_func_opt ::= */ + { 321, -1 }, /* (263) agg_func_opt ::= AGGREGATE */ + { 322, 0 }, /* (264) bufsize_opt ::= */ + { 322, -2 }, /* (265) bufsize_opt ::= BUFSIZE NK_INTEGER */ + { 257, -8 }, /* (266) cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ + { 257, -4 }, /* (267) cmd ::= DROP STREAM exists_opt stream_name */ + { 324, 0 }, /* (268) into_opt ::= */ + { 324, -2 }, /* (269) into_opt ::= INTO full_table_name */ + { 315, 0 }, /* (270) stream_options ::= */ + { 315, -3 }, /* (271) stream_options ::= stream_options TRIGGER AT_ONCE */ + { 315, -3 }, /* (272) stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ + { 315, -4 }, /* (273) stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ + { 315, -3 }, /* (274) stream_options ::= stream_options WATERMARK duration_literal */ + { 315, -3 }, /* (275) stream_options ::= stream_options IGNORE EXPIRED */ + { 257, -3 }, /* (276) cmd ::= KILL CONNECTION NK_INTEGER */ + { 257, -3 }, /* (277) cmd ::= KILL QUERY NK_STRING */ + { 257, -3 }, /* (278) cmd ::= KILL TRANSACTION NK_INTEGER */ + { 257, -2 }, /* (279) cmd ::= BALANCE VGROUP */ + { 257, -4 }, /* (280) cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + { 257, -4 }, /* (281) cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ + { 257, -3 }, /* (282) cmd ::= SPLIT VGROUP NK_INTEGER */ + { 325, -2 }, /* (283) dnode_list ::= DNODE NK_INTEGER */ + { 325, -3 }, /* (284) dnode_list ::= dnode_list DNODE NK_INTEGER */ + { 257, -4 }, /* (285) cmd ::= DELETE FROM full_table_name where_clause_opt */ + { 257, -1 }, /* (286) cmd ::= query_expression */ + { 257, -7 }, /* (287) cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ + { 257, -4 }, /* (288) cmd ::= INSERT INTO full_table_name query_expression */ + { 260, -1 }, /* (289) literal ::= NK_INTEGER */ + { 260, -1 }, /* (290) literal ::= NK_FLOAT */ + { 260, -1 }, /* (291) literal ::= NK_STRING */ + { 260, -1 }, /* (292) literal ::= NK_BOOL */ + { 260, -2 }, /* (293) literal ::= TIMESTAMP NK_STRING */ + { 260, -1 }, /* (294) literal ::= duration_literal */ + { 260, -1 }, /* (295) literal ::= NULL */ + { 260, -1 }, /* (296) literal ::= NK_QUESTION */ + { 301, -1 }, /* (297) duration_literal ::= NK_VARIABLE */ + { 327, -1 }, /* (298) signed ::= NK_INTEGER */ + { 327, -2 }, /* (299) signed ::= NK_PLUS NK_INTEGER */ + { 327, -2 }, /* (300) signed ::= NK_MINUS NK_INTEGER */ + { 327, -1 }, /* (301) signed ::= NK_FLOAT */ + { 327, -2 }, /* (302) signed ::= NK_PLUS NK_FLOAT */ + { 327, -2 }, /* (303) signed ::= NK_MINUS NK_FLOAT */ + { 290, -1 }, /* (304) signed_literal ::= signed */ + { 290, -1 }, /* (305) signed_literal ::= NK_STRING */ + { 290, -1 }, /* (306) signed_literal ::= NK_BOOL */ + { 290, -2 }, /* (307) signed_literal ::= TIMESTAMP NK_STRING */ + { 290, -1 }, /* (308) signed_literal ::= duration_literal */ + { 290, -1 }, /* (309) signed_literal ::= NULL */ + { 290, -1 }, /* (310) signed_literal ::= literal_func */ + { 290, -1 }, /* (311) signed_literal ::= NK_QUESTION */ + { 329, -1 }, /* (312) literal_list ::= signed_literal */ + { 329, -3 }, /* (313) literal_list ::= literal_list NK_COMMA signed_literal */ + { 268, -1 }, /* (314) db_name ::= NK_ID */ + { 296, -1 }, /* (315) table_name ::= NK_ID */ + { 288, -1 }, /* (316) column_name ::= NK_ID */ + { 303, -1 }, /* (317) function_name ::= NK_ID */ + { 330, -1 }, /* (318) table_alias ::= NK_ID */ + { 331, -1 }, /* (319) column_alias ::= NK_ID */ + { 262, -1 }, /* (320) user_name ::= NK_ID */ + { 309, -1 }, /* (321) index_name ::= NK_ID */ + { 316, -1 }, /* (322) topic_name ::= NK_ID */ + { 323, -1 }, /* (323) stream_name ::= NK_ID */ + { 318, -1 }, /* (324) cgroup_name ::= NK_ID */ + { 332, -1 }, /* (325) expression ::= literal */ + { 332, -1 }, /* (326) expression ::= pseudo_column */ + { 332, -1 }, /* (327) expression ::= column_reference */ + { 332, -1 }, /* (328) expression ::= function_expression */ + { 332, -1 }, /* (329) expression ::= subquery */ + { 332, -3 }, /* (330) expression ::= NK_LP expression NK_RP */ + { 332, -2 }, /* (331) expression ::= NK_PLUS expression */ + { 332, -2 }, /* (332) expression ::= NK_MINUS expression */ + { 332, -3 }, /* (333) expression ::= expression NK_PLUS expression */ + { 332, -3 }, /* (334) expression ::= expression NK_MINUS expression */ + { 332, -3 }, /* (335) expression ::= expression NK_STAR expression */ + { 332, -3 }, /* (336) expression ::= expression NK_SLASH expression */ + { 332, -3 }, /* (337) expression ::= expression NK_REM expression */ + { 332, -3 }, /* (338) expression ::= column_reference NK_ARROW NK_STRING */ + { 332, -3 }, /* (339) expression ::= expression NK_BITAND expression */ + { 332, -3 }, /* (340) expression ::= expression NK_BITOR expression */ + { 293, -1 }, /* (341) expression_list ::= expression */ + { 293, -3 }, /* (342) expression_list ::= expression_list NK_COMMA expression */ + { 334, -1 }, /* (343) column_reference ::= column_name */ + { 334, -3 }, /* (344) column_reference ::= table_name NK_DOT column_name */ + { 333, -1 }, /* (345) pseudo_column ::= ROWTS */ + { 333, -1 }, /* (346) pseudo_column ::= TBNAME */ + { 333, -3 }, /* (347) pseudo_column ::= table_name NK_DOT TBNAME */ + { 333, -1 }, /* (348) pseudo_column ::= QSTART */ + { 333, -1 }, /* (349) pseudo_column ::= QEND */ + { 333, -1 }, /* (350) pseudo_column ::= QDURATION */ + { 333, -1 }, /* (351) pseudo_column ::= WSTART */ + { 333, -1 }, /* (352) pseudo_column ::= WEND */ + { 333, -1 }, /* (353) pseudo_column ::= WDURATION */ + { 335, -4 }, /* (354) function_expression ::= function_name NK_LP expression_list NK_RP */ + { 335, -4 }, /* (355) function_expression ::= star_func NK_LP star_func_para_list NK_RP */ + { 335, -6 }, /* (356) function_expression ::= CAST NK_LP expression AS type_name NK_RP */ + { 335, -1 }, /* (357) function_expression ::= literal_func */ + { 328, -3 }, /* (358) literal_func ::= noarg_func NK_LP NK_RP */ + { 328, -1 }, /* (359) literal_func ::= NOW */ + { 339, -1 }, /* (360) noarg_func ::= NOW */ + { 339, -1 }, /* (361) noarg_func ::= TODAY */ + { 339, -1 }, /* (362) noarg_func ::= TIMEZONE */ + { 339, -1 }, /* (363) noarg_func ::= DATABASE */ + { 339, -1 }, /* (364) noarg_func ::= CLIENT_VERSION */ + { 339, -1 }, /* (365) noarg_func ::= SERVER_VERSION */ + { 339, -1 }, /* (366) noarg_func ::= SERVER_STATUS */ + { 339, -1 }, /* (367) noarg_func ::= CURRENT_USER */ + { 339, -1 }, /* (368) noarg_func ::= USER */ + { 337, -1 }, /* (369) star_func ::= COUNT */ + { 337, -1 }, /* (370) star_func ::= FIRST */ + { 337, -1 }, /* (371) star_func ::= LAST */ + { 337, -1 }, /* (372) star_func ::= LAST_ROW */ + { 338, -1 }, /* (373) star_func_para_list ::= NK_STAR */ + { 338, -1 }, /* (374) star_func_para_list ::= other_para_list */ + { 340, -1 }, /* (375) other_para_list ::= star_func_para */ + { 340, -3 }, /* (376) other_para_list ::= other_para_list NK_COMMA star_func_para */ + { 341, -1 }, /* (377) star_func_para ::= expression */ + { 341, -3 }, /* (378) star_func_para ::= table_name NK_DOT NK_STAR */ + { 342, -3 }, /* (379) predicate ::= expression compare_op expression */ + { 342, -5 }, /* (380) predicate ::= expression BETWEEN expression AND expression */ + { 342, -6 }, /* (381) predicate ::= expression NOT BETWEEN expression AND expression */ + { 342, -3 }, /* (382) predicate ::= expression IS NULL */ + { 342, -4 }, /* (383) predicate ::= expression IS NOT NULL */ + { 342, -3 }, /* (384) predicate ::= expression in_op in_predicate_value */ + { 343, -1 }, /* (385) compare_op ::= NK_LT */ + { 343, -1 }, /* (386) compare_op ::= NK_GT */ + { 343, -1 }, /* (387) compare_op ::= NK_LE */ + { 343, -1 }, /* (388) compare_op ::= NK_GE */ + { 343, -1 }, /* (389) compare_op ::= NK_NE */ + { 343, -1 }, /* (390) compare_op ::= NK_EQ */ + { 343, -1 }, /* (391) compare_op ::= LIKE */ + { 343, -2 }, /* (392) compare_op ::= NOT LIKE */ + { 343, -1 }, /* (393) compare_op ::= MATCH */ + { 343, -1 }, /* (394) compare_op ::= NMATCH */ + { 343, -1 }, /* (395) compare_op ::= CONTAINS */ + { 344, -1 }, /* (396) in_op ::= IN */ + { 344, -2 }, /* (397) in_op ::= NOT IN */ + { 345, -3 }, /* (398) in_predicate_value ::= NK_LP literal_list NK_RP */ + { 346, -1 }, /* (399) boolean_value_expression ::= boolean_primary */ + { 346, -2 }, /* (400) boolean_value_expression ::= NOT boolean_primary */ + { 346, -3 }, /* (401) boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + { 346, -3 }, /* (402) boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + { 347, -1 }, /* (403) boolean_primary ::= predicate */ + { 347, -3 }, /* (404) boolean_primary ::= NK_LP boolean_value_expression NK_RP */ + { 348, -1 }, /* (405) common_expression ::= expression */ + { 348, -1 }, /* (406) common_expression ::= boolean_value_expression */ + { 349, 0 }, /* (407) from_clause_opt ::= */ + { 349, -2 }, /* (408) from_clause_opt ::= FROM table_reference_list */ + { 350, -1 }, /* (409) table_reference_list ::= table_reference */ + { 350, -3 }, /* (410) table_reference_list ::= table_reference_list NK_COMMA table_reference */ + { 351, -1 }, /* (411) table_reference ::= table_primary */ + { 351, -1 }, /* (412) table_reference ::= joined_table */ + { 352, -2 }, /* (413) table_primary ::= table_name alias_opt */ + { 352, -4 }, /* (414) table_primary ::= db_name NK_DOT table_name alias_opt */ + { 352, -2 }, /* (415) table_primary ::= subquery alias_opt */ + { 352, -1 }, /* (416) table_primary ::= parenthesized_joined_table */ + { 354, 0 }, /* (417) alias_opt ::= */ + { 354, -1 }, /* (418) alias_opt ::= table_alias */ + { 354, -2 }, /* (419) alias_opt ::= AS table_alias */ + { 355, -3 }, /* (420) parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + { 355, -3 }, /* (421) parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ + { 353, -6 }, /* (422) joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ + { 356, 0 }, /* (423) join_type ::= */ + { 356, -1 }, /* (424) join_type ::= INNER */ + { 358, -12 }, /* (425) query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + { 359, 0 }, /* (426) set_quantifier_opt ::= */ + { 359, -1 }, /* (427) set_quantifier_opt ::= DISTINCT */ + { 359, -1 }, /* (428) set_quantifier_opt ::= ALL */ + { 360, -1 }, /* (429) select_list ::= select_item */ + { 360, -3 }, /* (430) select_list ::= select_list NK_COMMA select_item */ + { 368, -1 }, /* (431) select_item ::= NK_STAR */ + { 368, -1 }, /* (432) select_item ::= common_expression */ + { 368, -2 }, /* (433) select_item ::= common_expression column_alias */ + { 368, -3 }, /* (434) select_item ::= common_expression AS column_alias */ + { 368, -3 }, /* (435) select_item ::= table_name NK_DOT NK_STAR */ + { 326, 0 }, /* (436) where_clause_opt ::= */ + { 326, -2 }, /* (437) where_clause_opt ::= WHERE search_condition */ + { 361, 0 }, /* (438) partition_by_clause_opt ::= */ + { 361, -3 }, /* (439) partition_by_clause_opt ::= PARTITION BY expression_list */ + { 365, 0 }, /* (440) twindow_clause_opt ::= */ + { 365, -6 }, /* (441) twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ + { 365, -4 }, /* (442) twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ + { 365, -6 }, /* (443) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ + { 365, -8 }, /* (444) twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ + { 312, 0 }, /* (445) sliding_opt ::= */ + { 312, -4 }, /* (446) sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + { 364, 0 }, /* (447) fill_opt ::= */ + { 364, -4 }, /* (448) fill_opt ::= FILL NK_LP fill_mode NK_RP */ + { 364, -6 }, /* (449) fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ + { 369, -1 }, /* (450) fill_mode ::= NONE */ + { 369, -1 }, /* (451) fill_mode ::= PREV */ + { 369, -1 }, /* (452) fill_mode ::= NULL */ + { 369, -1 }, /* (453) fill_mode ::= LINEAR */ + { 369, -1 }, /* (454) fill_mode ::= NEXT */ + { 366, 0 }, /* (455) group_by_clause_opt ::= */ + { 366, -3 }, /* (456) group_by_clause_opt ::= GROUP BY group_by_list */ + { 370, -1 }, /* (457) group_by_list ::= expression */ + { 370, -3 }, /* (458) group_by_list ::= group_by_list NK_COMMA expression */ + { 367, 0 }, /* (459) having_clause_opt ::= */ + { 367, -2 }, /* (460) having_clause_opt ::= HAVING search_condition */ + { 362, 0 }, /* (461) range_opt ::= */ + { 362, -6 }, /* (462) range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ + { 363, 0 }, /* (463) every_opt ::= */ + { 363, -4 }, /* (464) every_opt ::= EVERY NK_LP duration_literal NK_RP */ + { 317, -4 }, /* (465) query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + { 371, -1 }, /* (466) query_expression_body ::= query_primary */ + { 371, -4 }, /* (467) query_expression_body ::= query_expression_body UNION ALL query_expression_body */ + { 371, -3 }, /* (468) query_expression_body ::= query_expression_body UNION query_expression_body */ + { 375, -1 }, /* (469) query_primary ::= query_specification */ + { 375, -6 }, /* (470) query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + { 372, 0 }, /* (471) order_by_clause_opt ::= */ + { 372, -3 }, /* (472) order_by_clause_opt ::= ORDER BY sort_specification_list */ + { 373, 0 }, /* (473) slimit_clause_opt ::= */ + { 373, -2 }, /* (474) slimit_clause_opt ::= SLIMIT NK_INTEGER */ + { 373, -4 }, /* (475) slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + { 373, -4 }, /* (476) slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 374, 0 }, /* (477) limit_clause_opt ::= */ + { 374, -2 }, /* (478) limit_clause_opt ::= LIMIT NK_INTEGER */ + { 374, -4 }, /* (479) limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ + { 374, -4 }, /* (480) limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + { 336, -3 }, /* (481) subquery ::= NK_LP query_expression NK_RP */ + { 357, -1 }, /* (482) search_condition ::= common_expression */ + { 376, -1 }, /* (483) sort_specification_list ::= sort_specification */ + { 376, -3 }, /* (484) sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ + { 377, -3 }, /* (485) sort_specification ::= expression ordering_specification_opt null_ordering_opt */ + { 378, 0 }, /* (486) ordering_specification_opt ::= */ + { 378, -1 }, /* (487) ordering_specification_opt ::= ASC */ + { 378, -1 }, /* (488) ordering_specification_opt ::= DESC */ + { 379, 0 }, /* (489) null_ordering_opt ::= */ + { 379, -2 }, /* (490) null_ordering_opt ::= NULLS FIRST */ + { 379, -2 }, /* (491) null_ordering_opt ::= NULLS LAST */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -3337,11 +3295,11 @@ static YYACTIONTYPE yy_reduce( YYMINORTYPE yylhsminor; case 0: /* cmd ::= CREATE ACCOUNT NK_ID PASS NK_STRING account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,261,&yymsp[0].minor); + yy_destructor(yypParser,258,&yymsp[0].minor); break; case 1: /* cmd ::= ALTER ACCOUNT NK_ID alter_account_options */ { pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,262,&yymsp[0].minor); + yy_destructor(yypParser,259,&yymsp[0].minor); break; case 2: /* account_options ::= */ { } @@ -3355,20 +3313,20 @@ static YYACTIONTYPE yy_reduce( case 9: /* account_options ::= account_options USERS literal */ yytestcase(yyruleno==9); case 10: /* account_options ::= account_options CONNS literal */ yytestcase(yyruleno==10); case 11: /* account_options ::= account_options STATE literal */ yytestcase(yyruleno==11); -{ yy_destructor(yypParser,261,&yymsp[-2].minor); +{ yy_destructor(yypParser,258,&yymsp[-2].minor); { } - yy_destructor(yypParser,263,&yymsp[0].minor); + yy_destructor(yypParser,260,&yymsp[0].minor); } break; case 12: /* alter_account_options ::= alter_account_option */ -{ yy_destructor(yypParser,264,&yymsp[0].minor); +{ yy_destructor(yypParser,261,&yymsp[0].minor); { } } break; case 13: /* alter_account_options ::= alter_account_options alter_account_option */ -{ yy_destructor(yypParser,262,&yymsp[-1].minor); +{ yy_destructor(yypParser,259,&yymsp[-1].minor); { } - yy_destructor(yypParser,264,&yymsp[0].minor); + yy_destructor(yypParser,261,&yymsp[0].minor); } break; case 14: /* alter_account_option ::= PASS literal */ @@ -3382,72 +3340,72 @@ static YYACTIONTYPE yy_reduce( case 22: /* alter_account_option ::= CONNS literal */ yytestcase(yyruleno==22); case 23: /* alter_account_option ::= STATE literal */ yytestcase(yyruleno==23); { } - yy_destructor(yypParser,263,&yymsp[0].minor); + yy_destructor(yypParser,260,&yymsp[0].minor); break; case 24: /* cmd ::= CREATE USER user_name PASS NK_STRING sysinfo_opt */ -{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy231, &yymsp[-1].minor.yy0, yymsp[0].minor.yy425); } +{ pCxt->pRootNode = createCreateUserStmt(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy0, yymsp[0].minor.yy543); } break; case 25: /* cmd ::= ALTER USER user_name PASS NK_STRING */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy231, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_PASSWD, &yymsp[0].minor.yy0); } break; case 26: /* cmd ::= ALTER USER user_name ENABLE NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy231, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_ENABLE, &yymsp[0].minor.yy0); } break; case 27: /* cmd ::= ALTER USER user_name SYSINFO NK_INTEGER */ -{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy231, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createAlterUserStmt(pCxt, &yymsp[-2].minor.yy129, TSDB_ALTER_USER_SYSINFO, &yymsp[0].minor.yy0); } break; case 28: /* cmd ::= DROP USER user_name */ -{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createDropUserStmt(pCxt, &yymsp[0].minor.yy129); } break; case 29: /* sysinfo_opt ::= */ -{ yymsp[1].minor.yy425 = 1; } +{ yymsp[1].minor.yy543 = 1; } break; case 30: /* sysinfo_opt ::= SYSINFO NK_INTEGER */ -{ yymsp[-1].minor.yy425 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } +{ yymsp[-1].minor.yy543 = taosStr2Int8(yymsp[0].minor.yy0.z, NULL, 10); } break; case 31: /* cmd ::= GRANT privileges ON priv_level TO user_name */ -{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy59, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createGrantStmt(pCxt, yymsp[-4].minor.yy549, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); } break; case 32: /* cmd ::= REVOKE privileges ON priv_level FROM user_name */ -{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy59, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createRevokeStmt(pCxt, yymsp[-4].minor.yy549, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); } break; case 33: /* privileges ::= ALL */ -{ yymsp[0].minor.yy59 = PRIVILEGE_TYPE_ALL; } +{ yymsp[0].minor.yy549 = PRIVILEGE_TYPE_ALL; } break; case 34: /* privileges ::= priv_type_list */ case 35: /* priv_type_list ::= priv_type */ yytestcase(yyruleno==35); -{ yylhsminor.yy59 = yymsp[0].minor.yy59; } - yymsp[0].minor.yy59 = yylhsminor.yy59; +{ yylhsminor.yy549 = yymsp[0].minor.yy549; } + yymsp[0].minor.yy549 = yylhsminor.yy549; break; case 36: /* priv_type_list ::= priv_type_list NK_COMMA priv_type */ -{ yylhsminor.yy59 = yymsp[-2].minor.yy59 | yymsp[0].minor.yy59; } - yymsp[-2].minor.yy59 = yylhsminor.yy59; +{ yylhsminor.yy549 = yymsp[-2].minor.yy549 | yymsp[0].minor.yy549; } + yymsp[-2].minor.yy549 = yylhsminor.yy549; break; case 37: /* priv_type ::= READ */ -{ yymsp[0].minor.yy59 = PRIVILEGE_TYPE_READ; } +{ yymsp[0].minor.yy549 = PRIVILEGE_TYPE_READ; } break; case 38: /* priv_type ::= WRITE */ -{ yymsp[0].minor.yy59 = PRIVILEGE_TYPE_WRITE; } +{ yymsp[0].minor.yy549 = PRIVILEGE_TYPE_WRITE; } break; case 39: /* priv_level ::= NK_STAR NK_DOT NK_STAR */ -{ yylhsminor.yy231 = yymsp[-2].minor.yy0; } - yymsp[-2].minor.yy231 = yylhsminor.yy231; +{ yylhsminor.yy129 = yymsp[-2].minor.yy0; } + yymsp[-2].minor.yy129 = yylhsminor.yy129; break; case 40: /* priv_level ::= db_name NK_DOT NK_STAR */ -{ yylhsminor.yy231 = yymsp[-2].minor.yy231; } - yymsp[-2].minor.yy231 = yylhsminor.yy231; +{ yylhsminor.yy129 = yymsp[-2].minor.yy129; } + yymsp[-2].minor.yy129 = yylhsminor.yy129; break; case 41: /* cmd ::= CREATE DNODE dnode_endpoint */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy231, NULL); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[0].minor.yy129, NULL); } break; case 42: /* cmd ::= CREATE DNODE dnode_endpoint PORT NK_INTEGER */ -{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy0); } +{ pCxt->pRootNode = createCreateDnodeStmt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } break; case 43: /* cmd ::= DROP DNODE NK_INTEGER */ { pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy0); } break; case 44: /* cmd ::= DROP DNODE dnode_endpoint */ -{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createDropDnodeStmt(pCxt, &yymsp[0].minor.yy129); } break; case 45: /* cmd ::= ALTER DNODE NK_INTEGER NK_STRING */ { pCxt->pRootNode = createAlterDnodeStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, NULL); } @@ -3464,32 +3422,32 @@ static YYACTIONTYPE yy_reduce( case 49: /* dnode_endpoint ::= NK_STRING */ case 50: /* dnode_endpoint ::= NK_ID */ yytestcase(yyruleno==50); case 51: /* dnode_endpoint ::= NK_IPTOKEN */ yytestcase(yyruleno==51); - case 316: /* db_name ::= NK_ID */ yytestcase(yyruleno==316); - case 317: /* table_name ::= NK_ID */ yytestcase(yyruleno==317); - case 318: /* column_name ::= NK_ID */ yytestcase(yyruleno==318); - case 319: /* function_name ::= NK_ID */ yytestcase(yyruleno==319); - case 320: /* table_alias ::= NK_ID */ yytestcase(yyruleno==320); - case 321: /* column_alias ::= NK_ID */ yytestcase(yyruleno==321); - case 322: /* user_name ::= NK_ID */ yytestcase(yyruleno==322); - case 323: /* index_name ::= NK_ID */ yytestcase(yyruleno==323); - case 324: /* topic_name ::= NK_ID */ yytestcase(yyruleno==324); - case 325: /* stream_name ::= NK_ID */ yytestcase(yyruleno==325); - case 326: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==326); - case 362: /* noarg_func ::= NOW */ yytestcase(yyruleno==362); - case 363: /* noarg_func ::= TODAY */ yytestcase(yyruleno==363); - case 364: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==364); - case 365: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==365); - case 366: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==366); - case 367: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==367); - case 368: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==368); - case 369: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==369); - case 370: /* noarg_func ::= USER */ yytestcase(yyruleno==370); - case 371: /* star_func ::= COUNT */ yytestcase(yyruleno==371); - case 372: /* star_func ::= FIRST */ yytestcase(yyruleno==372); - case 373: /* star_func ::= LAST */ yytestcase(yyruleno==373); - case 374: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==374); -{ yylhsminor.yy231 = yymsp[0].minor.yy0; } - yymsp[0].minor.yy231 = yylhsminor.yy231; + case 314: /* db_name ::= NK_ID */ yytestcase(yyruleno==314); + case 315: /* table_name ::= NK_ID */ yytestcase(yyruleno==315); + case 316: /* column_name ::= NK_ID */ yytestcase(yyruleno==316); + case 317: /* function_name ::= NK_ID */ yytestcase(yyruleno==317); + case 318: /* table_alias ::= NK_ID */ yytestcase(yyruleno==318); + case 319: /* column_alias ::= NK_ID */ yytestcase(yyruleno==319); + case 320: /* user_name ::= NK_ID */ yytestcase(yyruleno==320); + case 321: /* index_name ::= NK_ID */ yytestcase(yyruleno==321); + case 322: /* topic_name ::= NK_ID */ yytestcase(yyruleno==322); + case 323: /* stream_name ::= NK_ID */ yytestcase(yyruleno==323); + case 324: /* cgroup_name ::= NK_ID */ yytestcase(yyruleno==324); + case 360: /* noarg_func ::= NOW */ yytestcase(yyruleno==360); + case 361: /* noarg_func ::= TODAY */ yytestcase(yyruleno==361); + case 362: /* noarg_func ::= TIMEZONE */ yytestcase(yyruleno==362); + case 363: /* noarg_func ::= DATABASE */ yytestcase(yyruleno==363); + case 364: /* noarg_func ::= CLIENT_VERSION */ yytestcase(yyruleno==364); + case 365: /* noarg_func ::= SERVER_VERSION */ yytestcase(yyruleno==365); + case 366: /* noarg_func ::= SERVER_STATUS */ yytestcase(yyruleno==366); + case 367: /* noarg_func ::= CURRENT_USER */ yytestcase(yyruleno==367); + case 368: /* noarg_func ::= USER */ yytestcase(yyruleno==368); + case 369: /* star_func ::= COUNT */ yytestcase(yyruleno==369); + case 370: /* star_func ::= FIRST */ yytestcase(yyruleno==370); + case 371: /* star_func ::= LAST */ yytestcase(yyruleno==371); + case 372: /* star_func ::= LAST_ROW */ yytestcase(yyruleno==372); +{ yylhsminor.yy129 = yymsp[0].minor.yy0; } + yymsp[0].minor.yy129 = yylhsminor.yy129; break; case 52: /* cmd ::= ALTER LOCAL NK_STRING */ { pCxt->pRootNode = createAlterLocalStmt(pCxt, &yymsp[0].minor.yy0, NULL); } @@ -3522,189 +3480,189 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createDropComponentNodeStmt(pCxt, QUERY_NODE_DROP_MNODE_STMT, &yymsp[0].minor.yy0); } break; case 62: /* cmd ::= CREATE DATABASE not_exists_opt db_name db_options */ -{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy611, &yymsp[-1].minor.yy231, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createCreateDatabaseStmt(pCxt, yymsp[-2].minor.yy337, &yymsp[-1].minor.yy129, yymsp[0].minor.yy712); } break; case 63: /* cmd ::= DROP DATABASE exists_opt db_name */ -{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createDropDatabaseStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); } break; case 64: /* cmd ::= USE db_name */ -{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createUseDatabaseStmt(pCxt, &yymsp[0].minor.yy129); } break; case 65: /* cmd ::= ALTER DATABASE db_name alter_db_options */ -{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy231, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createAlterDatabaseStmt(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy712); } break; case 66: /* cmd ::= FLUSH DATABASE db_name */ -{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createFlushDatabaseStmt(pCxt, &yymsp[0].minor.yy129); } break; case 67: /* cmd ::= TRIM DATABASE db_name */ -{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createTrimDatabaseStmt(pCxt, &yymsp[0].minor.yy129); } break; case 68: /* not_exists_opt ::= IF NOT EXISTS */ -{ yymsp[-2].minor.yy611 = true; } +{ yymsp[-2].minor.yy337 = true; } break; case 69: /* not_exists_opt ::= */ case 71: /* exists_opt ::= */ yytestcase(yyruleno==71); case 255: /* analyze_opt ::= */ yytestcase(yyruleno==255); - case 263: /* agg_func_opt ::= */ yytestcase(yyruleno==263); - case 428: /* set_quantifier_opt ::= */ yytestcase(yyruleno==428); -{ yymsp[1].minor.yy611 = false; } + case 262: /* agg_func_opt ::= */ yytestcase(yyruleno==262); + case 426: /* set_quantifier_opt ::= */ yytestcase(yyruleno==426); +{ yymsp[1].minor.yy337 = false; } break; case 70: /* exists_opt ::= IF EXISTS */ -{ yymsp[-1].minor.yy611 = true; } +{ yymsp[-1].minor.yy337 = true; } break; case 72: /* db_options ::= */ -{ yymsp[1].minor.yy160 = createDefaultDatabaseOptions(pCxt); } +{ yymsp[1].minor.yy712 = createDefaultDatabaseOptions(pCxt); } break; case 73: /* db_options ::= db_options BUFFER NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_BUFFER, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 74: /* db_options ::= db_options CACHEMODEL NK_STRING */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_CACHEMODEL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 75: /* db_options ::= db_options CACHESIZE NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_CACHESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 76: /* db_options ::= db_options COMP NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_COMP, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_COMP, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 77: /* db_options ::= db_options DURATION NK_INTEGER */ case 78: /* db_options ::= db_options DURATION NK_VARIABLE */ yytestcase(yyruleno==78); -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_DAYS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 79: /* db_options ::= db_options FSYNC NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 79: /* db_options ::= db_options MAXROWS NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 80: /* db_options ::= db_options MAXROWS NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_MAXROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 80: /* db_options ::= db_options MINROWS NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 81: /* db_options ::= db_options MINROWS NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_MINROWS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 81: /* db_options ::= db_options KEEP integer_list */ + case 82: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==82); +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_KEEP, yymsp[0].minor.yy464); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 82: /* db_options ::= db_options KEEP integer_list */ - case 83: /* db_options ::= db_options KEEP variable_list */ yytestcase(yyruleno==83); -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_KEEP, yymsp[0].minor.yy180); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 83: /* db_options ::= db_options PAGES NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 84: /* db_options ::= db_options PAGES NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_PAGES, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 84: /* db_options ::= db_options PAGESIZE NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 85: /* db_options ::= db_options PAGESIZE NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_PAGESIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 85: /* db_options ::= db_options PRECISION NK_STRING */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 86: /* db_options ::= db_options PRECISION NK_STRING */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_PRECISION, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 86: /* db_options ::= db_options REPLICA NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 87: /* db_options ::= db_options REPLICA NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_REPLICA, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 87: /* db_options ::= db_options STRICT NK_STRING */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 88: /* db_options ::= db_options STRICT NK_STRING */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_STRICT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 88: /* db_options ::= db_options VGROUPS NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 89: /* db_options ::= db_options WAL NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 89: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 90: /* db_options ::= db_options VGROUPS NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_VGROUPS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 90: /* db_options ::= db_options RETENTIONS retention_list */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_RETENTIONS, yymsp[0].minor.yy464); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 91: /* db_options ::= db_options SINGLE_STABLE NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_SINGLE_STABLE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 91: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 92: /* db_options ::= db_options RETENTIONS retention_list */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_RETENTIONS, yymsp[0].minor.yy180); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 92: /* db_options ::= db_options WAL_LEVEL NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 93: /* db_options ::= db_options SCHEMALESS NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_SCHEMALESS, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 93: /* db_options ::= db_options WAL_FSYNC_PERIOD NK_INTEGER */ +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_FSYNC, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 94: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_RETENTION_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 95: /* db_options ::= db_options WAL_RETENTION_PERIOD NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-3].minor.yy160, DB_OPTION_WAL_RETENTION_PERIOD, &t); + yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-3].minor.yy712, DB_OPTION_WAL_RETENTION_PERIOD, &t); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 96: /* db_options ::= db_options WAL_RETENTION_SIZE NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_RETENTION_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 97: /* db_options ::= db_options WAL_RETENTION_SIZE NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-3].minor.yy160, DB_OPTION_WAL_RETENTION_SIZE, &t); + yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-3].minor.yy712, DB_OPTION_WAL_RETENTION_SIZE, &t); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 98: /* db_options ::= db_options WAL_ROLL_PERIOD NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_ROLL_PERIOD, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 99: /* db_options ::= db_options WAL_SEGMENT_SIZE NK_INTEGER */ -{ yylhsminor.yy160 = setDatabaseOption(pCxt, yymsp[-2].minor.yy160, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setDatabaseOption(pCxt, yymsp[-2].minor.yy712, DB_OPTION_WAL_SEGMENT_SIZE, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 100: /* alter_db_options ::= alter_db_option */ -{ yylhsminor.yy160 = createAlterDatabaseOptions(pCxt); yylhsminor.yy160 = setAlterDatabaseOption(pCxt, yylhsminor.yy160, &yymsp[0].minor.yy189); } - yymsp[0].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterDatabaseOptions(pCxt); yylhsminor.yy712 = setAlterDatabaseOption(pCxt, yylhsminor.yy712, &yymsp[0].minor.yy405); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 101: /* alter_db_options ::= alter_db_options alter_db_option */ -{ yylhsminor.yy160 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy160, &yymsp[0].minor.yy189); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setAlterDatabaseOption(pCxt, yymsp[-1].minor.yy712, &yymsp[0].minor.yy405); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 102: /* alter_db_option ::= CACHEMODEL NK_STRING */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy405.type = DB_OPTION_CACHEMODEL; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; } break; case 103: /* alter_db_option ::= CACHESIZE NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy405.type = DB_OPTION_CACHESIZE; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; } break; - case 104: /* alter_db_option ::= FSYNC NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } + case 104: /* alter_db_option ::= WAL_FSYNC_PERIOD NK_INTEGER */ +{ yymsp[-1].minor.yy405.type = DB_OPTION_FSYNC; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; } break; case 105: /* alter_db_option ::= KEEP integer_list */ case 106: /* alter_db_option ::= KEEP variable_list */ yytestcase(yyruleno==106); -{ yymsp[-1].minor.yy189.type = DB_OPTION_KEEP; yymsp[-1].minor.yy189.pList = yymsp[0].minor.yy180; } +{ yymsp[-1].minor.yy405.type = DB_OPTION_KEEP; yymsp[-1].minor.yy405.pList = yymsp[0].minor.yy464; } break; - case 107: /* alter_db_option ::= WAL NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = DB_OPTION_WAL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } + case 107: /* alter_db_option ::= WAL_LEVEL NK_INTEGER */ +{ yymsp[-1].minor.yy405.type = DB_OPTION_WAL; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; } break; case 108: /* integer_list ::= NK_INTEGER */ -{ yylhsminor.yy180 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy180 = yylhsminor.yy180; +{ yylhsminor.yy464 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy464 = yylhsminor.yy464; break; case 109: /* integer_list ::= integer_list NK_COMMA NK_INTEGER */ - case 285: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==285); -{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy180 = yylhsminor.yy180; + case 284: /* dnode_list ::= dnode_list DNODE NK_INTEGER */ yytestcase(yyruleno==284); +{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy464 = yylhsminor.yy464; break; case 110: /* variable_list ::= NK_VARIABLE */ -{ yylhsminor.yy180 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy180 = yylhsminor.yy180; +{ yylhsminor.yy464 = createNodeList(pCxt, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy464 = yylhsminor.yy464; break; case 111: /* variable_list ::= variable_list NK_COMMA NK_VARIABLE */ -{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy180 = yylhsminor.yy180; +{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy464 = yylhsminor.yy464; break; case 112: /* retention_list ::= retention */ case 132: /* multi_create_clause ::= create_subtable_clause */ yytestcase(yyruleno==132); @@ -3713,266 +3671,266 @@ static YYACTIONTYPE yy_reduce( case 185: /* rollup_func_list ::= rollup_func_name */ yytestcase(yyruleno==185); case 190: /* col_name_list ::= col_name */ yytestcase(yyruleno==190); case 238: /* func_list ::= func */ yytestcase(yyruleno==238); - case 314: /* literal_list ::= signed_literal */ yytestcase(yyruleno==314); - case 377: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==377); - case 431: /* select_list ::= select_item */ yytestcase(yyruleno==431); - case 485: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==485); -{ yylhsminor.yy180 = createNodeList(pCxt, yymsp[0].minor.yy160); } - yymsp[0].minor.yy180 = yylhsminor.yy180; + case 312: /* literal_list ::= signed_literal */ yytestcase(yyruleno==312); + case 375: /* other_para_list ::= star_func_para */ yytestcase(yyruleno==375); + case 429: /* select_list ::= select_item */ yytestcase(yyruleno==429); + case 483: /* sort_specification_list ::= sort_specification */ yytestcase(yyruleno==483); +{ yylhsminor.yy464 = createNodeList(pCxt, yymsp[0].minor.yy712); } + yymsp[0].minor.yy464 = yylhsminor.yy464; break; case 113: /* retention_list ::= retention_list NK_COMMA retention */ case 143: /* column_def_list ::= column_def_list NK_COMMA column_def */ yytestcase(yyruleno==143); case 186: /* rollup_func_list ::= rollup_func_list NK_COMMA rollup_func_name */ yytestcase(yyruleno==186); case 191: /* col_name_list ::= col_name_list NK_COMMA col_name */ yytestcase(yyruleno==191); case 239: /* func_list ::= func_list NK_COMMA func */ yytestcase(yyruleno==239); - case 315: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==315); - case 378: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==378); - case 432: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==432); - case 486: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==486); -{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, yymsp[0].minor.yy160); } - yymsp[-2].minor.yy180 = yylhsminor.yy180; + case 313: /* literal_list ::= literal_list NK_COMMA signed_literal */ yytestcase(yyruleno==313); + case 376: /* other_para_list ::= other_para_list NK_COMMA star_func_para */ yytestcase(yyruleno==376); + case 430: /* select_list ::= select_list NK_COMMA select_item */ yytestcase(yyruleno==430); + case 484: /* sort_specification_list ::= sort_specification_list NK_COMMA sort_specification */ yytestcase(yyruleno==484); +{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, yymsp[0].minor.yy712); } + yymsp[-2].minor.yy464 = yylhsminor.yy464; break; case 114: /* retention ::= NK_VARIABLE NK_COLON NK_VARIABLE */ -{ yylhsminor.yy160 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createNodeListNodeEx(pCxt, createDurationValueNode(pCxt, &yymsp[-2].minor.yy0), createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 115: /* cmd ::= CREATE TABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def_opt table_options */ case 117: /* cmd ::= CREATE STABLE not_exists_opt full_table_name NK_LP column_def_list NK_RP tags_def table_options */ yytestcase(yyruleno==117); -{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy611, yymsp[-5].minor.yy160, yymsp[-3].minor.yy180, yymsp[-1].minor.yy180, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createCreateTableStmt(pCxt, yymsp[-6].minor.yy337, yymsp[-5].minor.yy712, yymsp[-3].minor.yy464, yymsp[-1].minor.yy464, yymsp[0].minor.yy712); } break; case 116: /* cmd ::= CREATE TABLE multi_create_clause */ -{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy180); } +{ pCxt->pRootNode = createCreateMultiTableStmt(pCxt, yymsp[0].minor.yy464); } break; case 118: /* cmd ::= DROP TABLE multi_drop_clause */ -{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy180); } +{ pCxt->pRootNode = createDropTableStmt(pCxt, yymsp[0].minor.yy464); } break; case 119: /* cmd ::= DROP STABLE exists_opt full_table_name */ -{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy611, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createDropSuperTableStmt(pCxt, yymsp[-1].minor.yy337, yymsp[0].minor.yy712); } break; case 120: /* cmd ::= ALTER TABLE alter_table_clause */ - case 288: /* cmd ::= query_expression */ yytestcase(yyruleno==288); -{ pCxt->pRootNode = yymsp[0].minor.yy160; } + case 286: /* cmd ::= query_expression */ yytestcase(yyruleno==286); +{ pCxt->pRootNode = yymsp[0].minor.yy712; } break; case 121: /* cmd ::= ALTER STABLE alter_table_clause */ -{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy160); } +{ pCxt->pRootNode = setAlterSuperTableType(yymsp[0].minor.yy712); } break; case 122: /* alter_table_clause ::= full_table_name alter_table_options */ -{ yylhsminor.yy160 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableModifyOptions(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 123: /* alter_table_clause ::= full_table_name ADD COLUMN column_name type_name */ -{ yylhsminor.yy160 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190); } - yymsp[-4].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_ADD_COLUMN, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); } + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 124: /* alter_table_clause ::= full_table_name DROP COLUMN column_name */ -{ yylhsminor.yy160 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy160, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy231); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy712, TSDB_ALTER_TABLE_DROP_COLUMN, &yymsp[0].minor.yy129); } + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 125: /* alter_table_clause ::= full_table_name MODIFY COLUMN column_name type_name */ -{ yylhsminor.yy160 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190); } - yymsp[-4].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_COLUMN_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); } + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 126: /* alter_table_clause ::= full_table_name RENAME COLUMN column_name column_name */ -{ yylhsminor.yy160 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy231, &yymsp[0].minor.yy231); } - yymsp[-4].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_COLUMN_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 127: /* alter_table_clause ::= full_table_name ADD TAG column_name type_name */ -{ yylhsminor.yy160 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190); } - yymsp[-4].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_ADD_TAG, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); } + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 128: /* alter_table_clause ::= full_table_name DROP TAG column_name */ -{ yylhsminor.yy160 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy160, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy231); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableDropCol(pCxt, yymsp[-3].minor.yy712, TSDB_ALTER_TABLE_DROP_TAG, &yymsp[0].minor.yy129); } + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 129: /* alter_table_clause ::= full_table_name MODIFY TAG column_name type_name */ -{ yylhsminor.yy160 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190); } - yymsp[-4].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableAddModifyCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_TAG_BYTES, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184); } + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 130: /* alter_table_clause ::= full_table_name RENAME TAG column_name column_name */ -{ yylhsminor.yy160 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy160, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy231, &yymsp[0].minor.yy231); } - yymsp[-4].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableRenameCol(pCxt, yymsp[-4].minor.yy712, TSDB_ALTER_TABLE_UPDATE_TAG_NAME, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 131: /* alter_table_clause ::= full_table_name SET TAG column_name NK_EQ signed_literal */ -{ yylhsminor.yy160 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy160, &yymsp[-2].minor.yy231, yymsp[0].minor.yy160); } - yymsp[-5].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableSetTag(pCxt, yymsp[-5].minor.yy712, &yymsp[-2].minor.yy129, yymsp[0].minor.yy712); } + yymsp[-5].minor.yy712 = yylhsminor.yy712; break; case 133: /* multi_create_clause ::= multi_create_clause create_subtable_clause */ case 136: /* multi_drop_clause ::= multi_drop_clause drop_table_clause */ yytestcase(yyruleno==136); -{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-1].minor.yy180, yymsp[0].minor.yy160); } - yymsp[-1].minor.yy180 = yylhsminor.yy180; +{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-1].minor.yy464, yymsp[0].minor.yy712); } + yymsp[-1].minor.yy464 = yylhsminor.yy464; break; case 134: /* create_subtable_clause ::= not_exists_opt full_table_name USING full_table_name specific_cols_opt TAGS NK_LP expression_list NK_RP table_options */ -{ yylhsminor.yy160 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy611, yymsp[-8].minor.yy160, yymsp[-6].minor.yy160, yymsp[-5].minor.yy180, yymsp[-2].minor.yy180, yymsp[0].minor.yy160); } - yymsp[-9].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createCreateSubTableClause(pCxt, yymsp[-9].minor.yy337, yymsp[-8].minor.yy712, yymsp[-6].minor.yy712, yymsp[-5].minor.yy464, yymsp[-2].minor.yy464, yymsp[0].minor.yy712); } + yymsp[-9].minor.yy712 = yylhsminor.yy712; break; case 137: /* drop_table_clause ::= exists_opt full_table_name */ -{ yylhsminor.yy160 = createDropTableClause(pCxt, yymsp[-1].minor.yy611, yymsp[0].minor.yy160); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createDropTableClause(pCxt, yymsp[-1].minor.yy337, yymsp[0].minor.yy712); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 138: /* specific_cols_opt ::= */ case 169: /* tags_def_opt ::= */ yytestcase(yyruleno==169); - case 440: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==440); - case 457: /* group_by_clause_opt ::= */ yytestcase(yyruleno==457); - case 473: /* order_by_clause_opt ::= */ yytestcase(yyruleno==473); -{ yymsp[1].minor.yy180 = NULL; } + case 438: /* partition_by_clause_opt ::= */ yytestcase(yyruleno==438); + case 455: /* group_by_clause_opt ::= */ yytestcase(yyruleno==455); + case 471: /* order_by_clause_opt ::= */ yytestcase(yyruleno==471); +{ yymsp[1].minor.yy464 = NULL; } break; case 139: /* specific_cols_opt ::= NK_LP col_name_list NK_RP */ -{ yymsp[-2].minor.yy180 = yymsp[-1].minor.yy180; } +{ yymsp[-2].minor.yy464 = yymsp[-1].minor.yy464; } break; case 140: /* full_table_name ::= table_name */ -{ yylhsminor.yy160 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy231, NULL); } - yymsp[0].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createRealTableNode(pCxt, NULL, &yymsp[0].minor.yy129, NULL); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 141: /* full_table_name ::= db_name NK_DOT table_name */ -{ yylhsminor.yy160 = createRealTableNode(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231, NULL); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createRealTableNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, NULL); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 144: /* column_def ::= column_name type_name */ -{ yylhsminor.yy160 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy231, yymsp[0].minor.yy190, NULL); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createColumnDefNode(pCxt, &yymsp[-1].minor.yy129, yymsp[0].minor.yy184, NULL); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 145: /* column_def ::= column_name type_name COMMENT NK_STRING */ -{ yylhsminor.yy160 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy231, yymsp[-2].minor.yy190, &yymsp[0].minor.yy0); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createColumnDefNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-2].minor.yy184, &yymsp[0].minor.yy0); } + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 146: /* type_name ::= BOOL */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_BOOL); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_BOOL); } break; case 147: /* type_name ::= TINYINT */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_TINYINT); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_TINYINT); } break; case 148: /* type_name ::= SMALLINT */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_SMALLINT); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_SMALLINT); } break; case 149: /* type_name ::= INT */ case 150: /* type_name ::= INTEGER */ yytestcase(yyruleno==150); -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_INT); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_INT); } break; case 151: /* type_name ::= BIGINT */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_BIGINT); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_BIGINT); } break; case 152: /* type_name ::= FLOAT */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_FLOAT); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_FLOAT); } break; case 153: /* type_name ::= DOUBLE */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_DOUBLE); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_DOUBLE); } break; case 154: /* type_name ::= BINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy190 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy0); } break; case 155: /* type_name ::= TIMESTAMP */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_TIMESTAMP); } break; case 156: /* type_name ::= NCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy190 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_NCHAR, &yymsp[-1].minor.yy0); } break; case 157: /* type_name ::= TINYINT UNSIGNED */ -{ yymsp[-1].minor.yy190 = createDataType(TSDB_DATA_TYPE_UTINYINT); } +{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_UTINYINT); } break; case 158: /* type_name ::= SMALLINT UNSIGNED */ -{ yymsp[-1].minor.yy190 = createDataType(TSDB_DATA_TYPE_USMALLINT); } +{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_USMALLINT); } break; case 159: /* type_name ::= INT UNSIGNED */ -{ yymsp[-1].minor.yy190 = createDataType(TSDB_DATA_TYPE_UINT); } +{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_UINT); } break; case 160: /* type_name ::= BIGINT UNSIGNED */ -{ yymsp[-1].minor.yy190 = createDataType(TSDB_DATA_TYPE_UBIGINT); } +{ yymsp[-1].minor.yy184 = createDataType(TSDB_DATA_TYPE_UBIGINT); } break; case 161: /* type_name ::= JSON */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_JSON); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_JSON); } break; case 162: /* type_name ::= VARCHAR NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy190 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_VARCHAR, &yymsp[-1].minor.yy0); } break; case 163: /* type_name ::= MEDIUMBLOB */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_MEDIUMBLOB); } break; case 164: /* type_name ::= BLOB */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_BLOB); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_BLOB); } break; case 165: /* type_name ::= VARBINARY NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy190 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } +{ yymsp[-3].minor.yy184 = createVarLenDataType(TSDB_DATA_TYPE_VARBINARY, &yymsp[-1].minor.yy0); } break; case 166: /* type_name ::= DECIMAL */ -{ yymsp[0].minor.yy190 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[0].minor.yy184 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 167: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_RP */ -{ yymsp[-3].minor.yy190 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-3].minor.yy184 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 168: /* type_name ::= DECIMAL NK_LP NK_INTEGER NK_COMMA NK_INTEGER NK_RP */ -{ yymsp[-5].minor.yy190 = createDataType(TSDB_DATA_TYPE_DECIMAL); } +{ yymsp[-5].minor.yy184 = createDataType(TSDB_DATA_TYPE_DECIMAL); } break; case 170: /* tags_def_opt ::= tags_def */ - case 376: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==376); -{ yylhsminor.yy180 = yymsp[0].minor.yy180; } - yymsp[0].minor.yy180 = yylhsminor.yy180; + case 374: /* star_func_para_list ::= other_para_list */ yytestcase(yyruleno==374); +{ yylhsminor.yy464 = yymsp[0].minor.yy464; } + yymsp[0].minor.yy464 = yylhsminor.yy464; break; case 171: /* tags_def ::= TAGS NK_LP column_def_list NK_RP */ -{ yymsp[-3].minor.yy180 = yymsp[-1].minor.yy180; } +{ yymsp[-3].minor.yy464 = yymsp[-1].minor.yy464; } break; case 172: /* table_options ::= */ -{ yymsp[1].minor.yy160 = createDefaultTableOptions(pCxt); } +{ yymsp[1].minor.yy712 = createDefaultTableOptions(pCxt); } break; case 173: /* table_options ::= table_options COMMENT NK_STRING */ -{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-2].minor.yy160, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_COMMENT, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 174: /* table_options ::= table_options MAX_DELAY duration_list */ -{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-2].minor.yy160, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy180); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_MAXDELAY, yymsp[0].minor.yy464); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 175: /* table_options ::= table_options WATERMARK duration_list */ -{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-2].minor.yy160, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy180); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_WATERMARK, yymsp[0].minor.yy464); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 176: /* table_options ::= table_options ROLLUP NK_LP rollup_func_list NK_RP */ -{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-4].minor.yy160, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy180); } - yymsp[-4].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-4].minor.yy712, TABLE_OPTION_ROLLUP, yymsp[-1].minor.yy464); } + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 177: /* table_options ::= table_options TTL NK_INTEGER */ -{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-2].minor.yy160, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-2].minor.yy712, TABLE_OPTION_TTL, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 178: /* table_options ::= table_options SMA NK_LP col_name_list NK_RP */ -{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-4].minor.yy160, TABLE_OPTION_SMA, yymsp[-1].minor.yy180); } - yymsp[-4].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-4].minor.yy712, TABLE_OPTION_SMA, yymsp[-1].minor.yy464); } + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; case 179: /* alter_table_options ::= alter_table_option */ -{ yylhsminor.yy160 = createAlterTableOptions(pCxt); yylhsminor.yy160 = setTableOption(pCxt, yylhsminor.yy160, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } - yymsp[0].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createAlterTableOptions(pCxt); yylhsminor.yy712 = setTableOption(pCxt, yylhsminor.yy712, yymsp[0].minor.yy405.type, &yymsp[0].minor.yy405.val); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 180: /* alter_table_options ::= alter_table_options alter_table_option */ -{ yylhsminor.yy160 = setTableOption(pCxt, yymsp[-1].minor.yy160, yymsp[0].minor.yy189.type, &yymsp[0].minor.yy189.val); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setTableOption(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy405.type, &yymsp[0].minor.yy405.val); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 181: /* alter_table_option ::= COMMENT NK_STRING */ -{ yymsp[-1].minor.yy189.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy405.type = TABLE_OPTION_COMMENT; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; } break; case 182: /* alter_table_option ::= TTL NK_INTEGER */ -{ yymsp[-1].minor.yy189.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy189.val = yymsp[0].minor.yy0; } +{ yymsp[-1].minor.yy405.type = TABLE_OPTION_TTL; yymsp[-1].minor.yy405.val = yymsp[0].minor.yy0; } break; case 183: /* duration_list ::= duration_literal */ - case 343: /* expression_list ::= expression */ yytestcase(yyruleno==343); -{ yylhsminor.yy180 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy160)); } - yymsp[0].minor.yy180 = yylhsminor.yy180; + case 341: /* expression_list ::= expression */ yytestcase(yyruleno==341); +{ yylhsminor.yy464 = createNodeList(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } + yymsp[0].minor.yy464 = yylhsminor.yy464; break; case 184: /* duration_list ::= duration_list NK_COMMA duration_literal */ - case 344: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==344); -{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, releaseRawExprNode(pCxt, yymsp[0].minor.yy160)); } - yymsp[-2].minor.yy180 = yylhsminor.yy180; + case 342: /* expression_list ::= expression_list NK_COMMA expression */ yytestcase(yyruleno==342); +{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } + yymsp[-2].minor.yy464 = yylhsminor.yy464; break; case 187: /* rollup_func_name ::= function_name */ -{ yylhsminor.yy160 = createFunctionNode(pCxt, &yymsp[0].minor.yy231, NULL); } - yymsp[0].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[0].minor.yy129, NULL); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 188: /* rollup_func_name ::= FIRST */ case 189: /* rollup_func_name ::= LAST */ yytestcase(yyruleno==189); -{ yylhsminor.yy160 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } - yymsp[0].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 192: /* col_name ::= column_name */ -{ yylhsminor.yy160 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy231); } - yymsp[0].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 193: /* cmd ::= SHOW DNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DNODES_STMT); } @@ -3984,13 +3942,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_DATABASES_STMT); } break; case 196: /* cmd ::= SHOW db_name_cond_opt TABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy160, yymsp[0].minor.yy160, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TABLES_STMT, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, OP_TYPE_LIKE); } break; case 197: /* cmd ::= SHOW db_name_cond_opt STABLES like_pattern_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy160, yymsp[0].minor.yy160, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_STABLES_STMT, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, OP_TYPE_LIKE); } break; case 198: /* cmd ::= SHOW db_name_cond_opt VGROUPS */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy160, NULL, OP_TYPE_LIKE); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_VGROUPS_STMT, yymsp[-1].minor.yy712, NULL, OP_TYPE_LIKE); } break; case 199: /* cmd ::= SHOW MNODES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_MNODES_STMT); } @@ -4005,7 +3963,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_FUNCTIONS_STMT); } break; case 203: /* cmd ::= SHOW INDEXES FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy160, yymsp[-1].minor.yy160, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_INDEXES_STMT, yymsp[0].minor.yy712, yymsp[-1].minor.yy712, OP_TYPE_EQUAL); } break; case 204: /* cmd ::= SHOW STREAMS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_STREAMS_STMT); } @@ -4024,13 +3982,13 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_LICENCE_STMT); } break; case 210: /* cmd ::= SHOW CREATE DATABASE db_name */ -{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createShowCreateDatabaseStmt(pCxt, &yymsp[0].minor.yy129); } break; case 211: /* cmd ::= SHOW CREATE TABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_TABLE_STMT, yymsp[0].minor.yy712); } break; case 212: /* cmd ::= SHOW CREATE STABLE full_table_name */ -{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createShowCreateTableStmt(pCxt, QUERY_NODE_SHOW_CREATE_STABLE_STMT, yymsp[0].minor.yy712); } break; case 213: /* cmd ::= SHOW QUERIES */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_QUERIES_STMT); } @@ -4063,7 +4021,7 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_TRANSACTIONS_STMT); } break; case 223: /* cmd ::= SHOW TABLE DISTRIBUTED full_table_name */ -{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createShowTableDistributedStmt(pCxt, yymsp[0].minor.yy712); } break; case 224: /* cmd ::= SHOW CONSUMERS */ { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_CONSUMERS_STMT); } @@ -4072,720 +4030,713 @@ static YYACTIONTYPE yy_reduce( { pCxt->pRootNode = createShowStmt(pCxt, QUERY_NODE_SHOW_SUBSCRIPTIONS_STMT); } break; case 226: /* cmd ::= SHOW TAGS FROM table_name_cond from_db_opt */ -{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy160, yymsp[-1].minor.yy160, OP_TYPE_EQUAL); } +{ pCxt->pRootNode = createShowStmtWithCond(pCxt, QUERY_NODE_SHOW_TAGS_STMT, yymsp[0].minor.yy712, yymsp[-1].minor.yy712, OP_TYPE_EQUAL); } break; case 227: /* db_name_cond_opt ::= */ case 232: /* from_db_opt ::= */ yytestcase(yyruleno==232); -{ yymsp[1].minor.yy160 = createDefaultDatabaseCondValue(pCxt); } +{ yymsp[1].minor.yy712 = createDefaultDatabaseCondValue(pCxt); } break; case 228: /* db_name_cond_opt ::= db_name NK_DOT */ -{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy231); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-1].minor.yy129); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; case 229: /* like_pattern_opt ::= */ - case 269: /* into_opt ::= */ yytestcase(yyruleno==269); - case 409: /* from_clause_opt ::= */ yytestcase(yyruleno==409); - case 438: /* where_clause_opt ::= */ yytestcase(yyruleno==438); - case 442: /* twindow_clause_opt ::= */ yytestcase(yyruleno==442); - case 447: /* sliding_opt ::= */ yytestcase(yyruleno==447); - case 449: /* fill_opt ::= */ yytestcase(yyruleno==449); - case 461: /* having_clause_opt ::= */ yytestcase(yyruleno==461); - case 463: /* range_opt ::= */ yytestcase(yyruleno==463); - case 465: /* every_opt ::= */ yytestcase(yyruleno==465); - case 475: /* slimit_clause_opt ::= */ yytestcase(yyruleno==475); - case 479: /* limit_clause_opt ::= */ yytestcase(yyruleno==479); -{ yymsp[1].minor.yy160 = NULL; } + case 268: /* into_opt ::= */ yytestcase(yyruleno==268); + case 407: /* from_clause_opt ::= */ yytestcase(yyruleno==407); + case 436: /* where_clause_opt ::= */ yytestcase(yyruleno==436); + case 440: /* twindow_clause_opt ::= */ yytestcase(yyruleno==440); + case 445: /* sliding_opt ::= */ yytestcase(yyruleno==445); + case 447: /* fill_opt ::= */ yytestcase(yyruleno==447); + case 459: /* having_clause_opt ::= */ yytestcase(yyruleno==459); + case 461: /* range_opt ::= */ yytestcase(yyruleno==461); + case 463: /* every_opt ::= */ yytestcase(yyruleno==463); + case 473: /* slimit_clause_opt ::= */ yytestcase(yyruleno==473); + case 477: /* limit_clause_opt ::= */ yytestcase(yyruleno==477); +{ yymsp[1].minor.yy712 = NULL; } break; case 230: /* like_pattern_opt ::= LIKE NK_STRING */ -{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } +{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } break; case 231: /* table_name_cond ::= table_name */ -{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy231); } - yymsp[0].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; case 233: /* from_db_opt ::= FROM db_name */ -{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy231); } +{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy129); } break; case 234: /* cmd ::= CREATE SMA INDEX not_exists_opt index_name ON table_name index_options */ -{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy611, &yymsp[-3].minor.yy231, &yymsp[-1].minor.yy231, NULL, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createCreateIndexStmt(pCxt, INDEX_TYPE_SMA, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, NULL, yymsp[0].minor.yy712); } break; case 235: /* cmd ::= DROP INDEX exists_opt index_name */ -{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createDropIndexStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); } break; case 236: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-9].minor.yy160 = createIndexOption(pCxt, yymsp[-7].minor.yy180, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), NULL, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } +{ yymsp[-9].minor.yy712 = createIndexOption(pCxt, yymsp[-7].minor.yy464, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } break; case 237: /* index_options ::= FUNCTION NK_LP func_list NK_RP INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt sma_stream_opt */ -{ yymsp[-11].minor.yy160 = createIndexOption(pCxt, yymsp[-9].minor.yy180, releaseRawExprNode(pCxt, yymsp[-5].minor.yy160), releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } +{ yymsp[-11].minor.yy712 = createIndexOption(pCxt, yymsp[-9].minor.yy464, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } break; case 240: /* func ::= function_name NK_LP expression_list NK_RP */ -{ yylhsminor.yy160 = createFunctionNode(pCxt, &yymsp[-3].minor.yy231, yymsp[-1].minor.yy180); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy464); } + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; case 241: /* sma_stream_opt ::= */ - case 271: /* stream_options ::= */ yytestcase(yyruleno==271); -{ yymsp[1].minor.yy160 = createStreamOptions(pCxt); } + case 270: /* stream_options ::= */ yytestcase(yyruleno==270); +{ yymsp[1].minor.yy712 = createStreamOptions(pCxt); } break; case 242: /* sma_stream_opt ::= stream_options WATERMARK duration_literal */ - case 275: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==275); -{ ((SStreamOptions*)yymsp[-2].minor.yy160)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy160); yylhsminor.yy160 = yymsp[-2].minor.yy160; } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 274: /* stream_options ::= stream_options WATERMARK duration_literal */ yytestcase(yyruleno==274); +{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pWatermark = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 243: /* sma_stream_opt ::= stream_options MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-2].minor.yy160)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy160); yylhsminor.yy160 = yymsp[-2].minor.yy160; } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ ((SStreamOptions*)yymsp[-2].minor.yy712)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-2].minor.yy712; } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 244: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS query_expression */ -{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy611, &yymsp[-2].minor.yy231, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createCreateTopicStmtUseQuery(pCxt, yymsp[-3].minor.yy337, &yymsp[-2].minor.yy129, yymsp[0].minor.yy712); } break; case 245: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy611, &yymsp[-3].minor.yy231, &yymsp[0].minor.yy231, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy129, false); } break; case 246: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS DATABASE db_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy611, &yymsp[-5].minor.yy231, &yymsp[0].minor.yy231, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseDb(pCxt, yymsp[-6].minor.yy337, &yymsp[-5].minor.yy129, &yymsp[0].minor.yy129, true); } break; case 247: /* cmd ::= CREATE TOPIC not_exists_opt topic_name AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy611, &yymsp[-3].minor.yy231, yymsp[0].minor.yy160, false); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-4].minor.yy337, &yymsp[-3].minor.yy129, yymsp[0].minor.yy712, false); } break; case 248: /* cmd ::= CREATE TOPIC not_exists_opt topic_name WITH META AS STABLE full_table_name */ -{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy611, &yymsp[-5].minor.yy231, yymsp[0].minor.yy160, true); } +{ pCxt->pRootNode = createCreateTopicStmtUseTable(pCxt, yymsp[-6].minor.yy337, &yymsp[-5].minor.yy129, yymsp[0].minor.yy712, true); } break; case 249: /* cmd ::= DROP TOPIC exists_opt topic_name */ -{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createDropTopicStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); } break; case 250: /* cmd ::= DROP CONSUMER GROUP exists_opt cgroup_name ON topic_name */ -{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy611, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231); } +{ pCxt->pRootNode = createDropCGroupStmt(pCxt, yymsp[-3].minor.yy337, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129); } break; case 251: /* cmd ::= DESC full_table_name */ case 252: /* cmd ::= DESCRIBE full_table_name */ yytestcase(yyruleno==252); -{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createDescribeStmt(pCxt, yymsp[0].minor.yy712); } break; case 253: /* cmd ::= RESET QUERY CACHE */ { pCxt->pRootNode = createResetQueryCacheStmt(pCxt); } break; case 254: /* cmd ::= EXPLAIN analyze_opt explain_options query_expression */ -{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy611, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } +{ pCxt->pRootNode = createExplainStmt(pCxt, yymsp[-2].minor.yy337, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } break; case 256: /* analyze_opt ::= ANALYZE */ - case 264: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==264); - case 429: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==429); -{ yymsp[0].minor.yy611 = true; } + case 263: /* agg_func_opt ::= AGGREGATE */ yytestcase(yyruleno==263); + case 427: /* set_quantifier_opt ::= DISTINCT */ yytestcase(yyruleno==427); +{ yymsp[0].minor.yy337 = true; } break; case 257: /* explain_options ::= */ -{ yymsp[1].minor.yy160 = createDefaultExplainOptions(pCxt); } +{ yymsp[1].minor.yy712 = createDefaultExplainOptions(pCxt); } break; case 258: /* explain_options ::= explain_options VERBOSE NK_BOOL */ -{ yylhsminor.yy160 = setExplainVerbose(pCxt, yymsp[-2].minor.yy160, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setExplainVerbose(pCxt, yymsp[-2].minor.yy712, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; case 259: /* explain_options ::= explain_options RATIO NK_FLOAT */ -{ yylhsminor.yy160 = setExplainRatio(pCxt, yymsp[-2].minor.yy160, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; +{ yylhsminor.yy712 = setExplainRatio(pCxt, yymsp[-2].minor.yy712, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 260: /* cmd ::= COMPACT VNODES IN NK_LP integer_list NK_RP */ -{ pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_EXPRIE_STATEMENT); } - yy_destructor(yypParser,277,&yymsp[-1].minor); + case 260: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ +{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy337, yymsp[-8].minor.yy337, &yymsp[-5].minor.yy129, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy184, yymsp[0].minor.yy500); } break; - case 261: /* cmd ::= CREATE agg_func_opt FUNCTION not_exists_opt function_name AS NK_STRING OUTPUTTYPE type_name bufsize_opt */ -{ pCxt->pRootNode = createCreateFunctionStmt(pCxt, yymsp[-6].minor.yy611, yymsp[-8].minor.yy611, &yymsp[-5].minor.yy231, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy190, yymsp[0].minor.yy516); } + case 261: /* cmd ::= DROP FUNCTION exists_opt function_name */ +{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); } break; - case 262: /* cmd ::= DROP FUNCTION exists_opt function_name */ -{ pCxt->pRootNode = createDropFunctionStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } + case 264: /* bufsize_opt ::= */ +{ yymsp[1].minor.yy500 = 0; } break; - case 265: /* bufsize_opt ::= */ -{ yymsp[1].minor.yy516 = 0; } + case 265: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ +{ yymsp[-1].minor.yy500 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } break; - case 266: /* bufsize_opt ::= BUFSIZE NK_INTEGER */ -{ yymsp[-1].minor.yy516 = taosStr2Int32(yymsp[0].minor.yy0.z, NULL, 10); } + case 266: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ +{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy337, &yymsp[-4].minor.yy129, yymsp[-2].minor.yy712, yymsp[-3].minor.yy712, yymsp[0].minor.yy712); } break; - case 267: /* cmd ::= CREATE STREAM not_exists_opt stream_name stream_options into_opt AS query_expression */ -{ pCxt->pRootNode = createCreateStreamStmt(pCxt, yymsp[-5].minor.yy611, &yymsp[-4].minor.yy231, yymsp[-2].minor.yy160, yymsp[-3].minor.yy160, yymsp[0].minor.yy160); } + case 267: /* cmd ::= DROP STREAM exists_opt stream_name */ +{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy337, &yymsp[0].minor.yy129); } break; - case 268: /* cmd ::= DROP STREAM exists_opt stream_name */ -{ pCxt->pRootNode = createDropStreamStmt(pCxt, yymsp[-1].minor.yy611, &yymsp[0].minor.yy231); } + case 269: /* into_opt ::= INTO full_table_name */ + case 408: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==408); + case 437: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==437); + case 460: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==460); +{ yymsp[-1].minor.yy712 = yymsp[0].minor.yy712; } break; - case 270: /* into_opt ::= INTO full_table_name */ - case 410: /* from_clause_opt ::= FROM table_reference_list */ yytestcase(yyruleno==410); - case 439: /* where_clause_opt ::= WHERE search_condition */ yytestcase(yyruleno==439); - case 462: /* having_clause_opt ::= HAVING search_condition */ yytestcase(yyruleno==462); -{ yymsp[-1].minor.yy160 = yymsp[0].minor.yy160; } + case 271: /* stream_options ::= stream_options TRIGGER AT_ONCE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy712)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy712 = yymsp[-2].minor.yy712; } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 272: /* stream_options ::= stream_options TRIGGER AT_ONCE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy160)->triggerType = STREAM_TRIGGER_AT_ONCE; yylhsminor.yy160 = yymsp[-2].minor.yy160; } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 272: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ +{ ((SStreamOptions*)yymsp[-2].minor.yy712)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy712 = yymsp[-2].minor.yy712; } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 273: /* stream_options ::= stream_options TRIGGER WINDOW_CLOSE */ -{ ((SStreamOptions*)yymsp[-2].minor.yy160)->triggerType = STREAM_TRIGGER_WINDOW_CLOSE; yylhsminor.yy160 = yymsp[-2].minor.yy160; } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 273: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ +{ ((SStreamOptions*)yymsp[-3].minor.yy712)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy712)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); yylhsminor.yy712 = yymsp[-3].minor.yy712; } + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 274: /* stream_options ::= stream_options TRIGGER MAX_DELAY duration_literal */ -{ ((SStreamOptions*)yymsp[-3].minor.yy160)->triggerType = STREAM_TRIGGER_MAX_DELAY; ((SStreamOptions*)yymsp[-3].minor.yy160)->pDelay = releaseRawExprNode(pCxt, yymsp[0].minor.yy160); yylhsminor.yy160 = yymsp[-3].minor.yy160; } - yymsp[-3].minor.yy160 = yylhsminor.yy160; + case 275: /* stream_options ::= stream_options IGNORE EXPIRED */ +{ ((SStreamOptions*)yymsp[-2].minor.yy712)->ignoreExpired = true; yylhsminor.yy712 = yymsp[-2].minor.yy712; } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 276: /* stream_options ::= stream_options IGNORE EXPIRED */ -{ ((SStreamOptions*)yymsp[-2].minor.yy160)->ignoreExpired = true; yylhsminor.yy160 = yymsp[-2].minor.yy160; } - yymsp[-2].minor.yy160 = yylhsminor.yy160; - break; - case 277: /* cmd ::= KILL CONNECTION NK_INTEGER */ + case 276: /* cmd ::= KILL CONNECTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_CONNECTION_STMT, &yymsp[0].minor.yy0); } break; - case 278: /* cmd ::= KILL QUERY NK_STRING */ + case 277: /* cmd ::= KILL QUERY NK_STRING */ { pCxt->pRootNode = createKillQueryStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 279: /* cmd ::= KILL TRANSACTION NK_INTEGER */ + case 278: /* cmd ::= KILL TRANSACTION NK_INTEGER */ { pCxt->pRootNode = createKillStmt(pCxt, QUERY_NODE_KILL_TRANSACTION_STMT, &yymsp[0].minor.yy0); } break; - case 280: /* cmd ::= BALANCE VGROUP */ + case 279: /* cmd ::= BALANCE VGROUP */ { pCxt->pRootNode = createBalanceVgroupStmt(pCxt); } break; - case 281: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ + case 280: /* cmd ::= MERGE VGROUP NK_INTEGER NK_INTEGER */ { pCxt->pRootNode = createMergeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0); } break; - case 282: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ -{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy180); } + case 281: /* cmd ::= REDISTRIBUTE VGROUP NK_INTEGER dnode_list */ +{ pCxt->pRootNode = createRedistributeVgroupStmt(pCxt, &yymsp[-1].minor.yy0, yymsp[0].minor.yy464); } break; - case 283: /* cmd ::= SPLIT VGROUP NK_INTEGER */ + case 282: /* cmd ::= SPLIT VGROUP NK_INTEGER */ { pCxt->pRootNode = createSplitVgroupStmt(pCxt, &yymsp[0].minor.yy0); } break; - case 284: /* dnode_list ::= DNODE NK_INTEGER */ -{ yymsp[-1].minor.yy180 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } + case 283: /* dnode_list ::= DNODE NK_INTEGER */ +{ yymsp[-1].minor.yy464 = createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &yymsp[0].minor.yy0)); } break; - case 286: /* cmd ::= SYNCDB db_name REPLICA */ -{ pCxt->pRootNode = createSyncdbStmt(pCxt, &yymsp[-1].minor.yy231); } + case 285: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ +{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } break; - case 287: /* cmd ::= DELETE FROM full_table_name where_clause_opt */ -{ pCxt->pRootNode = createDeleteStmt(pCxt, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } + case 287: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy712, yymsp[-2].minor.yy464, yymsp[0].minor.yy712); } break; - case 289: /* cmd ::= INSERT INTO full_table_name NK_LP col_name_list NK_RP query_expression */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-4].minor.yy160, yymsp[-2].minor.yy180, yymsp[0].minor.yy160); } + case 288: /* cmd ::= INSERT INTO full_table_name query_expression */ +{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy712, NULL, yymsp[0].minor.yy712); } break; - case 290: /* cmd ::= INSERT INTO full_table_name query_expression */ -{ pCxt->pRootNode = createInsertStmt(pCxt, yymsp[-1].minor.yy160, NULL, yymsp[0].minor.yy160); } + case 289: /* literal ::= NK_INTEGER */ +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 291: /* literal ::= NK_INTEGER */ -{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 290: /* literal ::= NK_FLOAT */ +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 292: /* literal ::= NK_FLOAT */ -{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 291: /* literal ::= NK_STRING */ +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 293: /* literal ::= NK_STRING */ -{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 292: /* literal ::= NK_BOOL */ +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 294: /* literal ::= NK_BOOL */ -{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 293: /* literal ::= TIMESTAMP NK_STRING */ +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 295: /* literal ::= TIMESTAMP NK_STRING */ -{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0)); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; + case 294: /* literal ::= duration_literal */ + case 304: /* signed_literal ::= signed */ yytestcase(yyruleno==304); + case 325: /* expression ::= literal */ yytestcase(yyruleno==325); + case 326: /* expression ::= pseudo_column */ yytestcase(yyruleno==326); + case 327: /* expression ::= column_reference */ yytestcase(yyruleno==327); + case 328: /* expression ::= function_expression */ yytestcase(yyruleno==328); + case 329: /* expression ::= subquery */ yytestcase(yyruleno==329); + case 357: /* function_expression ::= literal_func */ yytestcase(yyruleno==357); + case 399: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==399); + case 403: /* boolean_primary ::= predicate */ yytestcase(yyruleno==403); + case 405: /* common_expression ::= expression */ yytestcase(yyruleno==405); + case 406: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==406); + case 409: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==409); + case 411: /* table_reference ::= table_primary */ yytestcase(yyruleno==411); + case 412: /* table_reference ::= joined_table */ yytestcase(yyruleno==412); + case 416: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==416); + case 466: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==466); + case 469: /* query_primary ::= query_specification */ yytestcase(yyruleno==469); +{ yylhsminor.yy712 = yymsp[0].minor.yy712; } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 296: /* literal ::= duration_literal */ - case 306: /* signed_literal ::= signed */ yytestcase(yyruleno==306); - case 327: /* expression ::= literal */ yytestcase(yyruleno==327); - case 328: /* expression ::= pseudo_column */ yytestcase(yyruleno==328); - case 329: /* expression ::= column_reference */ yytestcase(yyruleno==329); - case 330: /* expression ::= function_expression */ yytestcase(yyruleno==330); - case 331: /* expression ::= subquery */ yytestcase(yyruleno==331); - case 359: /* function_expression ::= literal_func */ yytestcase(yyruleno==359); - case 401: /* boolean_value_expression ::= boolean_primary */ yytestcase(yyruleno==401); - case 405: /* boolean_primary ::= predicate */ yytestcase(yyruleno==405); - case 407: /* common_expression ::= expression */ yytestcase(yyruleno==407); - case 408: /* common_expression ::= boolean_value_expression */ yytestcase(yyruleno==408); - case 411: /* table_reference_list ::= table_reference */ yytestcase(yyruleno==411); - case 413: /* table_reference ::= table_primary */ yytestcase(yyruleno==413); - case 414: /* table_reference ::= joined_table */ yytestcase(yyruleno==414); - case 418: /* table_primary ::= parenthesized_joined_table */ yytestcase(yyruleno==418); - case 468: /* query_expression_body ::= query_primary */ yytestcase(yyruleno==468); - case 471: /* query_primary ::= query_specification */ yytestcase(yyruleno==471); -{ yylhsminor.yy160 = yymsp[0].minor.yy160; } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 295: /* literal ::= NULL */ +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 297: /* literal ::= NULL */ -{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 296: /* literal ::= NK_QUESTION */ +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 298: /* literal ::= NK_QUESTION */ -{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 297: /* duration_literal ::= NK_VARIABLE */ +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 299: /* duration_literal ::= NK_VARIABLE */ -{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createDurationValueNode(pCxt, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 298: /* signed ::= NK_INTEGER */ +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 300: /* signed ::= NK_INTEGER */ -{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 299: /* signed ::= NK_PLUS NK_INTEGER */ +{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } break; - case 301: /* signed ::= NK_PLUS NK_INTEGER */ -{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_UBIGINT, &yymsp[0].minor.yy0); } - break; - case 302: /* signed ::= NK_MINUS NK_INTEGER */ + case 300: /* signed ::= NK_MINUS NK_INTEGER */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); + yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BIGINT, &t); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 303: /* signed ::= NK_FLOAT */ -{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 301: /* signed ::= NK_FLOAT */ +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 304: /* signed ::= NK_PLUS NK_FLOAT */ -{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } + case 302: /* signed ::= NK_PLUS NK_FLOAT */ +{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &yymsp[0].minor.yy0); } break; - case 305: /* signed ::= NK_MINUS NK_FLOAT */ + case 303: /* signed ::= NK_MINUS NK_FLOAT */ { SToken t = yymsp[-1].minor.yy0; t.n = (yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n) - yymsp[-1].minor.yy0.z; - yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); + yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_DOUBLE, &t); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 307: /* signed_literal ::= NK_STRING */ -{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 305: /* signed_literal ::= NK_STRING */ +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 308: /* signed_literal ::= NK_BOOL */ -{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 306: /* signed_literal ::= NK_BOOL */ +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_BOOL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 309: /* signed_literal ::= TIMESTAMP NK_STRING */ -{ yymsp[-1].minor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } + case 307: /* signed_literal ::= TIMESTAMP NK_STRING */ +{ yymsp[-1].minor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_TIMESTAMP, &yymsp[0].minor.yy0); } break; - case 310: /* signed_literal ::= duration_literal */ - case 312: /* signed_literal ::= literal_func */ yytestcase(yyruleno==312); - case 379: /* star_func_para ::= expression */ yytestcase(yyruleno==379); - case 434: /* select_item ::= common_expression */ yytestcase(yyruleno==434); - case 484: /* search_condition ::= common_expression */ yytestcase(yyruleno==484); -{ yylhsminor.yy160 = releaseRawExprNode(pCxt, yymsp[0].minor.yy160); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 308: /* signed_literal ::= duration_literal */ + case 310: /* signed_literal ::= literal_func */ yytestcase(yyruleno==310); + case 377: /* star_func_para ::= expression */ yytestcase(yyruleno==377); + case 432: /* select_item ::= common_expression */ yytestcase(yyruleno==432); + case 482: /* search_condition ::= common_expression */ yytestcase(yyruleno==482); +{ yylhsminor.yy712 = releaseRawExprNode(pCxt, yymsp[0].minor.yy712); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 311: /* signed_literal ::= NULL */ -{ yylhsminor.yy160 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 309: /* signed_literal ::= NULL */ +{ yylhsminor.yy712 = createValueNode(pCxt, TSDB_DATA_TYPE_NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 313: /* signed_literal ::= NK_QUESTION */ -{ yylhsminor.yy160 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 311: /* signed_literal ::= NK_QUESTION */ +{ yylhsminor.yy712 = createPlaceholderValueNode(pCxt, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 332: /* expression ::= NK_LP expression NK_RP */ - case 406: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==406); -{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy160)); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 330: /* expression ::= NK_LP expression NK_RP */ + case 404: /* boolean_primary ::= NK_LP boolean_value_expression NK_RP */ yytestcase(yyruleno==404); +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 333: /* expression ::= NK_PLUS expression */ + case 331: /* expression ::= NK_PLUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy160)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, releaseRawExprNode(pCxt, yymsp[0].minor.yy712)); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 334: /* expression ::= NK_MINUS expression */ + case 332: /* expression ::= NK_MINUS expression */ { - SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy160), NULL)); + SToken t = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &t, createOperatorNode(pCxt, OP_TYPE_MINUS, releaseRawExprNode(pCxt, yymsp[0].minor.yy712), NULL)); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 335: /* expression ::= expression NK_PLUS expression */ + case 333: /* expression ::= expression NK_PLUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_ADD, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 336: /* expression ::= expression NK_MINUS expression */ + case 334: /* expression ::= expression NK_MINUS expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_SUB, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 337: /* expression ::= expression NK_STAR expression */ + case 335: /* expression ::= expression NK_STAR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_MULTI, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 338: /* expression ::= expression NK_SLASH expression */ + case 336: /* expression ::= expression NK_SLASH expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_DIV, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 339: /* expression ::= expression NK_REM expression */ + case 337: /* expression ::= expression NK_REM expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_REM, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 340: /* expression ::= column_reference NK_ARROW NK_STRING */ + case 338: /* expression ::= column_reference NK_ARROW NK_STRING */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_JSON_GET_VALUE, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[0].minor.yy0))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 341: /* expression ::= expression NK_BITAND expression */ + case 339: /* expression ::= expression NK_BITAND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 342: /* expression ::= expression NK_BITOR expression */ + case 340: /* expression ::= expression NK_BITOR expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, OP_TYPE_BIT_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 345: /* column_reference ::= column_name */ -{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy231, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy231)); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 343: /* column_reference ::= column_name */ +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy129, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy129)); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 346: /* column_reference ::= table_name NK_DOT column_name */ -{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231, createColumnNode(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy231)); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 344: /* column_reference ::= table_name NK_DOT column_name */ +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129, createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy129)); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 347: /* pseudo_column ::= ROWTS */ - case 348: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==348); - case 350: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==350); - case 351: /* pseudo_column ::= QEND */ yytestcase(yyruleno==351); - case 352: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==352); - case 353: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==353); - case 354: /* pseudo_column ::= WEND */ yytestcase(yyruleno==354); - case 355: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==355); - case 361: /* literal_func ::= NOW */ yytestcase(yyruleno==361); -{ yylhsminor.yy160 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 345: /* pseudo_column ::= ROWTS */ + case 346: /* pseudo_column ::= TBNAME */ yytestcase(yyruleno==346); + case 348: /* pseudo_column ::= QSTART */ yytestcase(yyruleno==348); + case 349: /* pseudo_column ::= QEND */ yytestcase(yyruleno==349); + case 350: /* pseudo_column ::= QDURATION */ yytestcase(yyruleno==350); + case 351: /* pseudo_column ::= WSTART */ yytestcase(yyruleno==351); + case 352: /* pseudo_column ::= WEND */ yytestcase(yyruleno==352); + case 353: /* pseudo_column ::= WDURATION */ yytestcase(yyruleno==353); + case 359: /* literal_func ::= NOW */ yytestcase(yyruleno==359); +{ yylhsminor.yy712 = createRawExprNode(pCxt, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, NULL)); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 349: /* pseudo_column ::= table_name NK_DOT TBNAME */ -{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy231)))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 347: /* pseudo_column ::= table_name NK_DOT TBNAME */ +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[0].minor.yy0, createNodeList(pCxt, createValueNode(pCxt, TSDB_DATA_TYPE_BINARY, &yymsp[-2].minor.yy129)))); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 356: /* function_expression ::= function_name NK_LP expression_list NK_RP */ - case 357: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==357); -{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy231, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy231, yymsp[-1].minor.yy180)); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; + case 354: /* function_expression ::= function_name NK_LP expression_list NK_RP */ + case 355: /* function_expression ::= star_func NK_LP star_func_para_list NK_RP */ yytestcase(yyruleno==355); +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-3].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-3].minor.yy129, yymsp[-1].minor.yy464)); } + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 358: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ -{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), yymsp[-1].minor.yy190)); } - yymsp[-5].minor.yy160 = yylhsminor.yy160; + case 356: /* function_expression ::= CAST NK_LP expression AS type_name NK_RP */ +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0, createCastFunctionNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy184)); } + yymsp[-5].minor.yy712 = yylhsminor.yy712; break; - case 360: /* literal_func ::= noarg_func NK_LP NK_RP */ -{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy231, NULL)); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 358: /* literal_func ::= noarg_func NK_LP NK_RP */ +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0, createFunctionNode(pCxt, &yymsp[-2].minor.yy129, NULL)); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 375: /* star_func_para_list ::= NK_STAR */ -{ yylhsminor.yy180 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } - yymsp[0].minor.yy180 = yylhsminor.yy180; + case 373: /* star_func_para_list ::= NK_STAR */ +{ yylhsminor.yy464 = createNodeList(pCxt, createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0)); } + yymsp[0].minor.yy464 = yylhsminor.yy464; break; - case 380: /* star_func_para ::= table_name NK_DOT NK_STAR */ - case 437: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==437); -{ yylhsminor.yy160 = createColumnNode(pCxt, &yymsp[-2].minor.yy231, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 378: /* star_func_para ::= table_name NK_DOT NK_STAR */ + case 435: /* select_item ::= table_name NK_DOT NK_STAR */ yytestcase(yyruleno==435); +{ yylhsminor.yy712 = createColumnNode(pCxt, &yymsp[-2].minor.yy129, &yymsp[0].minor.yy0); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 381: /* predicate ::= expression compare_op expression */ - case 386: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==386); + case 379: /* predicate ::= expression compare_op expression */ + case 384: /* predicate ::= expression in_op in_predicate_value */ yytestcase(yyruleno==384); { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy598, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createOperatorNode(pCxt, yymsp[-1].minor.yy60, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 382: /* predicate ::= expression BETWEEN expression AND expression */ + case 380: /* predicate ::= expression BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy160), releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-4].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-4].minor.yy712), releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-4].minor.yy160 = yylhsminor.yy160; + yymsp[-4].minor.yy712 = yylhsminor.yy712; break; - case 383: /* predicate ::= expression NOT BETWEEN expression AND expression */ + case 381: /* predicate ::= expression NOT BETWEEN expression AND expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy160), releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-5].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createNotBetweenAnd(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-5].minor.yy160 = yylhsminor.yy160; + yymsp[-5].minor.yy712 = yylhsminor.yy712; break; - case 384: /* predicate ::= expression IS NULL */ + case 382: /* predicate ::= expression IS NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NULL, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), NULL)); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 385: /* predicate ::= expression IS NOT NULL */ + case 383: /* predicate ::= expression IS NOT NULL */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), NULL)); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-3].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &yymsp[0].minor.yy0, createOperatorNode(pCxt, OP_TYPE_IS_NOT_NULL, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL)); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 387: /* compare_op ::= NK_LT */ -{ yymsp[0].minor.yy598 = OP_TYPE_LOWER_THAN; } + case 385: /* compare_op ::= NK_LT */ +{ yymsp[0].minor.yy60 = OP_TYPE_LOWER_THAN; } break; - case 388: /* compare_op ::= NK_GT */ -{ yymsp[0].minor.yy598 = OP_TYPE_GREATER_THAN; } + case 386: /* compare_op ::= NK_GT */ +{ yymsp[0].minor.yy60 = OP_TYPE_GREATER_THAN; } break; - case 389: /* compare_op ::= NK_LE */ -{ yymsp[0].minor.yy598 = OP_TYPE_LOWER_EQUAL; } + case 387: /* compare_op ::= NK_LE */ +{ yymsp[0].minor.yy60 = OP_TYPE_LOWER_EQUAL; } break; - case 390: /* compare_op ::= NK_GE */ -{ yymsp[0].minor.yy598 = OP_TYPE_GREATER_EQUAL; } + case 388: /* compare_op ::= NK_GE */ +{ yymsp[0].minor.yy60 = OP_TYPE_GREATER_EQUAL; } break; - case 391: /* compare_op ::= NK_NE */ -{ yymsp[0].minor.yy598 = OP_TYPE_NOT_EQUAL; } + case 389: /* compare_op ::= NK_NE */ +{ yymsp[0].minor.yy60 = OP_TYPE_NOT_EQUAL; } break; - case 392: /* compare_op ::= NK_EQ */ -{ yymsp[0].minor.yy598 = OP_TYPE_EQUAL; } + case 390: /* compare_op ::= NK_EQ */ +{ yymsp[0].minor.yy60 = OP_TYPE_EQUAL; } break; - case 393: /* compare_op ::= LIKE */ -{ yymsp[0].minor.yy598 = OP_TYPE_LIKE; } + case 391: /* compare_op ::= LIKE */ +{ yymsp[0].minor.yy60 = OP_TYPE_LIKE; } break; - case 394: /* compare_op ::= NOT LIKE */ -{ yymsp[-1].minor.yy598 = OP_TYPE_NOT_LIKE; } + case 392: /* compare_op ::= NOT LIKE */ +{ yymsp[-1].minor.yy60 = OP_TYPE_NOT_LIKE; } break; - case 395: /* compare_op ::= MATCH */ -{ yymsp[0].minor.yy598 = OP_TYPE_MATCH; } + case 393: /* compare_op ::= MATCH */ +{ yymsp[0].minor.yy60 = OP_TYPE_MATCH; } break; - case 396: /* compare_op ::= NMATCH */ -{ yymsp[0].minor.yy598 = OP_TYPE_NMATCH; } + case 394: /* compare_op ::= NMATCH */ +{ yymsp[0].minor.yy60 = OP_TYPE_NMATCH; } break; - case 397: /* compare_op ::= CONTAINS */ -{ yymsp[0].minor.yy598 = OP_TYPE_JSON_CONTAINS; } + case 395: /* compare_op ::= CONTAINS */ +{ yymsp[0].minor.yy60 = OP_TYPE_JSON_CONTAINS; } break; - case 398: /* in_op ::= IN */ -{ yymsp[0].minor.yy598 = OP_TYPE_IN; } + case 396: /* in_op ::= IN */ +{ yymsp[0].minor.yy60 = OP_TYPE_IN; } break; - case 399: /* in_op ::= NOT IN */ -{ yymsp[-1].minor.yy598 = OP_TYPE_NOT_IN; } + case 397: /* in_op ::= NOT IN */ +{ yymsp[-1].minor.yy60 = OP_TYPE_NOT_IN; } break; - case 400: /* in_predicate_value ::= NK_LP literal_list NK_RP */ -{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy180)); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 398: /* in_predicate_value ::= NK_LP literal_list NK_RP */ +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, createNodeListNode(pCxt, yymsp[-1].minor.yy464)); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 402: /* boolean_value_expression ::= NOT boolean_primary */ + case 400: /* boolean_value_expression ::= NOT boolean_primary */ { - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy160), NULL)); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-1].minor.yy0, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_NOT, releaseRawExprNode(pCxt, yymsp[0].minor.yy712), NULL)); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 403: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ + case 401: /* boolean_value_expression ::= boolean_value_expression OR boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_OR, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 404: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ + case 402: /* boolean_value_expression ::= boolean_value_expression AND boolean_value_expression */ { - SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy160); - SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy160); - yylhsminor.yy160 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); + SToken s = getTokenFromRawExprNode(pCxt, yymsp[-2].minor.yy712); + SToken e = getTokenFromRawExprNode(pCxt, yymsp[0].minor.yy712); + yylhsminor.yy712 = createRawExprNodeExt(pCxt, &s, &e, createLogicConditionNode(pCxt, LOGIC_COND_TYPE_AND, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 412: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ -{ yylhsminor.yy160 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy160, yymsp[0].minor.yy160, NULL); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 410: /* table_reference_list ::= table_reference_list NK_COMMA table_reference */ +{ yylhsminor.yy712 = createJoinTableNode(pCxt, JOIN_TYPE_INNER, yymsp[-2].minor.yy712, yymsp[0].minor.yy712, NULL); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 415: /* table_primary ::= table_name alias_opt */ -{ yylhsminor.yy160 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy231, &yymsp[0].minor.yy231); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; + case 413: /* table_primary ::= table_name alias_opt */ +{ yylhsminor.yy712 = createRealTableNode(pCxt, NULL, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 416: /* table_primary ::= db_name NK_DOT table_name alias_opt */ -{ yylhsminor.yy160 = createRealTableNode(pCxt, &yymsp[-3].minor.yy231, &yymsp[-1].minor.yy231, &yymsp[0].minor.yy231); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; + case 414: /* table_primary ::= db_name NK_DOT table_name alias_opt */ +{ yylhsminor.yy712 = createRealTableNode(pCxt, &yymsp[-3].minor.yy129, &yymsp[-1].minor.yy129, &yymsp[0].minor.yy129); } + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 417: /* table_primary ::= subquery alias_opt */ -{ yylhsminor.yy160 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy160), &yymsp[0].minor.yy231); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; + case 415: /* table_primary ::= subquery alias_opt */ +{ yylhsminor.yy712 = createTempTableNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712), &yymsp[0].minor.yy129); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 419: /* alias_opt ::= */ -{ yymsp[1].minor.yy231 = nil_token; } + case 417: /* alias_opt ::= */ +{ yymsp[1].minor.yy129 = nil_token; } break; - case 420: /* alias_opt ::= table_alias */ -{ yylhsminor.yy231 = yymsp[0].minor.yy231; } - yymsp[0].minor.yy231 = yylhsminor.yy231; + case 418: /* alias_opt ::= table_alias */ +{ yylhsminor.yy129 = yymsp[0].minor.yy129; } + yymsp[0].minor.yy129 = yylhsminor.yy129; break; - case 421: /* alias_opt ::= AS table_alias */ -{ yymsp[-1].minor.yy231 = yymsp[0].minor.yy231; } + case 419: /* alias_opt ::= AS table_alias */ +{ yymsp[-1].minor.yy129 = yymsp[0].minor.yy129; } break; - case 422: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ - case 423: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==423); -{ yymsp[-2].minor.yy160 = yymsp[-1].minor.yy160; } + case 420: /* parenthesized_joined_table ::= NK_LP joined_table NK_RP */ + case 421: /* parenthesized_joined_table ::= NK_LP parenthesized_joined_table NK_RP */ yytestcase(yyruleno==421); +{ yymsp[-2].minor.yy712 = yymsp[-1].minor.yy712; } break; - case 424: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ -{ yylhsminor.yy160 = createJoinTableNode(pCxt, yymsp[-4].minor.yy652, yymsp[-5].minor.yy160, yymsp[-2].minor.yy160, yymsp[0].minor.yy160); } - yymsp[-5].minor.yy160 = yylhsminor.yy160; + case 422: /* joined_table ::= table_reference join_type JOIN table_reference ON search_condition */ +{ yylhsminor.yy712 = createJoinTableNode(pCxt, yymsp[-4].minor.yy532, yymsp[-5].minor.yy712, yymsp[-2].minor.yy712, yymsp[0].minor.yy712); } + yymsp[-5].minor.yy712 = yylhsminor.yy712; break; - case 425: /* join_type ::= */ -{ yymsp[1].minor.yy652 = JOIN_TYPE_INNER; } + case 423: /* join_type ::= */ +{ yymsp[1].minor.yy532 = JOIN_TYPE_INNER; } break; - case 426: /* join_type ::= INNER */ -{ yymsp[0].minor.yy652 = JOIN_TYPE_INNER; } + case 424: /* join_type ::= INNER */ +{ yymsp[0].minor.yy532 = JOIN_TYPE_INNER; } break; - case 427: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ + case 425: /* query_specification ::= SELECT set_quantifier_opt select_list from_clause_opt where_clause_opt partition_by_clause_opt range_opt every_opt fill_opt twindow_clause_opt group_by_clause_opt having_clause_opt */ { - yymsp[-11].minor.yy160 = createSelectStmt(pCxt, yymsp[-10].minor.yy611, yymsp[-9].minor.yy180, yymsp[-8].minor.yy160); - yymsp[-11].minor.yy160 = addWhereClause(pCxt, yymsp[-11].minor.yy160, yymsp[-7].minor.yy160); - yymsp[-11].minor.yy160 = addPartitionByClause(pCxt, yymsp[-11].minor.yy160, yymsp[-6].minor.yy180); - yymsp[-11].minor.yy160 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy160, yymsp[-2].minor.yy160); - yymsp[-11].minor.yy160 = addGroupByClause(pCxt, yymsp[-11].minor.yy160, yymsp[-1].minor.yy180); - yymsp[-11].minor.yy160 = addHavingClause(pCxt, yymsp[-11].minor.yy160, yymsp[0].minor.yy160); - yymsp[-11].minor.yy160 = addRangeClause(pCxt, yymsp[-11].minor.yy160, yymsp[-5].minor.yy160); - yymsp[-11].minor.yy160 = addEveryClause(pCxt, yymsp[-11].minor.yy160, yymsp[-4].minor.yy160); - yymsp[-11].minor.yy160 = addFillClause(pCxt, yymsp[-11].minor.yy160, yymsp[-3].minor.yy160); + yymsp[-11].minor.yy712 = createSelectStmt(pCxt, yymsp[-10].minor.yy337, yymsp[-9].minor.yy464, yymsp[-8].minor.yy712); + yymsp[-11].minor.yy712 = addWhereClause(pCxt, yymsp[-11].minor.yy712, yymsp[-7].minor.yy712); + yymsp[-11].minor.yy712 = addPartitionByClause(pCxt, yymsp[-11].minor.yy712, yymsp[-6].minor.yy464); + yymsp[-11].minor.yy712 = addWindowClauseClause(pCxt, yymsp[-11].minor.yy712, yymsp[-2].minor.yy712); + yymsp[-11].minor.yy712 = addGroupByClause(pCxt, yymsp[-11].minor.yy712, yymsp[-1].minor.yy464); + yymsp[-11].minor.yy712 = addHavingClause(pCxt, yymsp[-11].minor.yy712, yymsp[0].minor.yy712); + yymsp[-11].minor.yy712 = addRangeClause(pCxt, yymsp[-11].minor.yy712, yymsp[-5].minor.yy712); + yymsp[-11].minor.yy712 = addEveryClause(pCxt, yymsp[-11].minor.yy712, yymsp[-4].minor.yy712); + yymsp[-11].minor.yy712 = addFillClause(pCxt, yymsp[-11].minor.yy712, yymsp[-3].minor.yy712); } break; - case 430: /* set_quantifier_opt ::= ALL */ -{ yymsp[0].minor.yy611 = false; } + case 428: /* set_quantifier_opt ::= ALL */ +{ yymsp[0].minor.yy337 = false; } break; - case 433: /* select_item ::= NK_STAR */ -{ yylhsminor.yy160 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy160 = yylhsminor.yy160; + case 431: /* select_item ::= NK_STAR */ +{ yylhsminor.yy712 = createColumnNode(pCxt, NULL, &yymsp[0].minor.yy0); } + yymsp[0].minor.yy712 = yylhsminor.yy712; break; - case 435: /* select_item ::= common_expression column_alias */ -{ yylhsminor.yy160 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy160), &yymsp[0].minor.yy231); } - yymsp[-1].minor.yy160 = yylhsminor.yy160; + case 433: /* select_item ::= common_expression column_alias */ +{ yylhsminor.yy712 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712), &yymsp[0].minor.yy129); } + yymsp[-1].minor.yy712 = yylhsminor.yy712; break; - case 436: /* select_item ::= common_expression AS column_alias */ -{ yylhsminor.yy160 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), &yymsp[0].minor.yy231); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 434: /* select_item ::= common_expression AS column_alias */ +{ yylhsminor.yy712 = setProjectionAlias(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), &yymsp[0].minor.yy129); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 441: /* partition_by_clause_opt ::= PARTITION BY expression_list */ - case 458: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==458); - case 474: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==474); -{ yymsp[-2].minor.yy180 = yymsp[0].minor.yy180; } + case 439: /* partition_by_clause_opt ::= PARTITION BY expression_list */ + case 456: /* group_by_clause_opt ::= GROUP BY group_by_list */ yytestcase(yyruleno==456); + case 472: /* order_by_clause_opt ::= ORDER BY sort_specification_list */ yytestcase(yyruleno==472); +{ yymsp[-2].minor.yy464 = yymsp[0].minor.yy464; } break; - case 443: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ -{ yymsp[-5].minor.yy160 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), releaseRawExprNode(pCxt, yymsp[-1].minor.yy160)); } + case 441: /* twindow_clause_opt ::= SESSION NK_LP column_reference NK_COMMA duration_literal NK_RP */ +{ yymsp[-5].minor.yy712 = createSessionWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); } break; - case 444: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ -{ yymsp[-3].minor.yy160 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy160)); } + case 442: /* twindow_clause_opt ::= STATE_WINDOW NK_LP expression NK_RP */ +{ yymsp[-3].minor.yy712 = createStateWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); } break; - case 445: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-5].minor.yy160 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), NULL, yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } + case 443: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-5].minor.yy712 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), NULL, yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } break; - case 446: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ -{ yymsp[-7].minor.yy160 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy160), releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), yymsp[-1].minor.yy160, yymsp[0].minor.yy160); } + case 444: /* twindow_clause_opt ::= INTERVAL NK_LP duration_literal NK_COMMA duration_literal NK_RP sliding_opt fill_opt */ +{ yymsp[-7].minor.yy712 = createIntervalWindowNode(pCxt, releaseRawExprNode(pCxt, yymsp[-5].minor.yy712), releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), yymsp[-1].minor.yy712, yymsp[0].minor.yy712); } break; - case 448: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ - case 466: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==466); -{ yymsp[-3].minor.yy160 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy160); } + case 446: /* sliding_opt ::= SLIDING NK_LP duration_literal NK_RP */ + case 464: /* every_opt ::= EVERY NK_LP duration_literal NK_RP */ yytestcase(yyruleno==464); +{ yymsp[-3].minor.yy712 = releaseRawExprNode(pCxt, yymsp[-1].minor.yy712); } break; - case 450: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ -{ yymsp[-3].minor.yy160 = createFillNode(pCxt, yymsp[-1].minor.yy338, NULL); } + case 448: /* fill_opt ::= FILL NK_LP fill_mode NK_RP */ +{ yymsp[-3].minor.yy712 = createFillNode(pCxt, yymsp[-1].minor.yy94, NULL); } break; - case 451: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ -{ yymsp[-5].minor.yy160 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy180)); } + case 449: /* fill_opt ::= FILL NK_LP VALUE NK_COMMA literal_list NK_RP */ +{ yymsp[-5].minor.yy712 = createFillNode(pCxt, FILL_MODE_VALUE, createNodeListNode(pCxt, yymsp[-1].minor.yy464)); } break; - case 452: /* fill_mode ::= NONE */ -{ yymsp[0].minor.yy338 = FILL_MODE_NONE; } + case 450: /* fill_mode ::= NONE */ +{ yymsp[0].minor.yy94 = FILL_MODE_NONE; } break; - case 453: /* fill_mode ::= PREV */ -{ yymsp[0].minor.yy338 = FILL_MODE_PREV; } + case 451: /* fill_mode ::= PREV */ +{ yymsp[0].minor.yy94 = FILL_MODE_PREV; } break; - case 454: /* fill_mode ::= NULL */ -{ yymsp[0].minor.yy338 = FILL_MODE_NULL; } + case 452: /* fill_mode ::= NULL */ +{ yymsp[0].minor.yy94 = FILL_MODE_NULL; } break; - case 455: /* fill_mode ::= LINEAR */ -{ yymsp[0].minor.yy338 = FILL_MODE_LINEAR; } + case 453: /* fill_mode ::= LINEAR */ +{ yymsp[0].minor.yy94 = FILL_MODE_LINEAR; } break; - case 456: /* fill_mode ::= NEXT */ -{ yymsp[0].minor.yy338 = FILL_MODE_NEXT; } + case 454: /* fill_mode ::= NEXT */ +{ yymsp[0].minor.yy94 = FILL_MODE_NEXT; } break; - case 459: /* group_by_list ::= expression */ -{ yylhsminor.yy180 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[0].minor.yy180 = yylhsminor.yy180; + case 457: /* group_by_list ::= expression */ +{ yylhsminor.yy464 = createNodeList(pCxt, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } + yymsp[0].minor.yy464 = yylhsminor.yy464; break; - case 460: /* group_by_list ::= group_by_list NK_COMMA expression */ -{ yylhsminor.yy180 = addNodeToList(pCxt, yymsp[-2].minor.yy180, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy160))); } - yymsp[-2].minor.yy180 = yylhsminor.yy180; + case 458: /* group_by_list ::= group_by_list NK_COMMA expression */ +{ yylhsminor.yy464 = addNodeToList(pCxt, yymsp[-2].minor.yy464, createGroupingSetNode(pCxt, releaseRawExprNode(pCxt, yymsp[0].minor.yy712))); } + yymsp[-2].minor.yy464 = yylhsminor.yy464; break; - case 464: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ -{ yymsp[-5].minor.yy160 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy160), releaseRawExprNode(pCxt, yymsp[-1].minor.yy160)); } + case 462: /* range_opt ::= RANGE NK_LP expression NK_COMMA expression NK_RP */ +{ yymsp[-5].minor.yy712 = createInterpTimeRange(pCxt, releaseRawExprNode(pCxt, yymsp[-3].minor.yy712), releaseRawExprNode(pCxt, yymsp[-1].minor.yy712)); } break; - case 467: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ + case 465: /* query_expression ::= query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt */ { - yylhsminor.yy160 = addOrderByClause(pCxt, yymsp[-3].minor.yy160, yymsp[-2].minor.yy180); - yylhsminor.yy160 = addSlimitClause(pCxt, yylhsminor.yy160, yymsp[-1].minor.yy160); - yylhsminor.yy160 = addLimitClause(pCxt, yylhsminor.yy160, yymsp[0].minor.yy160); + yylhsminor.yy712 = addOrderByClause(pCxt, yymsp[-3].minor.yy712, yymsp[-2].minor.yy464); + yylhsminor.yy712 = addSlimitClause(pCxt, yylhsminor.yy712, yymsp[-1].minor.yy712); + yylhsminor.yy712 = addLimitClause(pCxt, yylhsminor.yy712, yymsp[0].minor.yy712); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 469: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ -{ yylhsminor.yy160 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy160, yymsp[0].minor.yy160); } - yymsp[-3].minor.yy160 = yylhsminor.yy160; + case 467: /* query_expression_body ::= query_expression_body UNION ALL query_expression_body */ +{ yylhsminor.yy712 = createSetOperator(pCxt, SET_OP_TYPE_UNION_ALL, yymsp[-3].minor.yy712, yymsp[0].minor.yy712); } + yymsp[-3].minor.yy712 = yylhsminor.yy712; break; - case 470: /* query_expression_body ::= query_expression_body UNION query_expression_body */ -{ yylhsminor.yy160 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy160, yymsp[0].minor.yy160); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 468: /* query_expression_body ::= query_expression_body UNION query_expression_body */ +{ yylhsminor.yy712 = createSetOperator(pCxt, SET_OP_TYPE_UNION, yymsp[-2].minor.yy712, yymsp[0].minor.yy712); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 472: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ + case 470: /* query_primary ::= NK_LP query_expression_body order_by_clause_opt slimit_clause_opt limit_clause_opt NK_RP */ { - yymsp[-5].minor.yy160 = addOrderByClause(pCxt, yymsp[-4].minor.yy160, yymsp[-3].minor.yy180); - yymsp[-5].minor.yy160 = addSlimitClause(pCxt, yymsp[-5].minor.yy160, yymsp[-2].minor.yy160); - yymsp[-5].minor.yy160 = addLimitClause(pCxt, yymsp[-5].minor.yy160, yymsp[-1].minor.yy160); + yymsp[-5].minor.yy712 = addOrderByClause(pCxt, yymsp[-4].minor.yy712, yymsp[-3].minor.yy464); + yymsp[-5].minor.yy712 = addSlimitClause(pCxt, yymsp[-5].minor.yy712, yymsp[-2].minor.yy712); + yymsp[-5].minor.yy712 = addLimitClause(pCxt, yymsp[-5].minor.yy712, yymsp[-1].minor.yy712); } break; - case 476: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ - case 480: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==480); -{ yymsp[-1].minor.yy160 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } + case 474: /* slimit_clause_opt ::= SLIMIT NK_INTEGER */ + case 478: /* limit_clause_opt ::= LIMIT NK_INTEGER */ yytestcase(yyruleno==478); +{ yymsp[-1].minor.yy712 = createLimitNode(pCxt, &yymsp[0].minor.yy0, NULL); } break; - case 477: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ - case 481: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==481); -{ yymsp[-3].minor.yy160 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } + case 475: /* slimit_clause_opt ::= SLIMIT NK_INTEGER SOFFSET NK_INTEGER */ + case 479: /* limit_clause_opt ::= LIMIT NK_INTEGER OFFSET NK_INTEGER */ yytestcase(yyruleno==479); +{ yymsp[-3].minor.yy712 = createLimitNode(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 478: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ - case 482: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==482); -{ yymsp[-3].minor.yy160 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } + case 476: /* slimit_clause_opt ::= SLIMIT NK_INTEGER NK_COMMA NK_INTEGER */ + case 480: /* limit_clause_opt ::= LIMIT NK_INTEGER NK_COMMA NK_INTEGER */ yytestcase(yyruleno==480); +{ yymsp[-3].minor.yy712 = createLimitNode(pCxt, &yymsp[0].minor.yy0, &yymsp[-2].minor.yy0); } break; - case 483: /* subquery ::= NK_LP query_expression NK_RP */ -{ yylhsminor.yy160 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy160); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 481: /* subquery ::= NK_LP query_expression NK_RP */ +{ yylhsminor.yy712 = createRawExprNodeExt(pCxt, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-1].minor.yy712); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 487: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ -{ yylhsminor.yy160 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy160), yymsp[-1].minor.yy742, yymsp[0].minor.yy283); } - yymsp[-2].minor.yy160 = yylhsminor.yy160; + case 485: /* sort_specification ::= expression ordering_specification_opt null_ordering_opt */ +{ yylhsminor.yy712 = createOrderByExprNode(pCxt, releaseRawExprNode(pCxt, yymsp[-2].minor.yy712), yymsp[-1].minor.yy658, yymsp[0].minor.yy338); } + yymsp[-2].minor.yy712 = yylhsminor.yy712; break; - case 488: /* ordering_specification_opt ::= */ -{ yymsp[1].minor.yy742 = ORDER_ASC; } + case 486: /* ordering_specification_opt ::= */ +{ yymsp[1].minor.yy658 = ORDER_ASC; } break; - case 489: /* ordering_specification_opt ::= ASC */ -{ yymsp[0].minor.yy742 = ORDER_ASC; } + case 487: /* ordering_specification_opt ::= ASC */ +{ yymsp[0].minor.yy658 = ORDER_ASC; } break; - case 490: /* ordering_specification_opt ::= DESC */ -{ yymsp[0].minor.yy742 = ORDER_DESC; } + case 488: /* ordering_specification_opt ::= DESC */ +{ yymsp[0].minor.yy658 = ORDER_DESC; } break; - case 491: /* null_ordering_opt ::= */ -{ yymsp[1].minor.yy283 = NULL_ORDER_DEFAULT; } + case 489: /* null_ordering_opt ::= */ +{ yymsp[1].minor.yy338 = NULL_ORDER_DEFAULT; } break; - case 492: /* null_ordering_opt ::= NULLS FIRST */ -{ yymsp[-1].minor.yy283 = NULL_ORDER_FIRST; } + case 490: /* null_ordering_opt ::= NULLS FIRST */ +{ yymsp[-1].minor.yy338 = NULL_ORDER_FIRST; } break; - case 493: /* null_ordering_opt ::= NULLS LAST */ -{ yymsp[-1].minor.yy283 = NULL_ORDER_LAST; } + case 491: /* null_ordering_opt ::= NULLS LAST */ +{ yymsp[-1].minor.yy338 = NULL_ORDER_LAST; } break; default: break; diff --git a/source/libs/parser/test/parAlterToBalanceTest.cpp b/source/libs/parser/test/parAlterToBalanceTest.cpp index 17a457625b..1caba6eab0 100644 --- a/source/libs/parser/test/parAlterToBalanceTest.cpp +++ b/source/libs/parser/test/parAlterToBalanceTest.cpp @@ -82,12 +82,12 @@ TEST_F(ParserInitialATest, alterDnode) { * BUFFER int_value -- todo: range [3, 16384], default 96, unit MB * | CACHEMODEL {'none' | 'last_row' | 'last_value' | 'both'} -- default 'none' * | CACHESIZE int_value -- range [1, 65536], default 1, unit MB - * | FSYNC int_value -- rang [0, 180000], default 3000, unit ms + * | WAL_FSYNC_PERIOD int_value -- rang [0, 180000], default 3000, unit ms * | KEEP {int_value | duration_value} -- rang [1, 365000], default 3650, unit day * | PAGES int_value -- todo: rang [64, +oo), default 256, unit page * | REPLICA int_value -- todo: enum 1, 3, default 1, unit replica * | STRICT {'off' | 'on'} -- todo: default 'off' - * | WAL int_value -- enum 1, 2, default 1 + * | WAL_LEVEL int_value -- enum 1, 2, default 1 * } */ TEST_F(ParserInitialATest, alterDatabase) { @@ -157,7 +157,7 @@ TEST_F(ParserInitialATest, alterDatabase) { setAlterDbFsync(200); setAlterDbWal(1); setAlterDbCacheModel(TSDB_CACHE_MODEL_LAST_ROW); - run("ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 FSYNC 200 KEEP 10 WAL 1"); + run("ALTER DATABASE test CACHEMODEL 'last_row' CACHESIZE 32 WAL_FSYNC_PERIOD 200 KEEP 10 WAL_LEVEL 1"); clearAlterDbReq(); initAlterDb("test"); @@ -182,11 +182,11 @@ TEST_F(ParserInitialATest, alterDatabase) { initAlterDb("test"); setAlterDbFsync(0); - run("ALTER DATABASE test FSYNC 0"); + run("ALTER DATABASE test WAL_FSYNC_PERIOD 0"); setAlterDbFsync(1000); - run("ALTER DATABASE test FSYNC 1000"); + run("ALTER DATABASE test WAL_FSYNC_PERIOD 1000"); setAlterDbFsync(180000); - run("ALTER DATABASE test FSYNC 180000"); + run("ALTER DATABASE test WAL_FSYNC_PERIOD 180000"); clearAlterDbReq(); initAlterDb("test"); @@ -210,9 +210,9 @@ TEST_F(ParserInitialATest, alterDatabase) { initAlterDb("test"); setAlterDbWal(1); - run("ALTER DATABASE test WAL 1"); + run("ALTER DATABASE test WAL_LEVEL 1"); setAlterDbWal(2); - run("ALTER DATABASE test WAL 2"); + run("ALTER DATABASE test WAL_LEVEL 2"); clearAlterDbReq(); } @@ -223,16 +223,16 @@ TEST_F(ParserInitialATest, alterDatabaseSemanticCheck) { run("ALTER DATABASE test CACHESIZE 0", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test CACHESIZE 65537", TSDB_CODE_PAR_INVALID_DB_OPTION); // The syntax limits it to only positive numbers - run("ALTER DATABASE test FSYNC -1", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE); - run("ALTER DATABASE test FSYNC 180001", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test WAL_FSYNC_PERIOD -1", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE); + run("ALTER DATABASE test WAL_FSYNC_PERIOD 180001", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test KEEP 0", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test KEEP 365001", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test KEEP 1000000000s", TSDB_CODE_PAR_INVALID_DB_OPTION); run("ALTER DATABASE test KEEP 1w", TSDB_CODE_PAR_INVALID_DB_OPTION); - run("ALTER DATABASE test WAL 0", TSDB_CODE_PAR_INVALID_DB_OPTION); - run("ALTER DATABASE test WAL 3", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test WAL_LEVEL 0", TSDB_CODE_PAR_INVALID_DB_OPTION); + run("ALTER DATABASE test WAL_LEVEL 3", TSDB_CODE_PAR_INVALID_DB_OPTION); // Regardless of the specific sentence - run("ALTER DATABASE db WAL 0 # td-14436", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE); + run("ALTER DATABASE db WAL_LEVEL 0 # td-14436", TSDB_CODE_PAR_SYNTAX_ERROR, PARSER_STAGE_PARSE); } /* diff --git a/source/libs/parser/test/parInitialCTest.cpp b/source/libs/parser/test/parInitialCTest.cpp index c7dc55b458..b513ff57ed 100644 --- a/source/libs/parser/test/parInitialCTest.cpp +++ b/source/libs/parser/test/parInitialCTest.cpp @@ -21,12 +21,6 @@ namespace ParserTest { class ParserInitialCTest : public ParserDdlTest {}; -TEST_F(ParserInitialCTest, compact) { - useDb("root", "test"); - - run("COMPACT VNODES IN (1, 2)", TSDB_CODE_PAR_EXPRIE_STATEMENT, PARSER_STAGE_PARSE); -} - TEST_F(ParserInitialCTest, createAccount) { useDb("root", "test"); @@ -64,7 +58,7 @@ TEST_F(ParserInitialCTest, createBnode) { * | CACHESIZE value * | COMP {0 | 1 | 2} * | DURATION value - * | FSYNC value + * | WAL_FSYNC_PERIOD value * | MAXROWS value * | MINROWS value * | KEEP value @@ -74,7 +68,7 @@ TEST_F(ParserInitialCTest, createBnode) { * | REPLICA value * | RETENTIONS ingestion_duration:keep_duration ... * | STRICT {'off' | 'on'} - * | WAL value + * | WAL_LEVEL value * | VGROUPS value * | SINGLE_STABLE {0 | 1} * | WAL_RETENTION_PERIOD value @@ -241,7 +235,7 @@ TEST_F(ParserInitialCTest, createDatabase) { "CACHESIZE 20 " "COMP 1 " "DURATION 100 " - "FSYNC 100 " + "WAL_FSYNC_PERIOD 100 " "MAXROWS 1000 " "MINROWS 100 " "KEEP 1440 " @@ -251,7 +245,7 @@ TEST_F(ParserInitialCTest, createDatabase) { "REPLICA 3 " "RETENTIONS 15s:7d,1m:21d,15m:500d " "STRICT 'on' " - "WAL 2 " + "WAL_LEVEL 2 " "VGROUPS 100 " "SINGLE_STABLE 1 " "SCHEMALESS 1 " diff --git a/source/libs/planner/src/planLogicCreater.c b/source/libs/planner/src/planLogicCreater.c index 30e3b676df..d405b75003 100644 --- a/source/libs/planner/src/planLogicCreater.c +++ b/source/libs/planner/src/planLogicCreater.c @@ -1292,8 +1292,8 @@ static int32_t createVnodeModifLogicNodeByDelete(SLogicPlanContext* pCxt, SDelet pModify->modifyType = MODIFY_TABLE_TYPE_DELETE; pModify->tableId = pRealTable->pMeta->uid; pModify->tableType = pRealTable->pMeta->tableType; - snprintf(pModify->tableFName, sizeof(pModify->tableFName), "%d.%s.%s", pCxt->pPlanCxt->acctId, - pRealTable->table.dbName, pRealTable->table.tableName); + snprintf(pModify->tableName, sizeof(pModify->tableName), "%s", pRealTable->table.tableName); + strcpy(pModify->tsColName, pRealTable->pMeta->schema->name); pModify->deleteTimeRange = pDelete->timeRange; pModify->pAffectedRows = nodesCloneNode(pDelete->pCountFunc); if (NULL == pModify->pAffectedRows) { @@ -1342,8 +1342,7 @@ static int32_t createVnodeModifLogicNodeByInsert(SLogicPlanContext* pCxt, SInser pModify->tableId = pRealTable->pMeta->uid; pModify->stableId = pRealTable->pMeta->suid; pModify->tableType = pRealTable->pMeta->tableType; - snprintf(pModify->tableFName, sizeof(pModify->tableFName), "%d.%s.%s", pCxt->pPlanCxt->acctId, - pRealTable->table.dbName, pRealTable->table.tableName); + snprintf(pModify->tableName, sizeof(pModify->tableName), "%s", pRealTable->table.tableName); TSWAP(pModify->pVgroupList, pRealTable->pVgroupList); pModify->pInsertCols = nodesCloneList(pInsert->pCols); if (NULL == pModify->pInsertCols) { diff --git a/source/libs/planner/src/planPhysiCreater.c b/source/libs/planner/src/planPhysiCreater.c index 587e566939..2e5c4255e6 100644 --- a/source/libs/planner/src/planPhysiCreater.c +++ b/source/libs/planner/src/planPhysiCreater.c @@ -553,6 +553,7 @@ static int32_t createTableScanPhysiNode(SPhysiPlanContext* pCxt, SSubplan* pSubp pTableScan->triggerType = pScanLogicNode->triggerType; pTableScan->watermark = pScanLogicNode->watermark; pTableScan->igExpired = pScanLogicNode->igExpired; + pTableScan->assignBlockUid = pCxt->pPlanCxt->rSmaQuery ? true : false; return createScanPhysiNodeFinalize(pCxt, pSubplan, pScanLogicNode, (SScanPhysiNode*)pTableScan, pPhyNode); } @@ -632,6 +633,7 @@ static int32_t createJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren int32_t code = TSDB_CODE_SUCCESS; pJoin->joinType = pJoinLogicNode->joinType; + pJoin->inputTsOrder = pJoinLogicNode->inputTsOrder; setNodeSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->pMergeCondition, &pJoin->pMergeCondition); if (TSDB_CODE_SUCCESS == code) { @@ -1586,7 +1588,7 @@ static int32_t createQueryInserter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNod pInserter->tableId = pModify->tableId; pInserter->stableId = pModify->stableId; pInserter->tableType = pModify->tableType; - strcpy(pInserter->tableFName, pModify->tableFName); + strcpy(pInserter->tableName, pModify->tableName); pInserter->vgId = pModify->pVgroupList->vgroups[0].vgId; pInserter->epSet = pModify->pVgroupList->vgroups[0].epSet; vgroupInfoToNodeAddr(pModify->pVgroupList->vgroups, &pSubplan->execNode); @@ -1636,7 +1638,8 @@ static int32_t createDataDeleter(SPhysiPlanContext* pCxt, SVnodeModifyLogicNode* pDeleter->tableId = pModify->tableId; pDeleter->tableType = pModify->tableType; - strcpy(pDeleter->tableFName, pModify->tableFName); + strcpy(pDeleter->tableFName, pModify->tableName); + strcpy(pDeleter->tsColName, pModify->tsColName); pDeleter->deleteTimeRange = pModify->deleteTimeRange; int32_t code = setNodeSlotId(pCxt, pRoot->pOutputDataBlockDesc->dataBlockId, -1, pModify->pAffectedRows, diff --git a/source/libs/qworker/src/qworker.c b/source/libs/qworker/src/qworker.c index e09887e651..d1f8a50dab 100644 --- a/source/libs/qworker/src/qworker.c +++ b/source/libs/qworker/src/qworker.c @@ -283,7 +283,8 @@ int32_t qwGetDeleteResFromSink(QW_FPARAMS_DEF, SQWTaskCtx *ctx, SDeleteRes *pRes pRes->skey = pDelRes->skey; pRes->ekey = pDelRes->ekey; pRes->affectedRows = pDelRes->affectedRows; - + strcpy(pRes->tableFName, pDelRes->tableName); + strcpy(pRes->tsColName, pDelRes->tsColName); taosMemoryFree(output.pData); return TSDB_CODE_SUCCESS; diff --git a/source/libs/scheduler/src/schRemote.c b/source/libs/scheduler/src/schRemote.c index b794cb91f5..67050241e3 100644 --- a/source/libs/scheduler/src/schRemote.c +++ b/source/libs/scheduler/src/schRemote.c @@ -230,6 +230,7 @@ int32_t schHandleResponseMsg(SSchJob *pJob, SSchTask *pTask, int32_t execId, SDa SVDeleteRsp rsp = {0}; tDecoderInit(&coder, msg, msgSize); tDecodeSVDeleteRsp(&coder, &rsp); + tDecoderClear(&coder); atomic_add_fetch_32(&pJob->resNumOfRows, rsp.affectedRows); SCH_TASK_DLOG("delete succeed, affectedRows:%" PRId64, rsp.affectedRows); diff --git a/source/libs/stream/inc/streamInc.h b/source/libs/stream/inc/streamInc.h index 093242c610..06bd6539fd 100644 --- a/source/libs/stream/inc/streamInc.h +++ b/source/libs/stream/inc/streamInc.h @@ -38,14 +38,14 @@ int32_t streamPipelineExec(SStreamTask* pTask, int32_t batchNum); int32_t streamDispatch(SStreamTask* pTask, SMsgCb* pMsgCb); int32_t streamDispatchReqToData(const SStreamDispatchReq* pReq, SStreamDataBlock* pData); int32_t streamRetrieveReqToData(const SStreamRetrieveReq* pReq, SStreamDataBlock* pData); -int32_t streamBuildDispatchMsg(SStreamTask* pTask, const SStreamDataBlock* data, SRpcMsg* pMsg, SEpSet** ppEpSet); +int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* data); int32_t streamBroadcastToChildren(SStreamTask* pTask, const SSDataBlock* pBlock); int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* pReq); SStreamQueueItem* streamAppendQueueItem(SStreamQueueItem* dst, SStreamQueueItem* elem); -void streamFreeQitem(SStreamQueueItem* data); +void streamFreeQitem(SStreamQueueItem* data); #ifdef __cplusplus } diff --git a/source/libs/stream/src/stream.c b/source/libs/stream/src/stream.c index 99a06575a9..8c9e8ca2db 100644 --- a/source/libs/stream/src/stream.c +++ b/source/libs/stream/src/stream.c @@ -219,6 +219,12 @@ int32_t streamProcessDispatchRsp(SStreamTask* pTask, SStreamDispatchRsp* pRsp) { qDebug("task %d receive dispatch rsp", pTask->taskId); + if (pTask->dispatchType == TASK_DISPATCH__SHUFFLE) { + int32_t leftRsp = atomic_sub_fetch_32(&pTask->shuffleDispatcher.waitingRspCnt, 1); + qDebug("task %d is shuffle, left waiting rsp %d", pTask->taskId, leftRsp); + if (leftRsp > 0) return 0; + } + int8_t old = atomic_exchange_8(&pTask->outputStatus, pRsp->inputStatus); ASSERT(old == TASK_OUTPUT_STATUS__WAIT); if (pRsp->inputStatus == TASK_INPUT_STATUS__BLOCKED) { diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 5d4adb2896..834a3af0d5 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -198,6 +198,172 @@ static int32_t streamAddBlockToDispatchMsg(const SSDataBlock* pBlock, SStreamDis return 0; } +int32_t streamDispatchOneReq(SStreamTask* pTask, const SStreamDispatchReq* pReq, int32_t vgId, SEpSet* pEpSet) { + void* buf = NULL; + int32_t code = -1; + SRpcMsg msg = {0}; + + // serialize + int32_t tlen; + tEncodeSize(tEncodeStreamDispatchReq, pReq, tlen, code); + if (code < 0) goto FAIL; + code = -1; + buf = rpcMallocCont(sizeof(SMsgHead) + tlen); + if (buf == NULL) { + goto FAIL; + } + + ((SMsgHead*)buf)->vgId = htonl(vgId); + void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead)); + + SEncoder encoder; + tEncoderInit(&encoder, abuf, tlen); + if ((code = tEncodeStreamDispatchReq(&encoder, pReq)) < 0) { + goto FAIL; + } + tEncoderClear(&encoder); + + msg.contLen = tlen + sizeof(SMsgHead); + msg.pCont = buf; + msg.msgType = pTask->dispatchMsgType; + + qDebug("dispatch from task %d to task %d node %d", pTask->taskId, pReq->taskId, vgId); + + tmsgSendReq(pEpSet, &msg); + + code = 0; +FAIL: + if (code < 0 && buf) rpcFreeCont(buf); + return 0; +} + +int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pData) { + int32_t code = -1; + int32_t blockNum = taosArrayGetSize(pData->blocks); + ASSERT(blockNum != 0); + + if (pTask->dispatchType == TASK_DISPATCH__FIXED) { + SStreamDispatchReq req = { + .streamId = pTask->streamId, + .dataSrcVgId = pData->srcVgId, + .upstreamTaskId = pTask->taskId, + .upstreamChildId = pTask->selfChildId, + .upstreamNodeId = pTask->nodeId, + .blockNum = blockNum, + }; + + req.data = taosArrayInit(blockNum, sizeof(void*)); + req.dataLen = taosArrayInit(blockNum, sizeof(int32_t)); + if (req.data == NULL || req.dataLen == NULL) { + goto FAIL_FIXED_DISPATCH; + } + + for (int32_t i = 0; i < blockNum; i++) { + SSDataBlock* pDataBlock = taosArrayGet(pData->blocks, i); + if (streamAddBlockToDispatchMsg(pDataBlock, &req) < 0) { + goto FAIL_FIXED_DISPATCH; + } + } + int32_t vgId = pTask->fixedEpDispatcher.nodeId; + SEpSet* pEpSet = &pTask->fixedEpDispatcher.epSet; + int32_t downstreamTaskId = pTask->fixedEpDispatcher.taskId; + + req.taskId = downstreamTaskId; + + qDebug("dispatch from task %d (child id %d) to down stream task %d in vnode %d", pTask->taskId, pTask->selfChildId, + downstreamTaskId, vgId); + + if (streamDispatchOneReq(pTask, &req, vgId, pEpSet) < 0) { + goto FAIL_FIXED_DISPATCH; + } + code = 0; + FAIL_FIXED_DISPATCH: + taosArrayDestroy(req.data); + taosArrayDestroy(req.dataLen); + return code; + + } else if (pTask->dispatchType == TASK_DISPATCH__SHUFFLE) { + int32_t rspCnt = atomic_load_32(&pTask->shuffleDispatcher.waitingRspCnt); + ASSERT(rspCnt == 0); + + SArray* vgInfo = pTask->shuffleDispatcher.dbInfo.pVgroupInfos; + int32_t vgSz = taosArrayGetSize(vgInfo); + SStreamDispatchReq* pReqs = taosMemoryCalloc(vgSz, sizeof(SStreamDispatchReq)); + if (pReqs == NULL) { + return -1; + } + + for (int32_t i = 0; i < vgSz; i++) { + pReqs[i].streamId = pTask->streamId; + pReqs[i].dataSrcVgId = pData->srcVgId; + pReqs[i].upstreamTaskId = pTask->taskId; + pReqs[i].upstreamChildId = pTask->selfChildId; + pReqs[i].upstreamNodeId = pTask->nodeId; + pReqs[i].blockNum = 0; + pReqs[i].data = taosArrayInit(0, sizeof(void*)); + pReqs[i].dataLen = taosArrayInit(0, sizeof(int32_t)); + if (pReqs[i].data == NULL || pReqs[i].dataLen == NULL) { + goto FAIL_SHUFFLE_DISPATCH; + } + SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, i); + pReqs[i].taskId = pVgInfo->taskId; + } + + for (int32_t i = 0; i < blockNum; i++) { + SSDataBlock* pDataBlock = taosArrayGet(pData->blocks, i); + char* ctbName = buildCtbNameByGroupId(pTask->shuffleDispatcher.stbFullName, pDataBlock->info.groupId); + + // TODO: get hash function by hashMethod + uint32_t hashValue = MurmurHash3_32(ctbName, strlen(ctbName)); + + taosMemoryFree(ctbName); + + bool found = false; + // TODO: optimize search + int32_t j; + for (j = 0; j < vgSz; j++) { + SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, j); + ASSERT(pVgInfo->vgId > 0); + if (hashValue >= pVgInfo->hashBegin && hashValue <= pVgInfo->hashEnd) { + if (streamAddBlockToDispatchMsg(pDataBlock, &pReqs[j]) < 0) { + goto FAIL_SHUFFLE_DISPATCH; + } + if (pReqs[j].blockNum == 0) { + atomic_add_fetch_32(&pTask->shuffleDispatcher.waitingRspCnt, 1); + } + pReqs[j].blockNum++; + found = true; + break; + } + } + ASSERT(found); + } + + for (int32_t i = 0; i < vgSz; i++) { + if (pReqs[i].blockNum > 0) { + // send + SVgroupInfo* pVgInfo = taosArrayGet(vgInfo, i); + if (streamDispatchOneReq(pTask, &pReqs[i], pVgInfo->vgId, &pVgInfo->epSet) < 0) { + goto FAIL_SHUFFLE_DISPATCH; + } + } + } + code = 0; + FAIL_SHUFFLE_DISPATCH: + if (pReqs) { + for (int32_t i = 0; i < vgSz; i++) { + taosArrayDestroy(pReqs[i].data); + taosArrayDestroy(pReqs[i].dataLen); + } + taosMemoryFree(pReqs); + } + return code; + } else { + ASSERT(0); + } + return 0; +} + int32_t streamBuildDispatchMsg(SStreamTask* pTask, const SStreamDataBlock* data, SRpcMsg* pMsg, SEpSet** ppEpSet) { void* buf = NULL; int32_t code = -1; @@ -262,29 +428,7 @@ int32_t streamBuildDispatchMsg(SStreamTask* pTask, const SStreamDataBlock* data, qDebug("dispatch from task %d (child id %d) to down stream task %d in vnode %d", pTask->taskId, pTask->selfChildId, downstreamTaskId, vgId); - // serialize - int32_t tlen; - tEncodeSize(tEncodeStreamDispatchReq, &req, tlen, code); - if (code < 0) goto FAIL; - code = -1; - buf = rpcMallocCont(sizeof(SMsgHead) + tlen); - if (buf == NULL) { - goto FAIL; - } - - ((SMsgHead*)buf)->vgId = htonl(vgId); - void* abuf = POINTER_SHIFT(buf, sizeof(SMsgHead)); - - SEncoder encoder; - tEncoderInit(&encoder, abuf, tlen); - if ((code = tEncodeStreamDispatchReq(&encoder, &req)) < 0) { - goto FAIL; - } - tEncoderClear(&encoder); - - pMsg->contLen = tlen + sizeof(SMsgHead); - pMsg->pCont = buf; - pMsg->msgType = pTask->dispatchMsgType; + streamDispatchOneReq(pTask, &req, vgId, *ppEpSet); code = 0; FAIL: @@ -314,6 +458,18 @@ int32_t streamDispatch(SStreamTask* pTask, SMsgCb* pMsgCb) { qDebug("stream continue dispatching: task %d", pTask->taskId); + int32_t code = 0; + if (streamDispatchAllBlocks(pTask, pBlock) < 0) { + ASSERT(0); + code = -1; + // TODO set status fail + goto FREE; + } + /*atomic_store_8(&pTask->outputStatus, TASK_OUTPUT_STATUS__NORMAL);*/ +FREE: + taosArrayDestroyEx(pBlock->blocks, (FDelete)blockDataFreeRes); + taosFreeQitem(pBlock); +#if 0 SRpcMsg dispatchMsg = {0}; SEpSet* pEpSet = NULL; if (streamBuildDispatchMsg(pTask, pBlock, &dispatchMsg, &pEpSet) < 0) { @@ -325,5 +481,6 @@ int32_t streamDispatch(SStreamTask* pTask, SMsgCb* pMsgCb) { taosFreeQitem(pBlock); tmsgSendReq(pEpSet, &dispatchMsg); - return 0; +#endif + return code; } diff --git a/source/libs/stream/src/streamExec.c b/source/libs/stream/src/streamExec.c index f782de95b9..7c5cd6e391 100644 --- a/source/libs/stream/src/streamExec.c +++ b/source/libs/stream/src/streamExec.c @@ -22,22 +22,22 @@ static int32_t streamTaskExecImpl(SStreamTask* pTask, void* data, SArray* pRes) SStreamQueueItem* pItem = (SStreamQueueItem*)data; if (pItem->type == STREAM_INPUT__GET_RES) { SStreamTrigger* pTrigger = (SStreamTrigger*)data; - qSetMultiStreamInput(exec, pTrigger->pBlock, 1, STREAM_INPUT__DATA_BLOCK, false); + qSetMultiStreamInput(exec, pTrigger->pBlock, 1, STREAM_INPUT__DATA_BLOCK); } else if (pItem->type == STREAM_INPUT__DATA_SUBMIT) { ASSERT(pTask->isDataScan); SStreamDataSubmit* pSubmit = (SStreamDataSubmit*)data; qDebug("task %d %p set submit input %p %p %d 1", pTask->taskId, pTask, pSubmit, pSubmit->data, *pSubmit->dataRef); - qSetStreamInput(exec, pSubmit->data, STREAM_INPUT__DATA_SUBMIT, false); + qSetMultiStreamInput(exec, pSubmit->data, 1, STREAM_INPUT__DATA_SUBMIT); } else if (pItem->type == STREAM_INPUT__DATA_BLOCK || pItem->type == STREAM_INPUT__DATA_RETRIEVE) { SStreamDataBlock* pBlock = (SStreamDataBlock*)data; SArray* blocks = pBlock->blocks; qDebug("task %d %p set ssdata input", pTask->taskId, pTask); - qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__DATA_BLOCK, false); + qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__DATA_BLOCK); } else if (pItem->type == STREAM_INPUT__MERGED_SUBMIT) { SStreamMergedSubmit* pMerged = (SStreamMergedSubmit*)data; SArray* blocks = pMerged->reqs; qDebug("task %d %p set submit input (merged), batch num: %d", pTask->taskId, pTask, (int32_t)blocks->size); - qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__MERGED_SUBMIT, false); + qSetMultiStreamInput(exec, blocks->pData, blocks->size, STREAM_INPUT__MERGED_SUBMIT); } else { ASSERT(0); } diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index 5921e44a9c..216e3fa761 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -64,7 +64,7 @@ int32_t tEncodeSStreamTask(SEncoder* pEncoder, const SStreamTask* pTask) { if (tEncodeI32(pEncoder, pTask->selfChildId) < 0) return -1; if (tEncodeI32(pEncoder, pTask->nodeId) < 0) return -1; if (tEncodeSEpSet(pEncoder, &pTask->epSet) < 0) return -1; - if (tEncodeI32(pEncoder, pTask->numOfVgroups) < 0) return -1; + /*if (tEncodeI32(pEncoder, pTask->numOfVgroups) < 0) return -1;*/ int32_t epSz = taosArrayGetSize(pTask->childEpInfo); if (tEncodeI32(pEncoder, epSz) < 0) return -1; @@ -119,7 +119,7 @@ int32_t tDecodeSStreamTask(SDecoder* pDecoder, SStreamTask* pTask) { if (tDecodeI32(pDecoder, &pTask->selfChildId) < 0) return -1; if (tDecodeI32(pDecoder, &pTask->nodeId) < 0) return -1; if (tDecodeSEpSet(pDecoder, &pTask->epSet) < 0) return -1; - if (tDecodeI32(pDecoder, &pTask->numOfVgroups) < 0) return -1; + /*if (tDecodeI32(pDecoder, &pTask->numOfVgroups) < 0) return -1;*/ int32_t epSz; if (tDecodeI32(pDecoder, &epSz) < 0) return -1; diff --git a/source/libs/sync/src/syncMain.c b/source/libs/sync/src/syncMain.c index 935d89b99b..ceca201506 100644 --- a/source/libs/sync/src/syncMain.c +++ b/source/libs/sync/src/syncMain.c @@ -2501,19 +2501,15 @@ int32_t syncNodeOnClientRequestCb(SSyncNode* ths, SyncClientRequest* pMsg, SyncI // if mulit replica, start replicate right now if (ths->replicaNum > 1) { syncNodeReplicate(ths); - } - // pre commit - syncNodePreCommit(ths, pEntry, 0); + // pre commit + syncNodePreCommit(ths, pEntry, 0); + } // if only myself, maybe commit right now if (ths->replicaNum == 1) { syncMaybeAdvanceCommitIndex(ths); } - - } else { - // pre commit - syncNodePreCommit(ths, pEntry, 0); } if (pRetIndex != NULL) { diff --git a/source/libs/tdb/src/db/tdbPage.c b/source/libs/tdb/src/db/tdbPage.c index 7a70b621c6..276b06b147 100644 --- a/source/libs/tdb/src/db/tdbPage.c +++ b/source/libs/tdb/src/db/tdbPage.c @@ -76,14 +76,17 @@ int tdbPageDestroy(SPage *pPage, void (*xFree)(void *arg, void *ptr), void *arg) ASSERT(xFree); + for (int iOvfl = 0; iOvfl < pPage->nOverflow; iOvfl++) { + tdbOsFree(pPage->apOvfl[iOvfl]); + } + ptr = pPage->pData; xFree(arg, ptr); return 0; } -void tdbPageZero(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell *, int, - TXN *, SBTree *pBt)) { +void tdbPageZero(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell *, int, TXN *, SBTree *pBt)) { pPage->pPageHdr = pPage->pData + szAmHdr; TDB_PAGE_NCELLS_SET(pPage, 0); TDB_PAGE_CCELLS_SET(pPage, pPage->pageSize - sizeof(SPageFtr)); @@ -99,8 +102,7 @@ void tdbPageZero(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell ASSERT((u8 *)pPage->pPageFtr == pPage->pFreeEnd); } -void tdbPageInit(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell *, int, - TXN *, SBTree *pBt)) { +void tdbPageInit(SPage *pPage, u8 szAmHdr, int (*xCellSize)(const SPage *, SCell *, int, TXN *, SBTree *pBt)) { pPage->pPageHdr = pPage->pData + szAmHdr; pPage->pCellIdx = pPage->pPageHdr + TDB_PAGE_HDR_SIZE(pPage); pPage->pFreeStart = pPage->pCellIdx + TDB_PAGE_OFFSET_SIZE(pPage) * TDB_PAGE_NCELLS(pPage); @@ -124,9 +126,8 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl nFree = TDB_PAGE_NFREE(pPage); nCells = TDB_PAGE_NCELLS(pPage); - iOvfl = 0; - for (; iOvfl < pPage->nOverflow; iOvfl++) { + for (iOvfl = 0; iOvfl < pPage->nOverflow; ++iOvfl) { if (pPage->aiOvfl[iOvfl] >= idx) { break; } @@ -146,6 +147,8 @@ int tdbPageInsertCell(SPage *pPage, int idx, SCell *pCell, int szCell, u8 asOvfl pNewCell = (SCell *)tdbOsMalloc(szCell); memcpy(pNewCell, pCell, szCell); + tdbDebug("tdbPage/new ovfl cell: %p", pNewCell); + pPage->apOvfl[iOvfl] = pNewCell; pPage->aiOvfl[iOvfl] = idx; pPage->nOverflow++; @@ -193,6 +196,8 @@ int tdbPageDropCell(SPage *pPage, int idx, TXN *pTxn, SBTree *pBt) { for (; iOvfl < pPage->nOverflow; iOvfl++) { if (pPage->aiOvfl[iOvfl] == idx) { // remove the over flow cell + tdbOsFree(pPage->apOvfl[iOvfl]); + tdbDebug("tdbPage/free ovfl cell: %p", pPage->apOvfl[iOvfl]); for (; (++iOvfl) < pPage->nOverflow;) { pPage->aiOvfl[iOvfl - 1] = pPage->aiOvfl[iOvfl] - 1; pPage->apOvfl[iOvfl - 1] = pPage->apOvfl[iOvfl]; @@ -248,7 +253,7 @@ void tdbPageCopy(SPage *pFromPage, SPage *pToPage) { int tdbPageCapacity(int pageSize, int amHdrSize) { int szPageHdr; - int minCellIndexSize; // at least one cell in cell index + int minCellIndexSize; // at least one cell in cell index if (pageSize < 65536) { szPageHdr = pageMethods.szPageHdr; diff --git a/source/libs/transport/inc/transComm.h b/source/libs/transport/inc/transComm.h index f256c96037..a81d6db80f 100644 --- a/source/libs/transport/inc/transComm.h +++ b/source/libs/transport/inc/transComm.h @@ -7,8 +7,7 @@ * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - * + * FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ @@ -211,6 +210,7 @@ typedef struct SConnBuffer { char* buf; int len; int cap; + int left; int total; } SConnBuffer; @@ -282,6 +282,8 @@ int transClearBuffer(SConnBuffer* buf); int transDestroyBuffer(SConnBuffer* buf); int transAllocBuffer(SConnBuffer* connBuf, uv_buf_t* uvBuf); bool transReadComplete(SConnBuffer* connBuf); +int transResetBuffer(SConnBuffer* connBuf); +int transDumpFromBuffer(SConnBuffer* connBuf, char** buf); int transSetConnOption(uv_tcp_t* stream); diff --git a/source/libs/transport/src/thttp.c b/source/libs/transport/src/thttp.c index c747e69339..62277a7569 100644 --- a/source/libs/transport/src/thttp.c +++ b/source/libs/transport/src/thttp.c @@ -17,6 +17,7 @@ #ifdef USE_UV #include #endif +// clang-format off #include "zlib.h" #include "thttp.h" #include "taoserror.h" @@ -174,7 +175,7 @@ int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32 #else int32_t taosSendHttpReport(const char* server, uint16_t port, char* pCont, int32_t contLen, EHttpCompFlag flag) { - int32_t code = -1; + int32_t code = -1; TdSocketPtr pSocket = NULL; uint32_t ip = taosGetIpv4FromFqdn(server); @@ -231,4 +232,5 @@ SEND_OVER: return code; } -#endif \ No newline at end of file +// clang-format on +#endif diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 3a06cf8dbc..24a33d96d3 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -60,6 +60,7 @@ typedef struct SCliThrd { int64_t pid; // pid uv_loop_t* loop; SAsyncPool* asyncPool; + uv_idle_t* idle; uv_timer_t timer; void* pool; // conn pool @@ -116,6 +117,7 @@ static void cliSendCb(uv_write_t* req, int status); // callback after conn to server static void cliConnCb(uv_connect_t* req, int status); static void cliAsyncCb(uv_async_t* handle); +static void cliIdleCb(uv_idle_t* handle); static int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg); @@ -323,7 +325,8 @@ void cliHandleResp(SCliConn* conn) { SCliThrd* pThrd = conn->hostThrd; STrans* pTransInst = pThrd->pTransInst; - STransMsgHead* pHead = (STransMsgHead*)(conn->readBuf.buf); + STransMsgHead* pHead = NULL; + transDumpFromBuffer(&conn->readBuf, (char**)&pHead); pHead->code = htonl(pHead->code); pHead->msgLen = htonl(pHead->msgLen); @@ -366,7 +369,6 @@ void cliHandleResp(SCliConn* conn) { } } // buf's mem alread translated to transMsg.pCont - transClearBuffer(&conn->readBuf); if (!CONN_NO_PERSIST_BY_APP(conn)) { transMsg.info.handle = (void*)conn->refId; tDebug("%s conn %p ref by app", CONN_GET_INST_LABEL(conn), conn); @@ -634,6 +636,8 @@ static SCliConn* cliCreateConn(SCliThrd* pThrd) { transReqQueueInit(&conn->wreqQueue); transQueueInit(&conn->cliMsgs, NULL); + + transInitBuffer(&conn->readBuf); QUEUE_INIT(&conn->q); conn->hostThrd = pThrd; conn->status = ConnNormal; @@ -649,8 +653,9 @@ static void cliDestroyConn(SCliConn* conn, bool clear) { QUEUE_REMOVE(&conn->q); QUEUE_INIT(&conn->q); transRemoveExHandle(transGetRefMgt(), conn->refId); - conn->refId = -1; + transDestroyBuffer(&conn->readBuf); + conn->refId = -1; if (conn->task != NULL) transDQCancel(((SCliThrd*)conn->hostThrd)->timeoutQueue, conn->task); if (clear) { @@ -676,7 +681,6 @@ static void cliDestroy(uv_handle_t* handle) { tTrace("%s conn %p destroy successfully", CONN_GET_INST_LABEL(conn), conn); transReqQueueClear(&conn->wreqQueue); - transDestroyBuffer(&conn->readBuf); taosMemoryFree(conn); } static bool cliHandleNoResp(SCliConn* conn) { @@ -958,6 +962,10 @@ static void cliAsyncCb(uv_async_t* handle) { } if (pThrd->stopMsg != NULL) cliHandleQuit(pThrd->stopMsg, pThrd); } +static void cliIdleCb(uv_idle_t* handle) { + SCliThrd* thrd = handle->data; + tTrace("do idle work"); +} static void* cliWorkThread(void* arg) { SCliThrd* pThrd = (SCliThrd*)arg; @@ -1020,6 +1028,11 @@ static SCliThrd* createThrdObj() { uv_timer_init(pThrd->loop, &pThrd->timer); pThrd->timer.data = pThrd; + // pThrd->idle = taosMemoryCalloc(1, sizeof(uv_idle_t)); + // uv_idle_init(pThrd->loop, pThrd->idle); + // pThrd->idle->data = pThrd; + // uv_idle_start(pThrd->idle, cliIdleCb); + pThrd->pool = createConnPool(4); transDQCreate(pThrd->loop, &pThrd->delayQueue); @@ -1041,6 +1054,8 @@ static void destroyThrdObj(SCliThrd* pThrd) { transDQDestroy(pThrd->delayQueue, destroyCmsg); transDQDestroy(pThrd->timeoutQueue, NULL); + + taosMemoryFree(pThrd->idle); taosMemoryFree(pThrd->loop); taosMemoryFree(pThrd); } diff --git a/source/libs/transport/src/transComm.c b/source/libs/transport/src/transComm.c index 155cdd1062..c99effb26f 100644 --- a/source/libs/transport/src/transComm.c +++ b/source/libs/transport/src/transComm.c @@ -16,6 +16,8 @@ #include "transComm.h" +#define BUFFER_CAP 4096 + static TdThreadOnce transModuleInit = PTHREAD_ONCE_INIT; static int32_t refMgt; @@ -111,12 +113,58 @@ int transGetSockDebugInfo(struct sockaddr* sockname, char* dst) { return r; } int transInitBuffer(SConnBuffer* buf) { - transClearBuffer(buf); + buf->cap = BUFFER_CAP; + buf->buf = taosMemoryCalloc(1, BUFFER_CAP); + buf->left = -1; + buf->len = 0; + buf->total = 0; return 0; } +int transDestroyBuffer(SConnBuffer* buf) { + taosMemoryFree(buf->buf); + return 0; +} + int transClearBuffer(SConnBuffer* buf) { - memset(buf, 0, sizeof(*buf)); - buf->total = -1; + SConnBuffer* p = buf; + if (p->cap > BUFFER_CAP) { + p->cap = BUFFER_CAP; + p->buf = taosMemoryRealloc(p->buf, BUFFER_CAP); + } + p->left = -1; + p->len = 0; + p->total = 0; + return 0; +} + +int transDumpFromBuffer(SConnBuffer* connBuf, char** buf) { + SConnBuffer* p = connBuf; + if (p->left != 0) { + return -1; + } + int total = connBuf->total; + *buf = taosMemoryCalloc(1, total); + memcpy(*buf, p->buf, total); + + transResetBuffer(connBuf); + return total; +} + +int transResetBuffer(SConnBuffer* connBuf) { + SConnBuffer* p = connBuf; + if (p->total < p->len) { + int left = p->len - p->total; + memmove(p->buf, p->buf + p->total, left); + p->left = -1; + p->total = 0; + p->len = left; + } else if (p->total == p->len) { + p->left = -1; + p->total = 0; + p->len = 0; + } else { + assert(0); + } return 0; } int transAllocBuffer(SConnBuffer* connBuf, uv_buf_t* uvBuf) { @@ -126,54 +174,39 @@ int transAllocBuffer(SConnBuffer* connBuf, uv_buf_t* uvBuf) { * |<------STransMsgHead------->|<-------------------userdata--------------->|<-----auth data----->|<----user * info--->| */ - static const int CAPACITY = sizeof(STransMsgHead); - SConnBuffer* p = connBuf; - if (p->cap == 0) { - p->buf = (char*)taosMemoryCalloc(CAPACITY, sizeof(char)); - tTrace("internal malloc mem:%p, size:%d", p->buf, CAPACITY); - p->len = 0; - p->cap = CAPACITY; - p->total = -1; - uvBuf->base = p->buf; - uvBuf->len = CAPACITY; - } else if (p->total == -1 && p->len < CAPACITY) { - uvBuf->base = p->buf + p->len; - uvBuf->len = CAPACITY - p->len; - } else { - p->cap = p->total; - p->buf = taosMemoryRealloc(p->buf, p->cap); - tTrace("internal realloc mem:%p, size:%d", p->buf, p->cap); - - uvBuf->base = p->buf + p->len; + uvBuf->base = p->buf + p->len; + if (p->left == -1) { uvBuf->len = p->cap - p->len; + } else { + if (p->left < p->cap - p->len) { + uvBuf->len = p->left; + } else { + p->buf = taosMemoryRealloc(p->buf, p->left + p->len); + uvBuf->base = p->buf + p->len; + uvBuf->len = p->left; + } } return 0; } // check whether already read complete bool transReadComplete(SConnBuffer* connBuf) { - if (connBuf->total == -1 && connBuf->len >= sizeof(STransMsgHead)) { - STransMsgHead head; - memcpy((char*)&head, connBuf->buf, sizeof(head)); - int32_t msgLen = (int32_t)htonl(head.msgLen); - connBuf->total = msgLen; + SConnBuffer* p = connBuf; + if (p->len >= sizeof(STransMsgHead)) { + if (p->left == -1) { + STransMsgHead head; + memcpy((char*)&head, connBuf->buf, sizeof(head)); + int32_t msgLen = (int32_t)htonl(head.msgLen); + p->total = msgLen; + } + if (p->total >= p->len) { + p->left = p->total - p->len; + } else { + p->left = 0; + } } - if (connBuf->len == connBuf->cap && connBuf->total == connBuf->cap) { - return true; - } - return false; -} -int transPackMsg(STransMsgHead* msgHead, bool sercured, bool auth) { return 0; } - -int transUnpackMsg(STransMsgHead* msgHead) { return 0; } -int transDestroyBuffer(SConnBuffer* buf) { - if (buf->cap > 0) { - taosMemoryFreeClear(buf->buf); - } - transClearBuffer(buf); - - return 0; + return p->left == 0 ? true : false; } int transSetConnOption(uv_tcp_t* stream) { diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index fe7ab47fee..a97e0b53c1 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -212,9 +212,10 @@ static void uvHandleActivityTimeout(uv_timer_t* handle) { } static void uvHandleReq(SSvrConn* pConn) { - SConnBuffer* pBuf = &pConn->readBuf; - char* msg = pBuf->buf; - uint32_t msgLen = pBuf->len; + STransMsgHead* msg = NULL; + int msgLen = 0; + + msgLen = transDumpFromBuffer(&pConn->readBuf, (char**)&msg); STransMsgHead* pHead = (STransMsgHead*)msg; pHead->code = htonl(pHead->code); @@ -237,7 +238,7 @@ static void uvHandleReq(SSvrConn* pConn) { transMsg.msgType = pHead->msgType; transMsg.code = pHead->code; - transClearBuffer(&pConn->readBuf); + // transClearBuffer(&pConn->readBuf); pConn->inType = pHead->msgType; if (pConn->status == ConnNormal) { @@ -761,6 +762,7 @@ static SSvrConn* createConn(void* hThrd) { memset(&pConn->regArg, 0, sizeof(pConn->regArg)); pConn->broken = false; pConn->status = ConnNormal; + transInitBuffer(&pConn->readBuf); SExHandle* exh = taosMemoryMalloc(sizeof(SExHandle)); exh->handle = pConn; diff --git a/source/libs/wal/inc/walInt.h b/source/libs/wal/inc/walInt.h index 20667fc918..3aebb1c6ba 100644 --- a/source/libs/wal/inc/walInt.h +++ b/source/libs/wal/inc/walInt.h @@ -61,26 +61,31 @@ static inline int32_t compareWalFileInfo(const void* pLeft, const void* pRight) } static inline int64_t walGetLastFileSize(SWal* pWal) { + if (taosArrayGetSize(pWal->fileInfoSet) == 0) return 0; SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGetLast(pWal->fileInfoSet); return pInfo->fileSize; } static inline int64_t walGetLastFileFirstVer(SWal* pWal) { + if (taosArrayGetSize(pWal->fileInfoSet) == 0) return -1; SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGetLast(pWal->fileInfoSet); return pInfo->firstVer; } static inline int64_t walGetCurFileFirstVer(SWal* pWal) { + if (pWal->writeCur == -1) return -1; SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGet(pWal->fileInfoSet, pWal->writeCur); return pInfo->firstVer; } static inline int64_t walGetCurFileLastVer(SWal* pWal) { + if (pWal->writeCur == -1) return -1; SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGet(pWal->fileInfoSet, pWal->writeCur); return pInfo->firstVer; } static inline int64_t walGetCurFileOffset(SWal* pWal) { + if (pWal->writeCur == -1) return -1; SWalFileInfo* pInfo = (SWalFileInfo*)taosArrayGet(pWal->fileInfoSet, pWal->writeCur); return pInfo->fileSize; } @@ -88,6 +93,7 @@ static inline int64_t walGetCurFileOffset(SWal* pWal) { static inline bool walCurFileClosed(SWal* pWal) { return taosArrayGetSize(pWal->fileInfoSet) != pWal->writeCur; } static inline SWalFileInfo* walGetCurFileInfo(SWal* pWal) { + if (pWal->writeCur == -1) return NULL; return (SWalFileInfo*)taosArrayGet(pWal->fileInfoSet, pWal->writeCur); } diff --git a/source/libs/wal/src/walMgmt.c b/source/libs/wal/src/walMgmt.c index 047354c4aa..c939c8c436 100644 --- a/source/libs/wal/src/walMgmt.c +++ b/source/libs/wal/src/walMgmt.c @@ -83,7 +83,16 @@ SWal *walOpen(const char *path, SWalCfg *pCfg) { // set config memcpy(&pWal->cfg, pCfg, sizeof(SWalCfg)); + pWal->fsyncSeq = pCfg->fsyncPeriod / 1000; + if (pWal->cfg.retentionSize > 0) { + pWal->cfg.retentionSize *= 1024; + } + + if (pWal->cfg.segSize > 0) { + pWal->cfg.segSize *= 1024; + } + if (pWal->fsyncSeq <= 0) pWal->fsyncSeq = 1; tstrncpy(pWal->path, path, sizeof(pWal->path)); diff --git a/source/libs/wal/src/walWrite.c b/source/libs/wal/src/walWrite.c index d869e6e2ce..491e5b0e08 100644 --- a/source/libs/wal/src/walWrite.c +++ b/source/libs/wal/src/walWrite.c @@ -401,6 +401,7 @@ static FORCE_INLINE int32_t walWriteImpl(SWal *pWal, int64_t index, tmsg_t msgTy pWal->writeHead.head.version = index; pWal->writeHead.head.bodyLen = bodyLen; pWal->writeHead.head.msgType = msgType; + pWal->writeHead.head.ingestTs = taosGetTimestampMs(); // sync info for sync module pWal->writeHead.head.syncMeta = syncMeta; @@ -457,14 +458,14 @@ int64_t walAppendLog(SWal *pWal, tmsg_t msgType, SWalSyncInfo syncMeta, const vo return -1; } - if (pWal->pIdxFile == NULL || pWal->pIdxFile == NULL || pWal->writeCur < 0) { + if (pWal->pLogFile == NULL || pWal->pIdxFile == NULL || pWal->writeCur < 0) { if (walInitWriteFile(pWal) < 0) { taosThreadMutexUnlock(&pWal->mutex); return -1; } } - ASSERT(pWal->pIdxFile != NULL && pWal->pLogFile != NULL && pWal->writeCur >= 0); + ASSERT(pWal->pLogFile != NULL && pWal->pIdxFile != NULL && pWal->writeCur >= 0); if (walWriteImpl(pWal, index, msgType, syncMeta, body, bodyLen) < 0) { taosThreadMutexUnlock(&pWal->mutex); diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 8450e8baea..fa94bc6a13 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -374,9 +374,10 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) { size_t size = 0; int32_t done = 0; int32_t code = -1; + float coreCount = 0; TdFilePtr pFile = taosOpenFile("/proc/cpuinfo", TD_FILE_READ | TD_FILE_STREAM); - if (pFile == NULL) return false; + if (pFile == NULL) return code; while (done != 3 && (size = taosGetLineFile(pFile, &line)) != -1) { line[size - 1] = '\0'; @@ -390,11 +391,26 @@ int32_t taosGetCpuInfo(char *cpuModel, int32_t maxLen, float *numOfCores) { *numOfCores = atof(v); done |= 2; } + if (strncmp(line, "processor", 9) == 0) coreCount += 1; } if (line != NULL) taosMemoryFree(line); taosCloseFile(&pFile); + if (code != 0) { + TdFilePtr pFile1 = taosOpenFile("/proc/device-tree/model", TD_FILE_READ | TD_FILE_STREAM); + if (pFile1 == NULL) return code; + taosGetsFile(pFile1, maxLen, cpuModel); + taosCloseFile(&pFile1); + code = 0; + done |= 1; + } + + if ((done & 2) == 0) { + *numOfCores = coreCount; + done |= 2; + } + return code; #endif } diff --git a/source/util/src/tcache.c b/source/util/src/tcache.c index 0975b10d55..7cbc1cd555 100644 --- a/source/util/src/tcache.c +++ b/source/util/src/tcache.c @@ -266,6 +266,7 @@ static void pushfrontNodeInEntryList(SCacheEntry *pEntry, SCacheNode *pNode) { pNode->pNext = pEntry->next; pEntry->next = pNode; pEntry->num += 1; + ASSERT((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); } static void removeNodeInEntryList(SCacheEntry *pe, SCacheNode *prev, SCacheNode *pNode) { @@ -278,6 +279,7 @@ static void removeNodeInEntryList(SCacheEntry *pe, SCacheNode *prev, SCacheNode pNode->pNext = NULL; pe->num -= 1; + ASSERT((pe->next && pe->num > 0) || (NULL == pe->next && pe->num == 0)); } static FORCE_INLINE SCacheEntry *doFindEntry(SCacheObj *pCacheObj, const void *key, size_t keyLen) { @@ -657,15 +659,18 @@ void doTraverseElems(SCacheObj *pCacheObj, bool (*fp)(void *param, SCacheNode *p taosWLockLatch(&pEntry->latch); + SCacheNode **pPre = &pEntry->next; SCacheNode *pNode = pEntry->next; while (pNode != NULL) { SCacheNode *next = pNode->pNext; if (fp(pSup, pNode)) { + pPre = &pNode->pNext; pNode = pNode->pNext; } else { - pEntry->next = next; + *pPre = next; pEntry->num -= 1; + ASSERT((pEntry->next && pEntry->num > 0) || (NULL == pEntry->next && pEntry->num == 0)); atomic_sub_fetch_ptr(&pCacheObj->numOfElems, 1); pNode = next; diff --git a/source/util/src/terror.c b/source/util/src/terror.c index 3b95adc970..f8d8e9d168 100644 --- a/source/util/src/terror.c +++ b/source/util/src/terror.c @@ -517,7 +517,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTER_SLIDING_TOO_SMALL, "sliding value can no TAOS_DEFINE_ERROR(TSDB_CODE_PAR_ONLY_ONE_JSON_TAG, "Only one tag if there is a json tag") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INCORRECT_NUM_OF_COL, "Query block has incorrect number of result columns") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INCORRECT_TIMESTAMP_VAL, "Incorrect TIMESTAMP value") -TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_DAYS_VALUE, "Invalid days value, should be keep2 >= keep1 >= keep0 >= days") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_OFFSET_LESS_ZERO, "soffset/offset can not be less than 0") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_SLIMIT_LEAK_PARTITION_BY, "slimit/soffset only available for PARTITION BY query") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_TOPIC_QUERY, "Invalid topic query") diff --git a/tests/pytest/alter/alter_create_exception.py b/tests/pytest/alter/alter_create_exception.py index 19f1ba9464..d8400c1fa9 100644 --- a/tests/pytest/alter/alter_create_exception.py +++ b/tests/pytest/alter/alter_create_exception.py @@ -47,16 +47,16 @@ class TDTestCase: tdSql.error('create database db comp "1.4"') tdSql.error("create database db blocks '10'") tdSql.error('create database db keep "3650"') - tdSql.error('create database db fsync "3650"') + tdSql.error('create database db wal_fsync_period "3650"') tdSql.execute('create database db precision "us"') tdSql.query('show databases') tdSql.checkData(0,16,'us') tdSql.execute('drop database if exists db') #checking float input exception for create - tdSql.error("create database db fsync 7.3") - tdSql.error("create database db fsync 0.0") - tdSql.error("create database db fsync -5.32") + tdSql.error("create database db wal_fsync_period 7.3") + tdSql.error("create database db wal_fsync_period 0.0") + tdSql.error("create database db wal_fsync_period -5.32") tdSql.error('create database db comp 7.2') tdSql.error("create database db blocks 5.87") tdSql.error('create database db keep 15.4') diff --git a/tests/pytest/perfbenchmark/bug3433.py b/tests/pytest/perfbenchmark/bug3433.py index d688dd0310..7f2dfad403 100644 --- a/tests/pytest/perfbenchmark/bug3433.py +++ b/tests/pytest/perfbenchmark/bug3433.py @@ -77,7 +77,7 @@ class TDTestCase: "walLevel": 1, "cachelast": 0, "quorum": 1, - "fsync": 3000, + "wal_fsync_period": 3000, "update": 0 } diff --git a/tests/pytest/perfbenchmark/joinPerformance.py b/tests/pytest/perfbenchmark/joinPerformance.py index 2de5818c59..b85c09926a 100644 --- a/tests/pytest/perfbenchmark/joinPerformance.py +++ b/tests/pytest/perfbenchmark/joinPerformance.py @@ -92,7 +92,7 @@ class JoinPerf: "walLevel": 1, "cachelast": 0, "quorum": 1, - "fsync": 3000, + "wal_fsync_period": 3000, "update": 0 } diff --git a/tests/pytest/perfbenchmark/taosdemoInsert.py b/tests/pytest/perfbenchmark/taosdemoInsert.py index 37191b2624..774103aa85 100644 --- a/tests/pytest/perfbenchmark/taosdemoInsert.py +++ b/tests/pytest/perfbenchmark/taosdemoInsert.py @@ -86,7 +86,7 @@ class Taosdemo: "walLevel": 1, "cachelast": 0, "quorum": 1, - "fsync": 3000, + "wal_fsync_period": 3000, "update": 0 } diff --git a/tests/pytest/query/query1970YearsAf.py b/tests/pytest/query/query1970YearsAf.py index c78324ff5c..6a5c0796ed 100644 --- a/tests/pytest/query/query1970YearsAf.py +++ b/tests/pytest/query/query1970YearsAf.py @@ -68,7 +68,7 @@ class TDTestCase: "walLevel": 1, "cachelast": 0, "quorum": 1, - "fsync": 3000, + "wal_fsync_period": 3000, "update": 0 } diff --git a/tests/pytest/util/common.py b/tests/pytest/util/common.py index 9b72312028..6384195a1b 100644 --- a/tests/pytest/util/common.py +++ b/tests/pytest/util/common.py @@ -18,7 +18,7 @@ import time import socket import json import toml -from .boundary import DataBoundary +from util.boundary import DataBoundary import taos from util.log import * from util.sql import * @@ -80,23 +80,18 @@ class DataSet: self.bool_data.append( bool((i + bool_start) % 2 )) self.vchar_data.append( f"{vchar_prefix}_{i * vchar_step}" ) self.nchar_data.append( f"{nchar_prefix}_{i * nchar_step}") - self.ts_data.append( int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000 - i * ts_step)) + self.ts_data.append( int(datetime.timestamp(datetime.now()) * 1000 - i * ts_step)) - def get_disorder_set(self, - rows, - int_low :int = INT_MIN, - int_up :int = INT_MAX, - bint_low :int = BIGINT_MIN, - bint_up :int = BIGINT_MAX, - sint_low :int = SMALLINT_MIN, - sint_up :int = SMALLINT_MAX, - tint_low :int = TINYINT_MIN, - tint_up :int = TINYINT_MAX, - ubint_low :int = BIGINT_UN_MIN, - ubint_up :int = BIGINT_UN_MAX, - - - ): + def get_disorder_set(self, rows, **kwargs): + for k, v in kwargs.items(): + int_low = v if k == "int_low" else INT_MIN + int_up = v if k == "int_up" else INT_MAX + bint_low = v if k == "bint_low" else BIGINT_MIN + bint_up = v if k == "bint_up" else BIGINT_MAX + sint_low = v if k == "sint_low" else SMALLINT_MIN + sint_up = v if k == "sint_up" else SMALLINT_MAX + tint_low = v if k == "tint_low" else TINYINT_MIN + tint_up = v if k == "tint_up" else TINYINT_MAX pass diff --git a/tests/pytest/util/sql.py b/tests/pytest/util/sql.py index 01955ec93a..b9177d2269 100644 --- a/tests/pytest/util/sql.py +++ b/tests/pytest/util/sql.py @@ -49,18 +49,23 @@ class TDSql: def close(self): self.cursor.close() - def prepare(self): - tdLog.info("prepare database:db") + def prepare(self, dbname="db", drop=True, **kwargs): + tdLog.info(f"prepare database:{dbname}") s = 'reset query cache' try: self.cursor.execute(s) except: tdLog.notice("'reset query cache' is not supported") - s = 'drop database if exists db' + if drop: + s = f'drop database if exists {dbname}' + self.cursor.execute(s) + s = f'create database {dbname}' + for k, v in kwargs.items(): + s += f" {k} {v}" + if "duration" not in kwargs: + s += " duration 300" self.cursor.execute(s) - s = 'create database db duration 300' - self.cursor.execute(s) - s = 'use db' + s = f'use {dbname}' self.cursor.execute(s) time.sleep(2) @@ -106,7 +111,7 @@ class TDSql: if row_tag: return self.queryResult return self.queryRows - except Exception as e: + except Exception as e: caller = inspect.getframeinfo(inspect.stack()[1][0]) args = (caller.filename, caller.lineno, sql, repr(e)) tdLog.notice("%s(%d) failed: sql:%s, %s" % args) @@ -304,7 +309,7 @@ class TDSql: tdLog.notice("Try to execute sql again, query times: %d "%i) time.sleep(1) pass - else: + else: try: tdLog.notice("Try the last execute sql ") self.affectedRows = self.cursor.execute(sql) diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 0c19e4a2fe..4a6a1ca0b8 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -1,7 +1,7 @@ #======================b1-start=============== -# ---- user +# ---- user ---- ./test.sh -f tsim/user/basic.sim ./test.sh -f tsim/user/password.sim ./test.sh -f tsim/user/privilege_db.sim @@ -58,13 +58,13 @@ # unsupport ./test.sh -f tsim/dnode/vnode_clean.sim ./test.sh -f tsim/dnode/use_dropped_dnode.sim -# ---- import +# ---- import ---- ./test.sh -f tsim/import/basic.sim ./test.sh -f tsim/import/commit.sim ./test.sh -f tsim/import/large.sim ./test.sh -f tsim/import/replica1.sim -# ---- insert +# ---- insert ---- ./test.sh -f tsim/insert/backquote.sim ./test.sh -f tsim/insert/basic.sim ./test.sh -f tsim/insert/basic0.sim @@ -110,7 +110,7 @@ ./test.sh -f tsim/parser/fill.sim ./test.sh -f tsim/parser/first_last.sim ./test.sh -f tsim/parser/fourArithmetic-basic.sim -# TD-17659 ./test.sh -f tsim/parser/function.sim +./test.sh -f tsim/parser/function.sim ./test.sh -f tsim/parser/groupby-basic.sim ./test.sh -f tsim/parser/groupby.sim ./test.sh -f tsim/parser/having_child.sim @@ -132,8 +132,8 @@ ./test.sh -f tsim/parser/lastrow.sim ./test.sh -f tsim/parser/lastrow2.sim ./test.sh -f tsim/parser/like.sim -# TD-17464 ./test.sh -f tsim/parser/limit.sim -# TD-17464 ./test.sh -f tsim/parser/limit1.sim +./test.sh -f tsim/parser/limit.sim +./test.sh -f tsim/parser/limit1.sim # TD-17623 ./test.sh -f tsim/parser/limit2.sim ./test.sh -f tsim/parser/mixed_blocks.sim ./test.sh -f tsim/parser/nchar.sim @@ -145,7 +145,7 @@ ./test.sh -f tsim/parser/select_across_vnodes.sim ./test.sh -f tsim/parser/select_distinct_tag.sim ./test.sh -f tsim/parser/select_from_cache_disk.sim -# TD-17659 ./test.sh -f tsim/parser/select_with_tags.sim +# TD-17832 ./test.sh -f tsim/parser/select_with_tags.sim ./test.sh -f tsim/parser/selectResNum.sim ./test.sh -f tsim/parser/set_tag_vals.sim ./test.sh -f tsim/parser/single_row_in_tb.sim @@ -164,14 +164,14 @@ # TD-17704 ./test.sh -f tsim/parser/union_sysinfo.sim # TD-17661 ./test.sh -f tsim/parser/where.sim -# ---- query -./test.sh -f tsim/query/interval.sim -./test.sh -f tsim/query/interval-offset.sim -./test.sh -f tsim/query/scalarFunction.sim +# ---- query ---- ./test.sh -f tsim/query/charScalarFunction.sim -./test.sh -f tsim/query/explain.sim -./test.sh -f tsim/query/session.sim +# ./test.sh -f tsim/query/explain.sim +./test.sh -f tsim/query/interval-offset.sim +./test.sh -f tsim/query/interval.sim +./test.sh -f tsim/query/scalarFunction.sim ./test.sh -f tsim/query/scalarNull.sim +./test.sh -f tsim/query/session.sim ./test.sh -f tsim/query/udf.sim # ---- qnode @@ -187,10 +187,10 @@ ./test.sh -f tsim/mnode/basic1.sim ./test.sh -f tsim/mnode/basic2.sim ./test.sh -f tsim/mnode/basic3.sim -./test.sh -f tsim/mnode/basic4.sim +# TD-17919 ./test.sh -f tsim/mnode/basic4.sim ./test.sh -f tsim/mnode/basic5.sim -# ---- show +# ---- show ---- ./test.sh -f tsim/show/basic.sim # ---- table @@ -260,7 +260,7 @@ ./test.sh -f tsim/tmq/snapshot.sim ./test.sh -f tsim/tmq/snapshot1.sim -# --- stable +# --- stable ---- ./test.sh -f tsim/stable/alter_comment.sim ./test.sh -f tsim/stable/alter_count.sim ./test.sh -f tsim/stable/alter_import.sim @@ -274,7 +274,6 @@ ./test.sh -f tsim/stable/dnode3.sim ./test.sh -f tsim/stable/metrics.sim ./test.sh -f tsim/stable/refcount.sim -./test.sh -f tsim/stable/show.sim ./test.sh -f tsim/stable/tag_add.sim ./test.sh -f tsim/stable/tag_drop.sim ./test.sh -f tsim/stable/tag_filter.sim @@ -298,8 +297,9 @@ # --- sma ./test.sh -f tsim/sma/drop_sma.sim ./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim -./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim -./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim +# temp disable +#./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim +#./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim # --- valgrind ./test.sh -f tsim/valgrind/checkError1.sim @@ -308,6 +308,7 @@ ./test.sh -f tsim/valgrind/checkError4.sim ./test.sh -f tsim/valgrind/checkError5.sim ./test.sh -f tsim/valgrind/checkError6.sim +./test.sh -f tsim/valgrind/checkError7.sim # --- vnode # unsupport ./test.sh -f tsim/vnode/replica3_basic.sim @@ -328,35 +329,35 @@ ./test.sh -f tsim/sync/oneReplica1VgElect.sim ./test.sh -f tsim/sync/oneReplica5VgElect.sim -# --- catalog +# --- catalog ---- ./test.sh -f tsim/catalog/alterInCurrent.sim # --- scalar ./test.sh -f tsim/scalar/in.sim ./test.sh -f tsim/scalar/scalar.sim -# ---- alter +# ---- alter ---- ./test.sh -f tsim/alter/cached_schema_after_alter.sim ./test.sh -f tsim/alter/dnode.sim ./test.sh -f tsim/alter/table.sim -# ---- cache +# ---- cache ---- ./test.sh -f tsim/cache/new_metrics.sim ./test.sh -f tsim/cache/restart_table.sim ./test.sh -f tsim/cache/restart_metrics.sim -# ---- column +# ---- column ---- ./test.sh -f tsim/column/commit.sim ./test.sh -f tsim/column/metrics.sim ./test.sh -f tsim/column/table.sim -# ---- compress +# ---- compress ---- ./test.sh -f tsim/compress/commitlog.sim ./test.sh -f tsim/compress/compress2.sim ./test.sh -f tsim/compress/compress.sim ./test.sh -f tsim/compress/uncompress.sim -# ---- compute +# ---- compute ---- ./test.sh -f tsim/compute/avg.sim ./test.sh -f tsim/compute/block_dist.sim ./test.sh -f tsim/compute/bottom.sim diff --git a/tests/script/tsim/alter/cached_schema_after_alter.sim b/tests/script/tsim/alter/cached_schema_after_alter.sim index 043f360856..bd2b1d272c 100644 --- a/tests/script/tsim/alter/cached_schema_after_alter.sim +++ b/tests/script/tsim/alter/cached_schema_after_alter.sim @@ -50,11 +50,8 @@ endi print ================== restart server to commit data into disk system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start print ================== server restart completed -sleep 3000 -sql connect sql use $db sql select * from $stb diff --git a/tests/script/tsim/db/alter_option.sim b/tests/script/tsim/db/alter_option.sim index 0590355ccf..7df1f02713 100644 --- a/tests/script/tsim/db/alter_option.sim +++ b/tests/script/tsim/db/alter_option.sim @@ -41,12 +41,12 @@ print ============= create database # | BUFFER value [3~16384, default: 96] # | PAGES value [64~16384, default: 256] # | CACHEMODEL value ['node', 'last_row', 'last_value', 'both'] -# | FSYNC value [0 ~ 180000 ms] +# | WAL_FSYNC_PERIOD value [0 ~ 180000 ms] # | KEEP value [duration, 365000] # | REPLICA value [1 | 3] -# | WAL value [1 | 2] +# | WAL_LEVEL value [1 | 2] -sql create database db CACHEMODEL 'both' COMP 0 DURATION 240 FSYNC 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' REPLICA 3 WAL 2 VGROUPS 6 SINGLE_STABLE 1 +sql create database db CACHEMODEL 'both' COMP 0 DURATION 240 WAL_FSYNC_PERIOD 1000 MAXROWS 8000 MINROWS 10 KEEP 1000 PRECISION 'ns' REPLICA 3 WAL_LEVEL 2 VGROUPS 6 SINGLE_STABLE 1 sql show databases print rows: $rows print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 @@ -99,16 +99,16 @@ endi if $data14_db != ns then # precision return -1 endi -if $data18_db != both then # cache_model +if $data18_db != both then # cachemodel return -1 endi if $data19_db != 1 then # cash_size return -1 endi -if $data20_db != 2 then # wal level +if $data20_db != 2 then # wal_level level return -1 endi -if $data21_db != 1000 then # wal fsyncperiod +if $data21_db != 1000 then # wal_level fsyncperiod return -1 endi if $data22_db != 0 then # @@ -296,46 +296,46 @@ sql_error alter database db maxrows 2000 sql_error alter database db maxrows 11 # equal minrows sql_error alter database db maxrows 10 # little than minrows -print ============== step wal -sql alter database db wal 1 +print ============== step wal_level +sql alter database db wal_level 1 sql show databases -print wal $data20_db +print wal_level $data20_db if $data20_db != 1 then return -1 endi -sql alter database db wal 2 +sql alter database db wal_level 2 sql show databases -print wal $data20_db +print wal_level $data20_db if $data20_db != 2 then return -1 endi -sql_error alter database db wal 0 # TD-14436 -sql_error alter database db wal 3 -sql_error alter database db wal 100 -sql_error alter database db wal -1 +sql_error alter database db wal_level 0 # TD-14436 +sql_error alter database db wal_level 3 +sql_error alter database db wal_level 100 +sql_error alter database db wal_level -1 -print ============== modify fsync -sql alter database db fsync 2000 +print ============== modify wal_fsync_period +sql alter database db wal_fsync_period 2000 sql show databases -print fsync $data21_db +print wal_fsync_period $data21_db if $data21_db != 2000 then return -1 endi -sql alter database db fsync 500 +sql alter database db wal_fsync_period 500 sql show databases -print fsync $data21_db +print wal_fsync_period $data21_db if $data21_db != 500 then return -1 endi -sql alter database db fsync 0 +sql alter database db wal_fsync_period 0 sql show databases -print fsync $data21_db +print wal_fsync_period $data21_db if $data21_db != 0 then return -1 endi -sql_error alter database db fsync 180001 -sql_error alter database db fsync -1 +sql_error alter database db wal_fsync_period 180001 +sql_error alter database db wal_fsync_period -1 print ============== modify comp sql_error alter database db comp 1 diff --git a/tests/script/tsim/db/basic6.sim b/tests/script/tsim/db/basic6.sim index 1daccb03bc..917345e25f 100644 --- a/tests/script/tsim/db/basic6.sim +++ b/tests/script/tsim/db/basic6.sim @@ -15,7 +15,7 @@ $tb = $tbPrefix . $i print =============== step1 # quorum presicion -sql create database $db vgroups 8 replica 1 duration 2 keep 10 minrows 80 maxrows 10000 wal 2 fsync 1000 comp 0 cachemodel 'last_value' precision 'us' +sql create database $db vgroups 8 replica 1 duration 2 keep 10 minrows 80 maxrows 10000 wal_level 2 wal_fsync_period 1000 comp 0 cachemodel 'last_value' precision 'us' sql show databases print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09 diff --git a/tests/script/tsim/db/create_all_options.sim b/tests/script/tsim/db/create_all_options.sim index 259044cb98..56752166e1 100644 --- a/tests/script/tsim/db/create_all_options.sim +++ b/tests/script/tsim/db/create_all_options.sim @@ -43,13 +43,13 @@ print ============= create database with all options # | CACHEMODEL value ['node', 'last_row', 'last_value', 'both', default: 'node'] # | COMP [0 | 1 | 2, default: 2] # | DURATION value [60m ~ min(3650d,keep), default: 10d, unit may be minut/hour/day] -# | FSYNC value [0 ~ 180000 ms, default: 3000] +# | WAL_FSYNC_PERIOD value [0 ~ 180000 ms, default: 3000] # | MAXROWS value [200~10000, default: 4096] # | MINROWS value [10~1000, default: 100] # | KEEP value [max(1d ~ 365000d), default: 1d, unit may be minut/hour/day] # | PRECISION ['ms' | 'us' | 'ns', default: ms] # | REPLICA value [1 | 3, default: 1] -# | WAL value [1 | 2, default: 1] +# | WAL_LEVEL value [1 | 2, default: 1] # | VGROUPS value [default: 2] # | SINGLE_STABLE [0 | 1, default: ] # @@ -62,7 +62,7 @@ print ============= create database with all options #$data7_db : keep #$data10_db : minrows #$data11_db : maxrows -#$data12_db : wal +#$data12_db : wal_level #$data13_db : fsync #$data14_db : comp #$data15_db : cachelast @@ -122,10 +122,10 @@ endi if $data18_db != none then # cachelast return -1 endi -if $data20_db != 1 then # wal +if $data20_db != 1 then # wal_level return -1 endi -if $data21_db != 3000 then # fsync +if $data21_db != 3000 then # wal_fsync_period return -1 endi @@ -254,8 +254,8 @@ sql_error create database db COMP -1 #sql_error create database db KEEP 525600001m #sql_error create database db KEEP 365001d -print ====> FSYNC value [0 ~ 180000 ms, default: 3000] -sql create database db FSYNC 0 +print ====> WAL_FSYNC_PERIOD value [0 ~ 180000 ms, default: 3000] +sql create database db WAL_FSYNC_PERIOD 0 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db if $data21_db != 0 then @@ -263,15 +263,15 @@ if $data21_db != 0 then endi sql drop database db -sql create database db FSYNC 180000 +sql create database db WAL_FSYNC_PERIOD 180000 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db if $data21_db != 180000 then return -1 endi sql drop database db -sql_error create database db FSYNC 180001 -sql_error create database db FSYNC -1 +sql_error create database db WAL_FSYNC_PERIOD 180001 +sql_error create database db WAL_FSYNC_PERIOD -1 print ====> MAXROWS value [200~10000, default: 4096], MINROWS value [10~1000, default: 100] sql create database db MAXROWS 10000 MINROWS 1000 @@ -386,8 +386,8 @@ sql_error create database db REPLICA 4 #sql_error create database db TTL 0 #sql_error create database db TTL -1 -print ====> WAL value [1 | 2, default: 1] -sql create database db WAL 2 +print ====> WAL_LEVEL value [1 | 2, default: 1] +sql create database db WAL_LEVEL 2 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db if $data20_db != 2 then @@ -395,16 +395,16 @@ if $data20_db != 2 then endi sql drop database db -sql create database db WAL 1 +sql create database db WAL_LEVEL 1 sql show databases print $data0_db $data1_db $data2_db $data3_db $data4_db $data5_db $data6_db $data7_db $data8_db $data9_db $data10_db $data11_db $data12_db $data13_db $data14_db $data15_db $data16_db $data17_db if $data20_db != 1 then return -1 endi sql drop database db -sql_error create database db WAL 3 -sql_error create database db WAL -1 -sql_error create database db WAL 0 +sql_error create database db WAL_LEVEL 3 +sql_error create database db WAL_LEVEL -1 +sql_error create database db WAL_LEVEL 0 print ====> VGROUPS value [1~4096, default: 2] sql create database db VGROUPS 1 diff --git a/tests/script/tsim/mnode/basic4.sim b/tests/script/tsim/mnode/basic4.sim index 0ffcdd8c00..6b4c8c6b7c 100644 --- a/tests/script/tsim/mnode/basic4.sim +++ b/tests/script/tsim/mnode/basic4.sim @@ -45,8 +45,11 @@ endi if $data(2)[4] != ready then goto step2 endi +if $data(3)[4] != ready then + goto step2 +endi -system sh/exec.sh -n dnode3 -s stop +system sh/exec.sh -n dnode3 -s stop -x SIGKILL sql_error create mnode on dnode 3 print =============== step3: show mnodes diff --git a/tests/script/tsim/parser/create_db.sim b/tests/script/tsim/parser/create_db.sim index 34ce858409..8d0bc3fe5b 100644 --- a/tests/script/tsim/parser/create_db.sim +++ b/tests/script/tsim/parser/create_db.sim @@ -107,7 +107,7 @@ $ctime = 36000 # 10 hours $wal = 1 # valid value is 1, 2 $comp = 1 # max=32, automatically trimmed when exceeding -sql create database $db replica $replica duration $duration keep $keep maxrows $rows_db wal $wal comp $comp +sql create database $db replica $replica duration $duration keep $keep maxrows $rows_db wal_level $wal comp $comp sql show databases if $rows != 3 then return -1 @@ -225,13 +225,13 @@ sql_error create database $db ctime 29 sql_error create database $db ctime 40961 # wal {0, 2} -sql_error create database testwal wal 0 +sql_error create database testwal wal_level 0 sql show databases if $rows != 2 then return -1 endi -sql create database testwal wal 1 +sql create database testwal wal_level 1 sql show databases if $rows != 3 then return -1 @@ -243,7 +243,7 @@ if $data13_testwal != 1 then endi sql drop database testwal -sql create database testwal wal 2 +sql create database testwal wal_level 2 sql show databases if $rows != 3 then return -1 @@ -254,8 +254,8 @@ if $data13_testwal != 2 then endi sql drop database testwal -sql_error create database $db wal -1 -sql_error create database $db wal 3 +sql_error create database $db wal_level -1 +sql_error create database $db wal_level 3 # comp {0, 1, 2} sql_error create database $db comp -1 diff --git a/tests/script/tsim/parser/function.sim b/tests/script/tsim/parser/function.sim index 7927715988..cbfb59bcab 100644 --- a/tests/script/tsim/parser/function.sim +++ b/tests/script/tsim/parser/function.sim @@ -826,7 +826,7 @@ sql select derivative(k, 200a, 0) from tm0; sql select derivative(k, 999a, 0) from tm0; sql_error select derivative(k, 20s, -12) from tm0; -sql select derivative(k, 1s, 0) from tm0 +sql select ts, derivative(k, 1s, 0) from tm0 if $rows != 5 then return -1 endi @@ -858,7 +858,7 @@ if $data31 != -0.000236111 then return -1 endi -sql select derivative(k, 6m, 0) from tm0; +sql select ts ,derivative(k, 6m, 0) from tm0; if $rows != 5 then return -1 endi @@ -888,7 +888,7 @@ if $data31 != -0.085000000 then return -1 endi -sql select derivative(k, 12m, 0) from tm0; +sql select ts, derivative(k, 12m, 0) from tm0; if $rows != 5 then return -1 endi @@ -938,44 +938,17 @@ sql insert into t1 values('2020-1-1 1:1:6', 200); sql insert into t1 values('2020-1-1 1:1:8', 2000); sql insert into t1 values('2020-1-1 1:1:10', 20000); -sql_error select derivative(k, 1s, 0) from m1; +sql select derivative(k, 1s, 0) from m1; sql_error select derivative(k, 1s, 0) from m1 group by a; sql_error select derivative(f1, 1s, 0) from (select k from t1); -sql select derivative(k, 1s, 0) from m1 group by tbname -if $rows != 12 then - return -1 -endi -if $data00 != @20-01-01 01:01:03.000@ then - return -1 -endi -if $data01 != 1.000000000 then - return -1 -endi -if $data02 != @t0@ then - return -1 -endi -if $data10 != @20-01-01 01:02:04.000@ then - return -1 -endi -if $data11 != 0.016393443 then - return -1 -endi -if $data12 != t0 then - return -1 -endi -if $data90 != @20-01-01 01:01:06.000@ then - return -1 -endi -if $data91 != 90.000000000 then - return -1 -endi -if $data92 != t1 then +sql select ts, derivative(k, 1s, 0) from m1 +if $rows != 13 then return -1 endi print =========================>TD-5190 -sql select stddev(f1) from st1 where ts>'2021-07-01 1:1:1' and ts<'2021-07-30 00:00:00' interval(1d) fill(NULL); +sql select _wstart, stddev(f1) from st1 where ts>'2021-07-01 1:1:1' and ts<'2021-07-30 00:00:00' interval(1d) fill(NULL); if $rows != 29 then return -1 endi @@ -986,7 +959,7 @@ if $data01 != NULL then return -1 endi -sql select derivative(test_column_alias_name, 1s, 0) from (select avg(k) test_column_alias_name from t1 interval(1s)); +sql select derivative(test_column_alias_name, 1s, 0) from (select _wstart, avg(k) test_column_alias_name from t1 interval(1s)); sql create table smeters (ts timestamp, current float, voltage int) tags (t1 int); sql create table smeter1 using smeters tags (1); @@ -994,7 +967,7 @@ sql insert into smeter1 values ('2021-08-08 10:10:10', 10, 2); sql insert into smeter1 values ('2021-08-08 10:10:12', 10, 2); sql insert into smeter1 values ('2021-08-08 10:10:14', 20, 1); -sql select stddev(voltage) from smeters where ts>='2021-08-08 10:10:10.000' and ts < '2021-08-08 10:10:20.000' and current=10 interval(1000a); +sql select _wstart, stddev(voltage) from smeters where ts>='2021-08-08 10:10:10.000' and ts < '2021-08-08 10:10:20.000' and current=10 interval(1000a); if $rows != 2 then return -1 endi @@ -1018,4 +991,3 @@ endi if $data00 != 0.000000000 then return -1 endi - diff --git a/tests/script/tsim/parser/lastrow_query.sim b/tests/script/tsim/parser/lastrow_query.sim index 282761d820..be8f089a79 100644 --- a/tests/script/tsim/parser/lastrow_query.sim +++ b/tests/script/tsim/parser/lastrow_query.sim @@ -131,7 +131,7 @@ if $rows != 172798 then endi sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 1 soffset 0 limit 250000 offset 1 -if $rows != 85648 then +if $rows != 86399 then return -1 endi @@ -146,7 +146,7 @@ if $rows != 4 then endi sql select t1,t1,count(*),tbname,t1,t1,tbname from lr_stb0 where ts>'2018-09-24 00:00:00.000' and ts<'2018-09-25 00:00:00.000' partition by tbname, t1 interval(1s) fill(NULL) slimit 1 soffset 1 limit 250000 offset 1 -if $rows != 87150 then +if $rows != 86399 then return -1 endi diff --git a/tests/script/tsim/parser/limit1_stb.sim b/tests/script/tsim/parser/limit1_stb.sim index 879fd7882f..43fa06230c 100644 --- a/tests/script/tsim/parser/limit1_stb.sim +++ b/tests/script/tsim/parser/limit1_stb.sim @@ -51,40 +51,10 @@ endi ##TBASE-352 $offset = $tbNum * $rowNum $offset = $offset - 1 -sql select * from $stb limit 2 offset $offset +sql select * from $stb order by ts limit 2 offset $offset if $rows != 1 then return -1 endi -if $data00 != @18-11-25 19:30:00.000@ then - return -1 -endi -if $data01 != 9 then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data03 != 9.00000 then - return -1 -endi -if $data04 != NULL then - return -1 -endi -if $data05 != 9 then - return -1 -endi -if $data06 != 9 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary9 then - return -1 -endi -if $data09 != nchar9 then - return -1 -endi $offset = $tbNum * $rowNum $offset = $offset / 2 @@ -197,58 +167,16 @@ endi if $data01 != 1 then return -1 endi -sql select ts, c1, c2, c3, c4, c5, c6, c7, c8, c9 from $stb limit 1 offset 4; +sql select ts, c1, c2, c3, c4, c5, c6, c7, c8, c9 from $stb order by ts limit 1 offset 4; if $rows != 1 then return -1 endi -if $data00 != @18-09-17 09:40:00.000@ then - return -1 -endi -if $data01 != 4 then - return -1 -endi -if $data02 != 4 then - return -1 -endi -if $data03 != 4.00000 then - return -1 -endi -if $data04 != 4.000000000 then - return -1 -endi -if $data05 != 4 then - return -1 -endi -if $data06 != 4 then - return -1 -endi -if $data08 != binary4 then - return -1 -endi -if $data09 != nchar4 then - return -1 -endi ### select from supertable + where + limit offset sql select * from $stb where ts > '2018-09-17 09:30:00.000' and ts < '2018-09-17 10:30:00.000' limit 5 offset 1 if $rows != 5 then return -1 endi -if $data01 != 5 then - return -1 -endi -if $data11 != 6 then - return -1 -endi -if $data21 != 7 then - return -1 -endi -if $data31 != 8 then - return -1 -endi -if $data41 != 4 then - return -1 -endi $offset = $totalNum / 2 sql select * from $stb where ts >= $ts0 and ts <= $tsu limit 5 offset $offset @@ -393,12 +321,12 @@ endi ## TBASE-353 $limit = $totalNum / 2 sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 asc limit $limit offset 1 -if $rows != 0 then +if $rows != 5 then return -1 endi $limit = $totalNum / 2 -sql select max(c1), min(c2), avg(c3), count(c4), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 asc limit $limit offset 0 +sql select max(c1), min(c2), avg(c3), count(c4), sum(c5), spread(c6), first(c7), last(c8), first(c9),t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 asc limit $limit offset 0 if $rows != 6 then print expect 6, actual:$rows return -1 @@ -447,12 +375,12 @@ endi $limit = $totalNum / 2 sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 desc limit $limit offset 1 -if $rows != 0 then +if $rows != 5 then return -1 endi $limit = $totalNum / 2 -sql select max(c1), min(c2), avg(c3), count(c4), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 desc limit $limit offset 0 +sql select max(c1), min(c2), avg(c3), count(c4), sum(c5), spread(c6), first(c7), last(c8), first(c9),t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 desc limit $limit offset 0 if $rows != 6 then return -1 endi @@ -505,7 +433,7 @@ endi ### supertable aggregation + where + interval + limit offset ## TBASE-355 -sql select max(c1), min(c2), avg(c3), count(c4), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit 5 offset 1 +sql select _wstart, max(c1), min(c2), avg(c3), count(c4), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit 5 offset 1 if $rows != 5 then return -1 endi @@ -521,20 +449,11 @@ endi if $data01 != 1 then return -1 endi -if $data15 != 12 then - return -1 -endi -if $data40 != @18-09-17 09:50:00.000@ then - return -1 -endi -if $data41 != 5 then - return -1 -endi ### [TBASE-361] $offset = $rowNum / 2 $offset = $offset + 1 -sql select max(c1), min(c2), avg(c3), count(c4), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit $offset offset $offset +sql select _wstart, max(c1), min(c2), avg(c3), count(c4), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit $offset offset $offset $val = $rowNum - $offset if $rows != $val then print expect $val, actual:$rows @@ -546,31 +465,10 @@ endi if $data01 != 1 then return -1 endi -if $data05 != 6 then - return -1 -endi -if $data30 != @18-10-22 03:00:00.000@ then - return -1 -endi -if $data31 != 4 then - return -1 -endi -if $data42 != 5 then - return -1 -endi -if $data53 != 6.000000000 then - return -1 -endi -if $data54 != 3 then - return -1 -endi -if $data55 != 36 then - return -1 -endi ## supertable aggregation + where + interval + group by order by tag + limit offset -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 interval(5m) group by t1 order by t1 desc limit 2 offset 0 -if $rows != 6 then +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9),t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 2 offset 0 +if $rows != 2 then return -1 endi if $data01 != 5 then @@ -579,117 +477,18 @@ endi if $data09 != 4 then return -1 endi -if $data11 != 6 then - return -1 -endi -if $data19 != 4 then - return -1 -endi -if $data22 != 5 then - return -1 -endi -if $data29 != 3 then - return -1 -endi -if $data33 != 6.000000000 then - return -1 -endi -if $data39 != 3 then - return -1 -endi -if $data44 != 5 then - return -1 -endi -if $data49 != 2 then - return -1 -endi -if $data58 != nchar6 then - return -1 -endi -if $data59 != 2 then + +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 2 offset 1 +if $rows != 2 then return -1 endi -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 interval(5m) group by t1 order by t1 desc limit 2 offset 1 -if $rows != 6 then - return -1 -endi -if $data01 != 6 then - return -1 -endi -if $data09 != 4 then - return -1 -endi -if $data13 != 5.000000000 then - return -1 -endi -if $data19 != 4 then - return -1 -endi -if $data28 != nchar6 then - return -1 -endi -if $data29 != 3 then - return -1 -endi -if $data46 != 1 then - return -1 -endi -if $data59 != 2 then - return -1 -endi - -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 interval(5m) group by t1 order by t1 desc limit 1 offset 0 +sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) limit 1 offset 0 if $rows != 3 then return -1 endi -if $data01 != 5 then - return -1 -endi -if $data09 != 4 then - return -1 -endi -if $data13 != 5.000000000 then - return -1 -endi -if $data19 != 3 then - return -1 -endi -if $data28 != nchar5 then - return -1 -endi -if $data29 != 2 then - return -1 -endi -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 and c1 > 0 and c2 < 9 and c3 > 4 and c4 < 7 and c5 > 4 interval(5m) group by t1 order by t1 desc limit 2 offset 0 +sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 and c1 > 0 and c2 < 9 and c3 > 4 and c4 < 7 and c5 > 4 partition by t1 interval(5m) limit 2 offset 0 if $rows != 6 then return -1 -endi -if $data01 != 5 then - return -1 -endi -if $data09 != 4 then - return -1 -endi -if $data19 != 4 then - return -1 -endi -if $data23 != 5.000000000 then - return -1 -endi -if $data29 != 3 then - return -1 -endi -if $data39 != 3 then - return -1 -endi -if $data48 != nchar5 then - return -1 -endi -if $data49 != 2 then - return -1 -endi -if $data59 != 2 then - return -1 -endi +endi \ No newline at end of file diff --git a/tests/script/tsim/parser/limit1_tb.sim b/tests/script/tsim/parser/limit1_tb.sim index 82914f3011..1ef6a62291 100644 --- a/tests/script/tsim/parser/limit1_tb.sim +++ b/tests/script/tsim/parser/limit1_tb.sim @@ -437,7 +437,7 @@ if $rows != $res then return -1 endi -sql select diff(c1) from $tb where c1 > 5 limit 2 offset 1 +sql select ts, diff(c1) from $tb where c1 > 5 limit 2 offset 1 if $rows != 2 then return -1 endi @@ -462,7 +462,7 @@ endi $limit = $rowNum / 2 $offset = $limit + 1 $val = $limit - 2 -sql select diff(c1) from $tb where c1 >= 0 limit $limit offset $offset +sql select ts, diff(c1) from $tb where c1 >= 0 limit $limit offset $offset if $rows != $val then return -1 endi @@ -493,7 +493,8 @@ endi if $data41 != 4 then return -1 endi -sql select max(c1), max(c2), max(c3), max(c4), max(c5), max(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) limit 5 offset 1 + +sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5), max(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(5m) limit 5 offset 1 if $rows != 5 then return -1 endi @@ -529,7 +530,7 @@ if $data41 != 5 then endi ## TBASE-334 -sql select max(c1), max(c2), max(c3), max(c4), max(c5), max(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 2 offset 1 +sql select _wstart, max(c1), max(c2), max(c3), max(c4), max(c5), max(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 2 offset 1 if $rows != 2 then return -1 endi @@ -549,7 +550,7 @@ if $data21 != null then return -1 endi -sql select min(c1), min(c2), min(c3), min(c4), min(c5), min(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 +sql select _wstart, min(c1), min(c2), min(c3), min(c4), min(c5), min(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 if $rows != 3 then return -1 endi @@ -563,7 +564,7 @@ if $data21 != 0 then return -1 endi -sql select sum(c1), sum(c2), sum(c3), sum(c4), sum(c5), sum(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 5 +sql select _wstart, sum(c1), sum(c2), sum(c3), sum(c4), sum(c5), sum(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 5 if $rows != 5 then return -1 endi @@ -582,7 +583,7 @@ endi if $data41 != 9 then return -1 endi -sql select sum(c1), sum(c2), sum(c3), sum(c4), sum(c5), sum(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 5 offset 1 +sql select _wstart, sum(c1), sum(c2), sum(c3), sum(c4), sum(c5), sum(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 5 offset 1 if $rows != 5 then return -1 endi @@ -602,7 +603,7 @@ if $data41 != 18 then return -1 endi -sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5), avg(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 0 +sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5), avg(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 0 if $rows != 3 then return -1 endi @@ -618,7 +619,7 @@ endi if $data31 != null then return -1 endi -sql select avg(c1), avg(c2), avg(c3), avg(c4), avg(c5), avg(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 +sql select _wstart, avg(c1), avg(c2), avg(c3), avg(c4), avg(c5), avg(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 if $rows != 3 then return -1 endi @@ -640,7 +641,7 @@ sql select stddev(c1), stddev(c2), stddev(c3), stddev(c4), stddev(c5), stddev(c6 if $rows != 0 then return -1 endi -sql select stddev(c1), stddev(c2), stddev(c3), stddev(c4), stddev(c5), stddev(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 5 offset 1 +sql select _wstart, stddev(c1), stddev(c2), stddev(c3), stddev(c4), stddev(c5), stddev(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 5 offset 1 if $rows != 5 then return -1 endi @@ -660,7 +661,7 @@ if $data21 != 4.027681991 then return -1 endi -sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(27m) +sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(27m) if $rows != 3704 then return -1 endi @@ -676,7 +677,7 @@ endi if $data31 != 3 then return -1 endi -sql select count(c1), count(c2), count(c3), count(c4), count(c5), count(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(27m) limit 5 offset 1 +sql select _wstart, count(c1), count(c2), count(c3), count(c4), count(c5), count(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(27m) limit 5 offset 1 if $rows != 5 then return -1 endi @@ -720,7 +721,7 @@ if $rows != 0 then return -1 endi -sql select first(c1), first(c2), first(c3), first(c4), first(c5), first(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 +sql select _wstart, first(c1), first(c2), first(c3), first(c4), first(c5), first(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 if $rows != 3 then return -1 endi @@ -739,7 +740,7 @@ sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb w if $rows != 0 then return -1 endi -sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 +sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 if $rows != 3 then return -1 endi @@ -753,7 +754,7 @@ if $data23 != 1.00000 then return -1 endi -sql select first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 0 +sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 0 if $rows != 3 then return -1 endi @@ -788,7 +789,7 @@ if $data29 != nchar8 then return -1 endi -sql select first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 1 +sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 1 if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/parser/limit_stb.sim b/tests/script/tsim/parser/limit_stb.sim index a3064d59e9..0d0e4a8ea3 100644 --- a/tests/script/tsim/parser/limit_stb.sim +++ b/tests/script/tsim/parser/limit_stb.sim @@ -125,7 +125,7 @@ endi $offset = $tbNum * $rowNum $offset = $offset - 1 -sql select * from $stb limit 2 offset $offset +sql select * from $stb order by ts limit 2 offset $offset if $rows != 1 then return -1 endi @@ -163,40 +163,40 @@ endi $offset = $tbNum * $rowNum $offset = $offset / 2 $offset = $offset - 1 -sql select * from $stb limit 2 offset $offset +sql select * from $stb order by ts limit 2 offset $offset if $rows != 2 then return -1 endi -if $data00 != @18-09-17 10:30:00.002@ then - return -1 -endi -if $data01 != 9 then - return -1 -endi -if $data02 != 9 then - return -1 -endi -if $data03 != 9.00000 then - return -1 -endi -if $data04 != 9.000000000 then - return -1 -endi -if $data05 != 9 then - return -1 -endi -if $data06 != 9 then - return -1 -endi -if $data07 != 1 then - return -1 -endi -if $data08 != binary9 then - return -1 -endi -if $data09 != nchar9 then - return -1 -endi +#if $data00 != @18-09-17 10:30:00.002@ then +# return -1 +#endi +#if $data01 != 9 then +# return -1 +#endi +#if $data02 != 9 then +# return -1 +#endi +#if $data03 != 9.00000 then +# return -1 +#endi +#if $data04 != 9.000000000 then +# return -1 +#endi +#if $data05 != 9 then +# return -1 +#endi +#if $data06 != 9 then +# return -1 +#endi +#if $data07 != 1 then +# return -1 +#endi +#if $data08 != binary9 then +# return -1 +#endi +#if $data09 != nchar9 then +# return -1 +#endi #if $data10 != @18-09-17 09:00:00.000@ then # return -1 #endi @@ -249,7 +249,7 @@ endi if $data01 != 1 then return -1 endi -sql select ts, c1, c2, c3, c4, c5, c6, c7, c8, c9 from $stb limit 1 offset 4; +sql select ts, c1, c2, c3, c4, c5, c6, c7, c8, c9 from $stb order by ts limit 1 offset 40; if $rows != 1 then return -1 endi @@ -327,7 +327,7 @@ if $data41 != 3 then return -1 endi -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from lm_stb0 where ts >= '2018-09-17 09:00:00.000' and ts <= '2018-09-17 10:30:00.009' order by ts asc limit 1 offset 0; +sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from lm_stb0 where ts >= '2018-09-17 09:00:00.000' and ts <= '2018-09-17 10:30:00.009' limit 1 offset 0; if $rows != 1 then return -1 endi @@ -358,7 +358,7 @@ if $data07 != nchar0 then endi #sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from lm_stb0 where ts >= '2018-09-17 09:00:00.000' and ts <= '2018-09-17 10:30:00.000' and c1 > 1 and c2 < 9 and c3 > 2 and c4 < 8 and c5 > 3 and c6 < 7 and c7 > 0 and c8 like '%5' and t1 > 3 and t1 < 6 limit 1 offset 0; -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from lm_stb0 where ts >= '2018-09-17 09:00:00.000' and ts <= '2018-09-17 10:30:00.000' and c1 > 1 and c2 < 9 and c3 > 2 and c4 < 8 and c5 > 3 and c6 < 7 and c7 = 'true' and c8 like '%5' and t1 > 3 and t1 < 6 limit 1 offset 0; +sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from lm_stb0 where ts >= '2018-09-17 09:00:00.000' and ts <= '2018-09-17 10:30:00.000' and c1 > 1 and c2 < 9 and c3 > 2 and c4 < 8 and c5 > 3 and c6 < 7 and c7 = true and c8 like '%5' and t1 > 3 and t1 < 6 limit 1 offset 0; if $rows != 1 then return -1 endi @@ -398,12 +398,12 @@ endi ## TBASE-345 sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 asc limit 5 offset 1 -if $rows != 0 then +if $rows != 5 then return -1 endi -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 asc limit 5 offset 0 -if $rows != 6 then +sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 asc limit 5 offset 0 +if $rows != 5 then return -1 endi if $data00 != 9 then @@ -430,17 +430,14 @@ endi if $data47 != nchar0 then return -1 endi -if $data58 != 7 then - return -1 -endi sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 desc limit 5 offset 1 -if $rows != 0 then +if $rows != 5 then return -1 endi -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 desc limit 5 offset 0 -if $rows != 6 then +sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 group by t1 order by t1 desc limit 5 offset 0 +if $rows != 5 then return -1 endi if $data00 != 9 then @@ -470,15 +467,9 @@ endi if $data24 != 9.000000000 then return -1 endi -if $data53 != 45 then - return -1 -endi -if $data58 != 2 then - return -1 -endi ### supertable aggregation + where + interval + limit offset -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit 5 offset 1 +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit 5 offset 1 if $rows != 5 then return -1 endi @@ -496,7 +487,7 @@ if $data41 != 5 then endi $offset = $rowNum / 2 $offset = $offset + 1 -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit $offset offset $offset +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) limit $offset offset $offset $val = $rowNum - $offset if $rows != $val then return -1 @@ -516,8 +507,8 @@ endi ### supertable aggregation + where + interval + group by order by tag + limit offset ## TBASE-345 -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 interval(5m) group by t1 order by t1 desc limit 3 offset 0 -if $rows != 6 then +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 3 offset 0 +if $rows != 3 then return -1 endi if $data01 != 5 then @@ -538,26 +529,9 @@ endi if $data29 != 3 then return -1 endi -if $data33 != 6.000000000 then - return -1 -endi -if $data39 != 3 then - return -1 -endi -if $data44 != 5 then - return -1 -endi -if $data49 != 2 then - return -1 -endi -if $data58 != nchar6 then - return -1 -endi -if $data59 != 2 then - return -1 -endi -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 interval(5m) group by t1 order by t1 desc limit 3 offset 1 + +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 3 offset 1 if $rows != 3 then return -1 endi @@ -567,21 +541,9 @@ endi if $data09 != 4 then return -1 endi -if $data13 != 6.000000000 then - return -1 -endi -if $data19 != 3 then - return -1 -endi -if $data28 != nchar6 then - return -1 -endi -if $data29 != 2 then - return -1 -endi -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 interval(5m) group by t1 order by t1 desc limit 1 offset 0 -if $rows != 3 then +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 5 and c1 > 0 and c2 < 9 and c3 > 1 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 1 offset 0 +if $rows != 1 then return -1 endi if $data01 != 5 then @@ -590,21 +552,9 @@ endi if $data09 != 4 then return -1 endi -if $data13 != 5.000000000 then - return -1 -endi -if $data19 != 3 then - return -1 -endi -if $data28 != nchar5 then - return -1 -endi -if $data29 != 2 then - return -1 -endi -sql select max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 and c1 > 0 and c2 < 9 and c3 > 4 and c4 < 7 and c5 > 4 interval(5m) group by t1 order by t1 desc limit 3 offset 0 -if $rows != 6 then +sql select _wstart, max(c1), min(c2), avg(c3), sum(c5), spread(c6), first(c7), last(c8), first(c9), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 and c1 > 0 and c2 < 9 and c3 > 4 and c4 < 7 and c5 > 4 partition by t1 interval(5m) order by t1 desc limit 3 offset 0 +if $rows != 3 then return -1 endi if $data01 != 5 then @@ -622,80 +572,12 @@ endi if $data29 != 3 then return -1 endi -if $data39 != 3 then - return -1 -endi -if $data48 != nchar5 then - return -1 -endi -if $data49 != 2 then - return -1 -endi -if $data59 != 2 then + +sql select _wstart, max(c1), min(c1), avg(c1), count(c1), sum(c1), spread(c1), first(c1), last(c1), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 partition by t1 interval(5m) order by t1 asc limit 1 offset 0 +if $rows != 1 then return -1 endi -sql select max(c1), min(c1), avg(c1), count(c1), sum(c1), spread(c1), first(c1), last(c1) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 1 and t1 < 8 interval(5m) group by t1 order by t1 desc limit 1 offset 0 -if $rows != 6 then - return -1 -endi -if $data01 != 0 then - return -1 -endi -if $data02 != 0 then - return -1 -endi -if $data09 != 7 then - return -1 -endi -print $data13 -if $data13 != 0.000000000 then - return -1 -endi -if $data19 != 6 then - return -1 -endi -if $data24 != 1 then - return -1 -endi -if $data29 != 5 then - return -1 -endi -if $data31 != 0 then - return -1 -endi -if $data32 != 0 then - return -1 -endi -if $data33 != 0.000000000 then - return -1 -endi -if $data34 != 1 then - return -1 -endi -if $data35 != 0 then - return -1 -endi - -print $data36 -if $data36 != 0.000000000 then - return -1 -endi -if $data37 != 0 then - return -1 -endi -if $data38 != 0 then - return -1 -endi -if $data39 != 4 then - return -1 -endi -if $data49 != 3 then - return -1 -endi -if $data59 != 2 then - return -1 -endi #sql select max(c2), min(c2), avg(c2), count(c2), sum(c2), spread(c2), first(c2), last(c2) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 3 and t1 < 6 interval(5m) group by t1 order by t1 desc limit 3 offset 1 #if $rows != 3 then @@ -741,89 +623,8 @@ endi # return -1 #endi -sql select max(c2), min(c2), avg(c2), count(c2), spread(c2), first(c2), last(c2), count(ts) from $stb where ts >= $ts0 and ts <= $tsu and t1 > 3 and t1 < 6 interval(5m) group by t1 order by t1 desc limit 3 offset 1 -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 09:10:00.000@ then - return -1 -endi -if $data01 != NULL then - return -1 -endi -if $data02 != NULL then - return -1 -endi -if $data09 != 5 then - return -1 -endi -if $data13 != NULL then - return -1 -endi -if $data19 != 5 then - return -1 -endi -if $data20 != @18-09-17 09:30:00.000@ then - return -1 -endi -if $data24 != 0 then - return -1 -endi -if $data25 != NULL then - return -1 -endi -if $data26 != NULL then - return -1 -endi -if $data27 != NULL then - return -1 -endi -if $data28 != 1 then - return -1 -endi -if $data29 != 5 then - return -1 -endi -if $data30 != @18-09-17 09:10:00.000@ then - return -1 -endi -if $data31 != 1 then - return -1 -endi -if $data32 != 1 then - return -1 -endi -if $data33 != 1.000000000 then - return -1 -endi -if $data34 != 1 then - return -1 -endi -if $data35 != 0.000000000 then - return -1 -endi -if $data36 != 1 then - return -1 -endi -if $data37 != 1 then - return -1 -endi -if $data38 != 1 then - return -1 -endi -if $data39 != 4 then - return -1 -endi -if $data41 != 2 then - return -1 -endi -if $data49 != 4 then - return -1 -endi -if $data51 != 3 then - return -1 -endi -if $data59 != 4 then +sql select _wstart, max(c2), min(c2), avg(c2), count(c2), spread(c2), first(c2), last(c2), count(ts), t1 from $stb where ts >= $ts0 and ts <= $tsu and t1 > 3 and t1 < 6 partition by t1 interval(5m) order by t1 desc limit 3 offset 1 +if $rows != 3 then return -1 endi @@ -832,7 +633,7 @@ if $rows != 0 then return -1 endi -sql select top(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu order by ts desc limit 3 offset 1 +sql select ts, top(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu order by ts desc limit 3 offset 1 if $rows != 3 then return -1 endi @@ -840,7 +641,7 @@ if $data01 != 9 then return -1 endi -sql select top(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu order by ts asc limit 3 offset 1 +sql select ts, top(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu order by ts asc limit 3 offset 1 if $rows != 3 then return -1 endi @@ -848,180 +649,18 @@ if $data01 != 9 then return -1 endi -sql select top(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu group by t1 order by t1 desc slimit 2 soffset 1 limit 3 offset 1 -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 10:00:00.008@ then - return -1 -endi -if $data01 != 6 then - return -1 -endi -if $data02 != 8 then - return -1 -endi -if $data10 != @18-09-17 10:10:00.008@ then - return -1 -endi -if $data11 != 7 then - return -1 -endi -if $data12 != 8 then - return -1 -endi -if $data20 != @18-09-17 10:20:00.008@ then - return -1 -endi -if $data21 != 8 then - return -1 -endi -if $data22 != 8 then - return -1 -endi -if $data30 != @18-09-17 10:00:00.007@ then - return -1 -endi -if $data31 != 6 then - return -1 -endi -if $data32 != 7 then - return -1 -endi -if $data40 != @18-09-17 10:10:00.007@ then - return -1 -endi -if $data41 != 7 then - return -1 -endi -if $data42 != 7 then - return -1 -endi -if $data50 != @18-09-17 10:20:00.007@ then - return -1 -endi -if $data51 != 8 then - return -1 -endi -if $data52 != 7 then +sql select ts, top(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu group by t1 order by t1 desc limit 3 offset 1 +if $rows != 3 then return -1 endi -sql select top(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu group by t1 order by t1 asc slimit 2 soffset 1 limit 3 offset 1 -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 10:00:00.001@ then - return -1 -endi -if $data01 != 6 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data10 != @18-09-17 10:10:00.001@ then - return -1 -endi -if $data11 != 7 then - return -1 -endi -if $data12 != 1 then - return -1 -endi -if $data20 != @18-09-17 10:20:00.001@ then - return -1 -endi -if $data21 != 8 then - return -1 -endi -if $data22 != 1 then - return -1 -endi -if $data30 != @18-09-17 10:00:00.002@ then - return -1 -endi -if $data31 != 6 then - return -1 -endi -if $data32 != 2 then - return -1 -endi -if $data40 != @18-09-17 10:10:00.002@ then - return -1 -endi -if $data41 != 7 then - return -1 -endi -if $data42 != 2 then - return -1 -endi -if $data50 != @18-09-17 10:20:00.002@ then - return -1 -endi -if $data51 != 8 then - return -1 -endi -if $data52 != 2 then +sql select ts, top(c1, 5), t1 from $stb where ts >= $ts0 and ts <= $tsu group by t1 order by t1 asc limit 3 offset 1 +if $rows != 3 then return -1 endi -sql select top(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu group by t1 order by ts desc slimit 2 soffset 1 limit 3 offset 1 -if $rows != 6 then - return -1 -endi -if $data00 != @18-09-17 10:20:00.001@ then - return -1 -endi -if $data01 != 8 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -if $data10 != @18-09-17 10:10:00.001@ then - return -1 -endi -if $data11 != 7 then - return -1 -endi -if $data12 != 1 then - return -1 -endi -if $data20 != @18-09-17 10:00:00.001@ then - return -1 -endi -if $data21 != 6 then - return -1 -endi -if $data22 != 1 then - return -1 -endi -if $data30 != @18-09-17 10:20:00.002@ then - return -1 -endi -if $data31 != 8 then - return -1 -endi -if $data32 != 2 then - return -1 -endi -if $data40 != @18-09-17 10:10:00.002@ then - return -1 -endi -if $data41 != 7 then - return -1 -endi -if $data42 != 2 then - return -1 -endi -if $data50 != @18-09-17 10:00:00.002@ then - return -1 -endi -if $data51 != 6 then - return -1 -endi -if $data52 != 2 then +sql select top(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 order by ts desc limit 3 offset 1 +if $rows != 3 then return -1 endi @@ -1036,7 +675,7 @@ if $rows != 0 then return -1 endi -sql select bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu order by ts desc limit 3 offset 1 +sql select ts, bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu order by ts desc limit 3 offset 1 if $rows != 3 then return -1 endi @@ -1047,7 +686,7 @@ if $data01 != 0 then return -1 endi -sql select bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu order by ts asc limit 3 offset 1 +sql select ts, bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu order by ts asc limit 3 offset 1 if $rows != 3 then return -1 endi @@ -1058,183 +697,20 @@ if $data01 != 0 then return -1 endi -sql select bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu group by t1 order by t1 desc,ts desc slimit 2 soffset 1 limit 3 offset 1 +sql select ts, bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 slimit 2 soffset 1 limit 3 offset 1 if $rows != 6 then return -1 endi -#if $data00 != @18-09-17 09:30:00.000@ then -# return -1 -#endi -if $data01 != 3 then - return -1 -endi -if $data02 != 8 then - return -1 -endi -#if $data10 != @18-09-17 09:20:00.000@ then -# return -1 -#endi -if $data11 != 2 then - return -1 -endi -if $data12 != 8 then - return -1 -endi -#if $data20 != @18-09-17 09:10:00.000@ then -# return -1 -#endi -if $data21 != 1 then - return -1 -endi -if $data22 != 8 then - return -1 -endi -#if $data30 != @18-09-17 09:30:00.000@ then -# return -1 -#endi -if $data31 != 3 then - return -1 -endi -if $data32 != 7 then - return -1 -endi -#if $data40 != @18-09-17 09:20:00.000@ then -# return -1 -#endi -if $data41 != 2 then - return -1 -endi -if $data42 != 7 then - return -1 -endi -#if $data50 != @18-09-17 09:10:00.000@ then -# return -1 -#endi -if $data51 != 1 then - return -1 -endi -if $data52 != 7 then - return -1 -endi -sql select bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu group by t1 order by t1 asc,ts desc slimit 2 soffset 1 limit 3 offset 1 +sql select bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 slimit 2 soffset 1 limit 3 offset 1 if $rows != 6 then return -1 endi -#if $data00 != @18-09-17 09:30:00.000@ then -# return -1 -#endi -if $data01 != 3 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -#if $data10 != @18-09-17 09:20:00.000@ then -# return -1 -#endi -if $data11 != 2 then - return -1 -endi -if $data12 != 1 then - return -1 -endi -#if $data20 != @18-09-17 09:10:00.000@ then -# return -1 -#endi -if $data21 != 1 then - return -1 -endi -if $data22 != 1 then - return -1 -endi -#if $data30 != @18-09-17 09:30:00.000@ then -# return -1 -#endi -if $data31 != 3 then - return -1 -endi -if $data32 != 2 then - return -1 -endi -#if $data40 != @18-09-17 09:20:00.000@ then -# return -1 -#endi -if $data41 != 2 then - return -1 -endi -if $data42 != 2 then - return -1 -endi -#if $data50 != @18-09-17 09:10:00.000@ then -# return -1 -#endi -if $data51 != 1 then - return -1 -endi -if $data52 != 2 then - return -1 -endi -sql select bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu group by t1 order by ts desc slimit 2 soffset 1 limit 3 offset 1 +sql select bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu partition by t1 slimit 2 soffset 1 limit 3 offset 1 if $rows != 6 then return -1 endi -#if $data00 != @18-09-17 09:30:00.000@ then -# return -1 -#endi -if $data01 != 3 then - return -1 -endi -if $data02 != 1 then - return -1 -endi -#if $data10 != @18-09-17 09:20:00.000@ then -# return -1 -#endi -if $data11 != 2 then - return -1 -endi -if $data12 != 1 then - return -1 -endi -#if $data20 != @18-09-17 09:10:00.000@ then -# return -1 -#endi -if $data21 != 1 then - return -1 -endi -if $data22 != 1 then - return -1 -endi -#if $data30 != @18-09-17 09:30:00.000@ then -# return -1 -#endi -if $data31 != 3 then - return -1 -endi -if $data32 != 2 then - return -1 -endi -#if $data40 != @18-09-17 09:20:00.000@ then -# return -1 -#endi -if $data41 != 2 then - return -1 -endi -if $data42 != 2 then - return -1 -endi -#if $data50 != @18-09-17 09:10:00.000@ then -# return -1 -#endi -if $data51 != 1 then - return -1 -endi -if $data52 != 2 then - return -1 -endi - sql select bottom(c1, 5) from $stb where ts >= $ts0 and ts <= $tsu order by ts asc limit 3 offset 5 if $rows != 0 then return -1 diff --git a/tests/script/tsim/parser/limit_tb.sim b/tests/script/tsim/parser/limit_tb.sim index f8a1e7ac6a..6c5706778d 100644 --- a/tests/script/tsim/parser/limit_tb.sim +++ b/tests/script/tsim/parser/limit_tb.sim @@ -445,7 +445,7 @@ if $rows != 0 then return -1 endi -sql select diff(c1) from $tb where c1 > 5 limit 2 offset 1 +sql select ts, diff(c1) from $tb where c1 > 5 limit 2 offset 1 if $rows != 2 then return -1 endi @@ -728,7 +728,7 @@ sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb w if $rows != 0 then return -1 endi -sql select last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 +sql select _wstart, last(c1), last(c2), last(c3), last(c4), last(c5), last(c6) from $tb where ts >= $ts0 and ts <= $tsu interval(30m) limit 3 offset 1 if $rows != 3 then return -1 endi @@ -742,7 +742,7 @@ if $data23 != 9.00000 then return -1 endi -sql select first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 0 +sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 0 if $rows != 3 then return -1 endi @@ -777,7 +777,7 @@ if $data29 != nchar8 then return -1 endi -sql select first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 1 +sql select _wstart, first(ts), first(c1), last(c2), first(c3), last(c4), first(c5), last(c6), first(c8), last(c9) from $tb where ts >= $ts0 and ts <= $tsu and c1 > 0 interval(30m) limit 3 offset 1 if $rows != 3 then return -1 endi diff --git a/tests/script/tsim/query/charScalarFunction.sim b/tests/script/tsim/query/charScalarFunction.sim index f1575d7293..49d3499738 100644 --- a/tests/script/tsim/query/charScalarFunction.sim +++ b/tests/script/tsim/query/charScalarFunction.sim @@ -1,26 +1,6 @@ -#### length, char_length, lower, upper, ltrim, rtrim, concat, concat_ws, substr. - system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect $vgroups = 4 diff --git a/tests/script/tsim/query/complex_group.sim b/tests/script/tsim/query/complex_group.sim index 6c9a7c5a7a..a0cb727253 100644 --- a/tests/script/tsim/query/complex_group.sim +++ b/tests/script/tsim/query/complex_group.sim @@ -1,25 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi - -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect print =============== create database diff --git a/tests/script/tsim/query/complex_having.sim b/tests/script/tsim/query/complex_having.sim index 6a4aa6ea28..29a600dab5 100644 --- a/tests/script/tsim/query/complex_having.sim +++ b/tests/script/tsim/query/complex_having.sim @@ -1,25 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi - -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect print =============== create database diff --git a/tests/script/tsim/query/complex_limit.sim b/tests/script/tsim/query/complex_limit.sim index 4942fec4ee..edcf5734aa 100644 --- a/tests/script/tsim/query/complex_limit.sim +++ b/tests/script/tsim/query/complex_limit.sim @@ -1,25 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi - -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect print =============== create database diff --git a/tests/script/tsim/query/complex_select.sim b/tests/script/tsim/query/complex_select.sim index 1f41783383..ed6c40f616 100644 --- a/tests/script/tsim/query/complex_select.sim +++ b/tests/script/tsim/query/complex_select.sim @@ -1,25 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi - -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect print =============== create database diff --git a/tests/script/tsim/query/complex_where.sim b/tests/script/tsim/query/complex_where.sim index 8e22a12fcf..c634efabfe 100644 --- a/tests/script/tsim/query/complex_where.sim +++ b/tests/script/tsim/query/complex_where.sim @@ -1,25 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi - -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect print =============== create database diff --git a/tests/script/tsim/query/crash_sql.sim b/tests/script/tsim/query/crash_sql.sim index b2b9239232..88ff812d68 100644 --- a/tests/script/tsim/query/crash_sql.sim +++ b/tests/script/tsim/query/crash_sql.sim @@ -1,25 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi - -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect print =============== create database diff --git a/tests/script/tsim/query/diff.sim b/tests/script/tsim/query/diff.sim index 7bfeeeba7f..8604859dc5 100644 --- a/tests/script/tsim/query/diff.sim +++ b/tests/script/tsim/query/diff.sim @@ -1,26 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c walLevel -v 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect $dbPrefix = db diff --git a/tests/script/tsim/query/explain.sim b/tests/script/tsim/query/explain.sim index c853022281..44f5eb74e7 100644 --- a/tests/script/tsim/query/explain.sim +++ b/tests/script/tsim/query/explain.sim @@ -1,7 +1,5 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 - -print ========= start dnode1 as leader system sh/exec.sh -n dnode1 -s start sql connect diff --git a/tests/script/tsim/query/interval-offset.sim b/tests/script/tsim/query/interval-offset.sim index 1399be7b53..b7d367ad90 100644 --- a/tests/script/tsim/query/interval-offset.sim +++ b/tests/script/tsim/query/interval-offset.sim @@ -1,7 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 500 sql connect print =============== create database diff --git a/tests/script/tsim/query/interval.sim b/tests/script/tsim/query/interval.sim index 280a66de00..bd607848d0 100644 --- a/tests/script/tsim/query/interval.sim +++ b/tests/script/tsim/query/interval.sim @@ -1,9 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wal -v 1 system sh/exec.sh -n dnode1 -s start -sleep 500 sql connect $dbPrefix = m_in_db diff --git a/tests/script/tsim/query/read.sim b/tests/script/tsim/query/read.sim index c6bec2586d..87c1d93f17 100644 --- a/tests/script/tsim/query/read.sim +++ b/tests/script/tsim/query/read.sim @@ -1,12 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 - -print ========= start dnode1 as leader system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect sql create database abc1 vgroups 2; diff --git a/tests/script/tsim/query/scalarFunction.sim b/tests/script/tsim/query/scalarFunction.sim index 2946a89ff6..27aa1a7e10 100644 --- a/tests/script/tsim/query/scalarFunction.sim +++ b/tests/script/tsim/query/scalarFunction.sim @@ -1,26 +1,6 @@ -#### abs, log, pow, sqrt, sin, cos, tan, asin, acos, atan, ceil, floor, round - system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect $vgroups = 4 diff --git a/tests/script/tsim/query/scalarNull.sim b/tests/script/tsim/query/scalarNull.sim index 1b437747ce..77aae17afc 100644 --- a/tests/script/tsim/query/scalarNull.sim +++ b/tests/script/tsim/query/scalarNull.sim @@ -1,12 +1,6 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 - -print ========= start dnode1 as leader system sh/exec.sh -n dnode1 -s start -sleep 2000 sql connect print ======== step1 diff --git a/tests/script/tsim/query/session.sim b/tests/script/tsim/query/session.sim index 29559fdee5..3f219f7be9 100644 --- a/tests/script/tsim/query/session.sim +++ b/tests/script/tsim/query/session.sim @@ -1,26 +1,6 @@ -#### session windows - system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect $vgroups = 4 diff --git a/tests/script/tsim/query/stddev.sim b/tests/script/tsim/query/stddev.sim index 15041623bc..291ee32e74 100644 --- a/tests/script/tsim/query/stddev.sim +++ b/tests/script/tsim/query/stddev.sim @@ -1,25 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi - -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect print =============== create database diff --git a/tests/script/tsim/query/time_process.sim b/tests/script/tsim/query/time_process.sim index 0b77c41bb2..e0ca724ef1 100644 --- a/tests/script/tsim/query/time_process.sim +++ b/tests/script/tsim/query/time_process.sim @@ -1,25 +1,6 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start - -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi - -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - sql connect print =============== create database diff --git a/tests/script/tsim/query/udf.sim b/tests/script/tsim/query/udf.sim index 4e95095172..5d69887c86 100644 --- a/tests/script/tsim/query/udf.sim +++ b/tests/script/tsim/query/udf.sim @@ -1,13 +1,9 @@ system sh/stop_dnodes.sh - system sh/deploy.sh -n dnode1 -i 1 -system sh/cfg.sh -n dnode1 -c wallevel -v 2 -system sh/cfg.sh -n dnode1 -c numOfMnodes -v 1 system sh/cfg.sh -n dnode1 -c udf -v 1 print ========= start dnode1 as leader system sh/exec.sh -n dnode1 -s start -sleep 1000 sql connect print ======== step1 udf diff --git a/tests/script/tsim/stable/show.sim b/tests/script/tsim/stable/show.sim deleted file mode 100644 index d3ab75adf5..0000000000 --- a/tests/script/tsim/stable/show.sim +++ /dev/null @@ -1,61 +0,0 @@ -system sh/stop_dnodes.sh -system sh/deploy.sh -n dnode1 -i 1 -system sh/exec.sh -n dnode1 -s start -sql connect - -print ======================== create stable -sql create database d1 -sql use d1 - -$x = 0 -while $x < 128 - $tb = d1.s . $x - sql create table $tb (ts timestamp, i int) tags (j int) - $x = $x + 1 -endw - -print ======================== describe stables -# TODO : create stable error -$m = 0 -while $m < 128 - $tb = s . $m - $filter = ' . $tb - $filter = $filter . ' - sql show stables like $filter - print sql : show stables like $filter - if $rows != 1 then - print expect 1, actual: $rows - return -1 - endi - $m = $m + 1 -endw - - -print ======================== show stables - -sql show d1.stables - -print num of stables is $rows -if $rows != 128 then - return -1 -endi - -print ======================== create table - -$x = 0 -while $x < 424 - $tb = d1.t . $x - sql create table $tb using d1.s0 tags( $x ) - $x = $x + 1 -endw - -print ======================== show stables - -sql show d1.tables - -print num of tables is $rows -if $rows != 424 then - return -1 -endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/stream/session0.sim b/tests/script/tsim/stream/session0.sim index 16a53d49f3..d05a9e1814 100644 --- a/tests/script/tsim/stream/session0.sim +++ b/tests/script/tsim/stream/session0.sim @@ -83,22 +83,22 @@ if $data11 != 3 then goto loop0 endi -if $data12 != 10 then +if $data12 != NULL then print ======data12=$data12 goto loop0 endi -if $data13 != 10 then +if $data13 != NULL then print ======data13=$data13 goto loop0 endi -if $data14 != 1.100000000 then +if $data14 != NULL then print ======data14=$data14 return -1 endi -if $data15 != 0.000000000 then +if $data15 != NULL then print ======data15=$data15 return -1 endi @@ -141,22 +141,22 @@ if $data01 != 7 then goto loop1 endi -if $data02 != 18 then +if $data02 != NULL then print =====data02=$data02 goto loop1 endi -if $data03 != 4 then +if $data03 != NULL then print =====data03=$data03 goto loop1 endi -if $data04 != 1.000000000 then +if $data04 != NULL then print ======$data04 return -1 endi -if $data05 != 1.154700538 then +if $data05 != NULL then print ======$data05 return -1 endi diff --git a/tests/script/tsim/valgrind/basic1.sim b/tests/script/tsim/valgrind/basic1.sim index 49f0b20702..a259dd9219 100644 --- a/tests/script/tsim/valgrind/basic1.sim +++ b/tests/script/tsim/valgrind/basic1.sim @@ -45,7 +45,17 @@ while $i < $tbNum endw print =============== step3: tb -sql select count(1) from tb1 +sql explain analyze select ts from stb where -2; +sql explain analyze select ts from tb1; +sql explain analyze select ts from stb order by ts; +sql explain analyze select * from information_schema.user_stables; +sql explain analyze select count(*),sum(tbcol) from tb1; +sql explain analyze select count(*),sum(tbcol) from stb; +sql explain analyze select count(*),sum(tbcol) from stb group by tbcol; +sql explain analyze select * from information_schema.user_stables; +sql explain analyze verbose true select * from information_schema.user_stables where db_name='db2'; +sql explain analyze verbose true select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql explain select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/checkError6.sim b/tests/script/tsim/valgrind/checkError6.sim index 27fd291f64..ec8ca0ad8c 100644 --- a/tests/script/tsim/valgrind/checkError6.sim +++ b/tests/script/tsim/valgrind/checkError6.sim @@ -29,7 +29,7 @@ $rowNum = 10 print =============== step2: prepare data sql create database db vgroups 2 sql use db -sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double) tags (tgcol int unsigned) +sql create table if not exists stb (ts timestamp, tbcol int, tbcol2 float, tbcol3 double, tbcol4 binary(30), tbcol5 binary(30)) tags (tgcol int unsigned) $i = 0 while $i < $tbNum @@ -39,13 +39,13 @@ while $i < $tbNum while $x < $rowNum $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , $x , $x , $x ) + sql insert into $tb values ($ms , $x , $x , $x , "abcd1234=-+*" , "123456 0" ) $x = $x + 1 endw $cc = $x * 60000 $ms = 1601481600000 + $cc - sql insert into $tb values ($ms , NULL , NULL , NULL ) + sql insert into $tb values ($ms , NULL , NULL , NULL , NULL , NULL ) $i = $i + 1 endw @@ -60,15 +60,71 @@ sql select top(tbcol, 2) from tb1 where ts <= 1601481840000 sql select percentile(tbcol, 2) from tb1 where ts <= 1601481840000 sql select leastsquares(tbcol, 1, 1) as b from tb1 where ts <= 1601481840000 sql show table distributed tb1 +sql select count(1) from tb1 sql select count(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) sql select diff(tbcol) from tb1 where ts <= 1601481840000 -sql select diff(tbcol) from tb1 where tbcol > 5 and tbcol < 20 +sql select diff(tbcol) from tb1 where tbcol > 5 and tbcol < 20 order by ts sql select first(tbcol), last(tbcol) as b from tb1 where ts <= 1601481840000 interval(1m) -sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from tb1 where ts <= 1601481840000 partition by tgcol interval(1m) -#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from tb1 where ts <= 1601481840000 partition by tgcol order by tgcol +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from tb1 where ts <= 1601481840000 partition by tgcol interval(1m) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) sql select last_row(*) from tb1 where tbcol > 5 and tbcol < 20 +sql select _wstart, _wend, _wduration, _qstart, _qend, count(*) from tb1 interval(10s, 2s) sliding(10s) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from tb1 where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) order by tgcol desc +sql select log(tbcol), abs(tbcol), pow(tbcol, 2), sqrt(tbcol), sin(tbcol), cos(tbcol), tan(tbcol), asin(tbcol), acos(tbcol), atan(tbcol), ceil(tbcol), floor(tbcol), round(tbcol), atan(tbcol) from tb1 +sql select length("abcd1234"), char_length("abcd1234=-+*") from tb1 +sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4), rtrim(tbcol4), concat(tbcol4, tbcol5), concat_ws('_', tbcol4, tbcol5), substr(tbcol4, 1, 4) from tb1 +sql select * from tb1 where tbcol not in (1,2,3,null); +sql select * from tb1 where tbcol + 3 <> null; print =============== step4: stb +sql select avg(tbcol) as c from stb +sql select avg(tbcol) as c from stb where ts <= 1601481840000 +sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000 +sql select avg(tbcol) as c from stb interval(1m) +sql select avg(tbcol) as c from stb interval(1d) +sql select avg(tbcol) as b from stb where ts <= 1601481840000 interval(1m) +sql select avg(tbcol) as c from stb group by tgcol +sql select avg(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql show table distributed stb +sql select count(1) from stb +sql select count(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql select diff(tbcol) from stb where ts <= 1601481840000 +sql select first(tbcol), last(tbcol) as c from stb group by tgcol +sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 and tbcol2 is null partition by tgcol interval(1m) +sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from stb where ts <= 1601481840000 partition by tgcol interval(1m) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) +sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 and tgcol = 1 partition by tgcol interval(1m) fill(value, 0) order by tgcol desc +sql select last_row(tbcol), stddev(tbcol) from stb where tbcol > 5 and tbcol < 20 group by tgcol +sql select _wstart, _wend, _wduration, _qstart, _qend, count(*) from stb interval(10s, 2s) sliding(10s) +sql select log(tbcol), abs(tbcol), pow(tbcol, 2), sqrt(tbcol), sin(tbcol), cos(tbcol), tan(tbcol), asin(tbcol), acos(tbcol), atan(tbcol), ceil(tbcol), floor(tbcol), round(tbcol), atan(tbcol) from stb +sql select length("abcd1234"), char_length("abcd1234=-+*") from stb +sql select tbcol4, length(tbcol4), lower(tbcol4), upper(tbcol4), ltrim(tbcol4), rtrim(tbcol4), concat(tbcol4, tbcol5), concat_ws('_', tbcol4, tbcol5), substr(tbcol4, 1, 4) from stb +sql select * from stb where tbcol not in (1,2,3,null); +sql select * from stb where tbcol + 3 <> null; + +print =============== step5: explain + + +print =============== check +$null= + +system_content sh/checkValgrind.sh -n dnode1 +print cmd return result ----> [ $system_content ] +if $system_content > 0 then + return -1 +endi + +if $system_content == $null then + return -1 +endi + +print =============== restart +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start -v + sql select avg(tbcol) as c from stb sql select avg(tbcol) as c from stb where ts <= 1601481840000 sql select avg(tbcol) as c from stb where tgcol < 5 and ts <= 1601481840000 @@ -84,7 +140,6 @@ sql select first(tbcol), last(tbcol) as c from stb group by tgcol sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 and tbcol2 is null partition by tgcol interval(1m) sql select first(tbcol), last(tbcol) as b from stb where ts <= 1601481840000 partition by tgcol interval(1m) sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), sum(tbcol), stddev(tbcol) from stb where ts <= 1601481840000 partition by tgcol interval(1m) -#sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from stb where ts <= 1601481840000 and ts >= 1601481800000 partition by tgcol interval(1m) fill(value, 0) sql select last_row(tbcol), stddev(tbcol) from stb where tbcol > 5 and tbcol < 20 group by tgcol _OVER: diff --git a/tests/system-test/0-others/fsync.py b/tests/system-test/0-others/fsync.py index eedf3629ed..fcc790040c 100644 --- a/tests/system-test/0-others/fsync.py +++ b/tests/system-test/0-others/fsync.py @@ -49,35 +49,35 @@ class TDTestCase: fsync_index = i tdSql.execute("drop database if exists db1") - tdSql.execute("create database db1 wal 1") + tdSql.execute("create database db1 wal_level 1") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, wal_index, 1) tdSql.execute("drop database if exists db1") - tdSql.execute("create database db1 wal 2") + tdSql.execute("create database db1 wal_level 2") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, wal_index, 2) tdSql.execute("drop database if exists db1") - tdSql.execute("create database db1 fsync 0") + tdSql.execute("create database db1 wal_fsync_period 0") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, fsync_index, 0) tdSql.execute("drop database if exists db1") - tdSql.execute("create database db1 fsync 3000") + tdSql.execute("create database db1 wal_fsync_period 3000") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, fsync_index, 3000) tdSql.execute("drop database if exists db1") - tdSql.execute("create database db1 fsync 180000") + tdSql.execute("create database db1 wal_fsync_period 180000") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": @@ -85,7 +85,7 @@ class TDTestCase: tdSql.execute("drop database if exists db1") - tdSql.execute("create database db1 wal 1 fsync 6000") + tdSql.execute("create database db1 wal_level 1 wal_fsync_period 6000") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": @@ -93,49 +93,49 @@ class TDTestCase: tdSql.checkData(i, wal_index, 1) tdSql.execute("drop database if exists db1") - tdSql.execute("create database db1 wal 2 fsync 3000") + tdSql.execute("create database db1 wal_level 2 wal_fsync_period 3000") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, fsync_index, 3000) tdSql.checkData(i, wal_index, 2) - tdSql.execute("alter database db1 wal 1") + tdSql.execute("alter database db1 wal_level 1") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, fsync_index, 3000) tdSql.checkData(i, wal_index, 1) - tdSql.execute("alter database db1 wal 2") + tdSql.execute("alter database db1 wal_level 2") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, fsync_index, 3000) tdSql.checkData(i, wal_index, 2) - tdSql.execute("alter database db1 fsync 0") + tdSql.execute("alter database db1 wal_fsync_period 0") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, fsync_index, 0) tdSql.checkData(i, wal_index, 2) - tdSql.execute("alter database db1 fsync 3000") + tdSql.execute("alter database db1 wal_fsync_period 3000") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, fsync_index, 3000) tdSql.checkData(i, wal_index, 2) - tdSql.execute("alter database db1 fsync 18000") + tdSql.execute("alter database db1 wal_fsync_period 18000") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": tdSql.checkData(i, fsync_index, 18000) tdSql.checkData(i, wal_index, 2) - tdSql.execute("alter database db1 wal 1 fsync 3000") + tdSql.execute("alter database db1 wal_level 1 wal_fsync_period 3000") tdSql.query("show databases") for i in range(tdSql.queryRows): if tdSql.queryResult[i][0] == "db1": @@ -147,29 +147,29 @@ class TDTestCase: @property def fsync_create_err(self): return [ - "create database db1 wal 0", - "create database db1 wal 3", - "create database db1 wal null", - "create database db1 wal true", - "create database db1 wal 1.1", - "create database db1 fsync -1", - "create database db1 fsync 180001", - "create database db1 fsync 10.111", - "create database db1 fsync true", + "create database db1 wal_level 0", + "create database db1 wal_level 3", + "create database db1 wal_level null", + "create database db1 wal_level true", + "create database db1 wal_level 1.1", + "create database db1 wal_fsync_period -1", + "create database db1 wal_fsync_period 180001", + "create database db1 wal_fsync_period 10.111", + "create database db1 wal_fsync_period true", ] @property def fsync_alter_err(self): return [ - "alter database db1 wal 0", - "alter database db1 wal 3", - "alter database db1 wal null", - "alter database db1 wal true", - "alter database db1 wal 1.1", - "alter database db1 fsync -1", - "alter database db1 fsync 180001", - "alter database db1 fsync 10.111", - "alter database db1 fsync true", + "alter database db1 wal_level 0", + "alter database db1 wal_level 3", + "alter database db1 wal_level null", + "alter database db1 wal_level true", + "alter database db1 wal_level 1.1", + "alter database db1 wal_fsync_period -1", + "alter database db1 wal_fsync_period 180001", + "alter database db1 wal_fsync_period 10.111", + "alter database db1 wal_fsync_period true", ] def test_fsync_err(self): @@ -290,7 +290,7 @@ class TDTestCase: # tdSql.execute("use db") - tdLog.printNoPrefix("==========step4:after wal, all check again ") + tdLog.printNoPrefix("==========step4:after wal_level, all check again ") self.all_test() def stop(self): diff --git a/tests/system-test/1-insert/mutil_stage.py b/tests/system-test/1-insert/mutil_stage.py new file mode 100644 index 0000000000..fcad114edd --- /dev/null +++ b/tests/system-test/1-insert/mutil_stage.py @@ -0,0 +1,257 @@ +from datetime import datetime +import time + +from typing import List, Any, Tuple +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * + +PRIMARY_COL = "ts" + +INT_COL = "c_int" +BINT_COL = "c_bint" +SINT_COL = "c_sint" +TINT_COL = "c_tint" +FLOAT_COL = "c_float" +DOUBLE_COL = "c_double" +BOOL_COL = "c_bool" +TINT_UN_COL = "c_utint" +SINT_UN_COL = "c_usint" +BINT_UN_COL = "c_ubint" +INT_UN_COL = "c_uint" +BINARY_COL = "c_binary" +NCHAR_COL = "c_nchar" +TS_COL = "c_ts" + +NUM_COL = [INT_COL, BINT_COL, SINT_COL, TINT_COL, FLOAT_COL, DOUBLE_COL, ] +CHAR_COL = [BINARY_COL, NCHAR_COL, ] +BOOLEAN_COL = [BOOL_COL, ] +TS_TYPE_COL = [TS_COL, ] + +INT_TAG = "t_int" + +TAG_COL = [INT_TAG] +# insert data args: +TIME_STEP = 10000 +NOW = int(datetime.timestamp(datetime.now()) * 1000) + +# init db/table +DBNAME = "db" +STBNAME = "stb1" +CTB_PRE = "ct" +NTB_PRE = "nt" + +L0 = 0 +L1 = 1 +L2 = 2 + +PRIMARY_DIR = 1 +NON_PRIMARY_DIR = 0 + +DATA_PRE0 = f"data0" +DATA_PRE1 = f"data1" +DATA_PRE2 = f"data2" + +class TDTestCase: + + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor(), False) + self.taos_cfg_path = tdDnodes.dnodes[0].cfgPath + self.taos_data_dir = tdDnodes.dnodes[0].dataDir + + + def cfg(self, filename, **update_dict): + cmd = "echo " + for k, v in update_dict.items(): + cmd += f"{k} {v}\n" + + cmd += f" >> {filename}" + if os.system(cmd) != 0: + tdLog.exit(cmd) + + def cfg_str(self, filename, update_str): + cmd = f'echo "{update_str}" >> {filename}' + if os.system(cmd) != 0: + tdLog.exit(cmd) + + def cfg_str_list(self, filename, update_list): + for update_str in update_list: + self.cfg_str(filename, update_str) + + def del_old_datadir(self, filename): + cmd = f"sed -i '/^dataDir/d' {filename}" + if os.system(cmd) != 0: + tdLog.exit(cmd) + + @property + def __err_cfg(self): + cfg_list = [] + err_case1 = [ + f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE1}1 {L1} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {NON_PRIMARY_DIR}" + ] + err_case2 = [ + f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE1}1 {L1} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {PRIMARY_DIR}" + ] + err_case3 = [ + f"dataDir {self.taos_data_dir}/data33 3 {NON_PRIMARY_DIR}" + ] + err_case4 = [ + f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE1}1 {L1} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L1} {NON_PRIMARY_DIR}" + ] + err_case5 = [f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}"] + for i in range(16): + err_case5.append(f"dataDir {self.taos_data_dir}/{DATA_PRE0}{i+1} {L0} {NON_PRIMARY_DIR}") + + err_case6 = [ + f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE0}1 {L0} {PRIMARY_DIR}", + ] + err_case7 = [ + f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {PRIMARY_DIR}", + ] + err_case8 = [ + f"dataDir {self.taos_data_dir}/data33 3 {PRIMARY_DIR}" + ] + err_case9 = [ + f"dataDir {self.taos_data_dir}/data33 -1 {NON_PRIMARY_DIR}" + ] + + cfg_list.append(err_case1) + cfg_list.append(err_case2) + cfg_list.append(err_case3) + cfg_list.append(err_case4) + cfg_list.append(err_case5) + cfg_list.append(err_case6) + cfg_list.append(err_case7) + cfg_list.append(err_case8) + cfg_list.append(err_case9) + + return cfg_list + + @property + def __current_cfg(self): + cfg_list = [] + current_case1 = [ + f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE0}1 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE1}1 {L1} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE2}2 {L2} {NON_PRIMARY_DIR}" + ] + + current_case2 = [f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 {L0} {PRIMARY_DIR}"] + for i in range(9): + current_case2.append(f"dataDir {self.taos_data_dir}/{DATA_PRE0}{i+1} {L0} {NON_PRIMARY_DIR}") + + # TD-17773bug + current_case3 = [ + f"dataDir {self.taos_data_dir}/{DATA_PRE0}0 ", + f"dataDir {self.taos_data_dir}/{DATA_PRE0}1 {L0} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE1}0 {L1} {NON_PRIMARY_DIR}", + f"dataDir {self.taos_data_dir}/{DATA_PRE2}0 {L2} {NON_PRIMARY_DIR}", + ] + cfg_list.append(current_case1) + cfg_list.append(current_case3) + + # case2 must in last of least, because use this cfg as data uniformity test + cfg_list.append(current_case2) + + return cfg_list + + def cfg_check(self): + for cfg_case in self.__err_cfg: + self.del_old_datadir(filename=self.taos_cfg_path) + tdDnodes.stop(1) + tdDnodes.deploy(1) + self.cfg_str_list(filename=self.taos_cfg_path, update_list=cfg_case) + tdDnodes.starttaosd(1) + time.sleep(2) + tdSql.error(f"show databases") + + for cfg_case in self.__current_cfg: + self.del_old_datadir(filename=self.taos_cfg_path) + tdDnodes.stop(1) + tdDnodes.deploy(1) + self.cfg_str_list(filename=self.taos_cfg_path, update_list=cfg_case) + tdDnodes.start(1) + tdSql.query(f"show databases") + + def __create_tb(self, stb=STBNAME, ctb_pre = CTB_PRE, ctb_num=20, ntb_pre=NTB_PRE, ntbnum=1, dbname=DBNAME): + tdLog.printNoPrefix("==========step: create table") + create_stb_sql = f'''create table {dbname}.{stb}( + ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, + {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, + {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp, + {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned, + {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned + ) tags ({INT_TAG} int) + ''' + tdSql.execute(create_stb_sql) + + for i in range(ntbnum): + create_ntb_sql = f'''create table {dbname}.{ntb_pre}{i+1}( + ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, + {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, + {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp, + {TINT_UN_COL} tinyint unsigned, {SINT_UN_COL} smallint unsigned, + {INT_UN_COL} int unsigned, {BINT_UN_COL} bigint unsigned + ) + ''' + tdSql.execute(create_ntb_sql) + + for i in range(ctb_num): + tdSql.execute(f'create table {dbname}.{ctb_pre}{i+1} using {dbname}.{stb} tags ( {i+1} )') + + def __insert_data(self, rows, dbname=DBNAME, ctb_num=20): + data = DataSet() + data.get_order_set(rows) + + tdLog.printNoPrefix("==========step: start inser data into tables now.....") + for i in range(self.rows): + row_data = f''' + {data.int_data[i]}, {data.bint_data[i]}, {data.sint_data[i]}, {data.tint_data[i]}, {data.float_data[i]}, {data.double_data[i]}, + {data.bool_data[i]}, '{data.vchar_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {data.utint_data[i]}, + {data.usint_data[i]}, {data.uint_data[i]}, {data.ubint_data[i]} + ''' + neg_row_data = f''' + {-1 * data.int_data[i]}, {-1 * data.bint_data[i]}, {-1 * data.sint_data[i]}, {-1 * data.tint_data[i]}, {-1 * data.float_data[i]}, {-1 * data.double_data[i]}, + {data.bool_data[i]}, '{data.vchar_data[i]}', '{data.nchar_data[i]}', {data.ts_data[i]}, {1 * data.utint_data[i]}, + {1 * data.usint_data[i]}, {1 * data.uint_data[i]}, {1 * data.ubint_data[i]} + ''' + + for j in range(ctb_num): + tdSql.execute( + f"insert into {dbname}.{CTB_PRE}{j + 1} values ( {NOW - i * TIME_STEP}, {row_data} )") + + # tdSql.execute( + # f"insert into {dbname}.{CTB_PRE}2 values ( {NOW - i * int(TIME_STEP * 0.6)}, {neg_row_data} )") + # tdSql.execute( + # f"insert into {dbname}.{CTB_PRE}4 values ( {NOW - i * int(TIME_STEP * 0.8) }, {row_data} )") + tdSql.execute( + f"insert into {dbname}.{NTB_PRE}1 values ( {NOW - i * int(TIME_STEP * 1.2)}, {row_data} )") + + def run(self): + self.rows = 10 + self.cfg_check() + tdSql.prepare(dbname=DBNAME, **{"keep": "1d, 1500m, 26h", "duration":"1h", "vgroups": 10}) + self.__create_tb(dbname=DBNAME) + self.__insert_data(rows=self.rows, dbname=DBNAME) + tdSql.query(f"select count(*) from {DBNAME}.{NTB_PRE}1") + tdSql.execute(f"flush database {DBNAME}") + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/1-insert/time_range_wise.py b/tests/system-test/1-insert/time_range_wise.py index f945bafe3b..e65dded601 100644 --- a/tests/system-test/1-insert/time_range_wise.py +++ b/tests/system-test/1-insert/time_range_wise.py @@ -1,4 +1,5 @@ import datetime +import time from dataclasses import dataclass from typing import List, Any, Tuple @@ -328,11 +329,15 @@ class TDTestCase: tdSql.query("select database()") dbname = tdSql.getData(0,0) tdSql.query("show databases") + for index , value in enumerate(tdSql.cursor.description): + if value[0] == "retention": + r_index = index + break for row in tdSql.queryResult: if row[0] == dbname: - if row[-1] is None: + if row[r_index] is None: continue - if ":" in row[-1]: + if ":" in row[r_index]: sma.rollup_db = True if sma.rollup_db : return False @@ -393,8 +398,6 @@ class TDTestCase: else: tdSql.error(self.__create_sma_index(sma)) - - def __drop_sma_index(self, sma:SMAschema): sql = f"{sma.drop} {sma.drop_flag} {sma.index_name}" return sql @@ -416,8 +419,7 @@ class TDTestCase: self.sma_created_index = list(filter(lambda x: x != sma.index_name, self.sma_created_index)) tdSql.query("show streams") tdSql.checkRows(self.sma_count) - - + time.sleep(1) else: tdSql.error(self.__drop_sma_index(sma)) diff --git a/tests/system-test/2-query/cast.py b/tests/system-test/2-query/cast.py index bdac2b6175..4045b6ad88 100644 --- a/tests/system-test/2-query/cast.py +++ b/tests/system-test/2-query/cast.py @@ -566,8 +566,7 @@ class TDTestCase: if data_ct4_c10[i] is None: tdSql.checkData( i, 0, None ) else: - # time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) - time2str = str(int((datetime.datetime.timestamp(data_ct4_c10[i])-datetime.datetime.timestamp(datetime.datetime.fromtimestamp(0)))*1000)) + time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) tdSql.checkData( i, 0, time2str ) tdSql.query(f"select cast(c10 as nchar(32)) as b from {self.dbname}.t1") for i in range(len(data_t1_c10)): @@ -576,8 +575,7 @@ class TDTestCase: elif i == 10: continue else: - # time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) - time2str = str(int((datetime.datetime.timestamp(data_t1_c10[i])-datetime.datetime.timestamp(datetime.datetime.fromtimestamp(0)))*1000)) + time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) tdSql.checkData( i, 0, time2str ) tdLog.printNoPrefix("==========step38: cast timestamp to binary, expect no changes ") @@ -586,8 +584,7 @@ class TDTestCase: if data_ct4_c10[i] is None: tdSql.checkData( i, 0, None ) else: - # time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) - time2str = str(int((datetime.datetime.timestamp(data_ct4_c10[i])-datetime.datetime.timestamp(datetime.datetime.fromtimestamp(0)))*1000)) + time2str = str(int((data_ct4_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) tdSql.checkData( i, 0, time2str ) tdSql.query(f"select cast(c10 as binary(32)) as b from {self.dbname}.t1") for i in range(len(data_t1_c10)): @@ -596,8 +593,7 @@ class TDTestCase: elif i == 10: continue else: - # time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) - time2str = str(int((datetime.datetime.timestamp(data_t1_c10[i])-datetime.datetime.timestamp(datetime.datetime.fromtimestamp(0)))*1000)) + time2str = str(int((data_t1_c10[i]-datetime.datetime.fromtimestamp(0)).total_seconds()*1000)) tdSql.checkData( i, 0, time2str ) tdLog.printNoPrefix("==========step39: cast constant operation to bigint, expect change to int ") diff --git a/tests/system-test/2-query/concat.py b/tests/system-test/2-query/concat.py index 59fae9b59d..23b964012a 100644 --- a/tests/system-test/2-query/concat.py +++ b/tests/system-test/2-query/concat.py @@ -136,23 +136,23 @@ class TDTestCase: return sqls - def __test_current(self): # sourcery skip: use-itertools-product + def __test_current(self, dbname="db"): # sourcery skip: use-itertools-product tdLog.printNoPrefix("==========current sql condition check , must return query ok==========") tbname = [ - "ct1", - "ct2", - "ct4", + f"{dbname}.ct1", + f"{dbname}.ct2", + f"{dbname}.ct4", ] for tb in tbname: for i in range(2,8): self.__concat_check(tb,i) tdLog.printNoPrefix(f"==========current sql condition check in {tb}, col num: {i} over==========") - def __test_error(self): + def __test_error(self, dbname="db"): tdLog.printNoPrefix("==========err sql condition check , must return error==========") tbname = [ - "t1", - "stb1", + f"{dbname}.t1", + f"{dbname}.stb1", ] for tb in tbname: @@ -163,22 +163,20 @@ class TDTestCase: tdLog.printNoPrefix(f"==========err sql condition check in {tb} over==========") - def all_test(self): - self.__test_current() - self.__test_error() + def all_test(self, dbname="db"): + self.__test_current(dbname) + self.__test_error(dbname) - - def __create_tb(self): - tdSql.prepare() + def __create_tb(self, dbname="db"): tdLog.printNoPrefix("==========step1:create table") - create_stb_sql = f'''create table stb1( + create_stb_sql = f'''create table {dbname}.stb1( ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp ) tags (t1 int) ''' - create_ntb_sql = f'''create table t1( + create_ntb_sql = f'''create table {dbname}.t1( ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp @@ -188,29 +186,29 @@ class TDTestCase: tdSql.execute(create_ntb_sql) for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )') - def __insert_data(self, rows): + def __insert_data(self, rows, dbname="db"): now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) for i in range(rows): tdSql.execute( - f"insert into ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f"insert into ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f"insert into ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f'''insert into ct1 values + f'''insert into {dbname}.ct1 values ( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar_测试_0', { now_time + 8 } ) ( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar_测试_9', { now_time + 9 } ) ''' ) tdSql.execute( - f'''insert into ct4 values + f'''insert into {dbname}.ct4 values ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -226,7 +224,7 @@ class TDTestCase: ) tdSql.execute( - f'''insert into ct2 values + f'''insert into {dbname}.ct2 values ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -242,13 +240,13 @@ class TDTestCase: ) for i in range(rows): - insert_data = f'''insert into t1 values + insert_data = f'''insert into {dbname}.t1 values ( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}, "binary_{i}", "nchar_测试_{i}", { now_time - 1000 * i } ) ''' tdSql.execute(insert_data) tdSql.execute( - f'''insert into t1 values + f'''insert into {dbname}.t1 values ( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -268,22 +266,23 @@ class TDTestCase: tdSql.prepare() tdLog.printNoPrefix("==========step1:create table") - self.__create_tb() + self.__create_tb(dbname="db") tdLog.printNoPrefix("==========step2:insert data") self.rows = 10 - self.__insert_data(self.rows) + self.__insert_data(self.rows, dbname="db") tdLog.printNoPrefix("==========step3:all check") - self.all_test() + self.all_test(dbname="db") - tdDnodes.stop(1) - tdDnodes.start(1) + # tdDnodes.stop(1) + # tdDnodes.start(1) + tdSql.execute("flush database db") tdSql.execute("use db") tdLog.printNoPrefix("==========step4:after wal, all check again ") - self.all_test() + self.all_test(dbname="db") def stop(self): tdSql.close() diff --git a/tests/system-test/2-query/concat2.py b/tests/system-test/2-query/concat2.py index 717766e7ff..5442220076 100644 --- a/tests/system-test/2-query/concat2.py +++ b/tests/system-test/2-query/concat2.py @@ -137,22 +137,22 @@ class TDTestCase: return sqls - def __test_current(self): # sourcery skip: use-itertools-product + def __test_current(self, dbname="db"): tdLog.printNoPrefix("==========current sql condition check , must return query ok==========") tbname = [ - "t1", - "stb1", + f"{dbname}.t1", + f"{dbname}.stb1", ] for tb in tbname: for i in range(2,8): self.__concat_check(tb,i) tdLog.printNoPrefix(f"==========current sql condition check in {tb}, col num: {i} over==========") - def __test_error(self): + def __test_error(self, dbname="db"): tdLog.printNoPrefix("==========err sql condition check , must return error==========") tbname = [ - "ct1", - "ct4", + f"{dbname}.ct1", + f"{dbname}.ct4", ] for tb in tbname: @@ -163,22 +163,20 @@ class TDTestCase: tdLog.printNoPrefix(f"==========err sql condition check in {tb} over==========") - def all_test(self): - self.__test_current() - self.__test_error() + def all_test(self, dbname="db"): + self.__test_current(dbname) + self.__test_error(dbname) - - def __create_tb(self): - tdSql.prepare() + def __create_tb(self, dbname="db"): tdLog.printNoPrefix("==========step1:create table") - create_stb_sql = f'''create table stb1( + create_stb_sql = f'''create table {dbname}.stb1( ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp ) tags (t1 int) ''' - create_ntb_sql = f'''create table t1( + create_ntb_sql = f'''create table {dbname}.t1( ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp @@ -188,29 +186,29 @@ class TDTestCase: tdSql.execute(create_ntb_sql) for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )') - def __insert_data(self, rows): + def __insert_data(self, rows, dbname="db"): now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) for i in range(rows): tdSql.execute( - f"insert into ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f"insert into ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f"insert into ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f'''insert into ct1 values + f'''insert into {dbname}.ct1 values ( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar_测试_0', { now_time + 8 } ) ( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar_测试_9', { now_time + 9 } ) ''' ) tdSql.execute( - f'''insert into ct4 values + f'''insert into {dbname}.ct4 values ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -226,7 +224,7 @@ class TDTestCase: ) tdSql.execute( - f'''insert into ct2 values + f'''insert into {dbname}.ct2 values ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -242,13 +240,13 @@ class TDTestCase: ) for i in range(rows): - insert_data = f'''insert into t1 values + insert_data = f'''insert into {dbname}.t1 values ( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}, "binary_{i}", "nchar_测试_{i}", { now_time - 1000 * i } ) ''' tdSql.execute(insert_data) tdSql.execute( - f'''insert into t1 values + f'''insert into {dbname}.t1 values ( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -268,23 +266,23 @@ class TDTestCase: tdSql.prepare() tdLog.printNoPrefix("==========step1:create table") - self.__create_tb() + self.__create_tb(dbname="db") tdLog.printNoPrefix("==========step2:insert data") self.rows = 10 - self.__insert_data(self.rows) + self.__insert_data(self.rows, dbname="db") tdLog.printNoPrefix("==========step3:all check") - self.all_test() + self.all_test(dbname="db") - tdDnodes.stop(1) - tdDnodes.start(1) + # tdDnodes.stop(1) + # tdDnodes.start(1) + tdSql.execute("flush database db") tdSql.execute("use db") tdLog.printNoPrefix("==========step4:after wal, all check again ") - self.all_test() - + self.all_test(dbname="db") def stop(self): tdSql.close() tdLog.success(f"{__file__} successfully executed") diff --git a/tests/system-test/2-query/concat_ws.py b/tests/system-test/2-query/concat_ws.py index 2c179b97ce..ad784d92ec 100644 --- a/tests/system-test/2-query/concat_ws.py +++ b/tests/system-test/2-query/concat_ws.py @@ -137,23 +137,23 @@ class TDTestCase: return sqls - def __test_current(self): # sourcery skip: use-itertools-product + def __test_current(self,dbname="db"): # sourcery skip: use-itertools-product tdLog.printNoPrefix("==========current sql condition check , must return query ok==========") tbname = [ - "t1", - "stb1" + f"{dbname}.t1", + f"{dbname}.stb1" ] for tb in tbname: for i in range(2,8): self.__concat_ws_check(tb,i) tdLog.printNoPrefix(f"==========current sql condition check in {tb}, col num: {i} over==========") - def __test_error(self): + def __test_error(self, dbname="db"): tdLog.printNoPrefix("==========err sql condition check , must return error==========") tbname = [ - "ct1", - "ct2", - "ct4", + f"{dbname}.ct1", + f"{dbname}.ct2", + f"{dbname}.ct4", ] for tb in tbname: @@ -164,22 +164,21 @@ class TDTestCase: tdLog.printNoPrefix(f"==========err sql condition check in {tb} over==========") - def all_test(self): - self.__test_current() - self.__test_error() + def all_test(self,dbname="db"): + self.__test_current(dbname) + self.__test_error(dbname) - def __create_tb(self): - tdSql.prepare() + def __create_tb(self, dbname="db"): tdLog.printNoPrefix("==========step1:create table") - create_stb_sql = f'''create table stb1( + create_stb_sql = f'''create table {dbname}.stb1( ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp ) tags (t1 int) ''' - create_ntb_sql = f'''create table t1( + create_ntb_sql = f'''create table {dbname}.t1( ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp @@ -189,29 +188,29 @@ class TDTestCase: tdSql.execute(create_ntb_sql) for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )') - def __insert_data(self, rows): + def __insert_data(self, rows, dbname="db"): now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) for i in range(rows): tdSql.execute( - f"insert into ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f"insert into ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f"insert into ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f'''insert into ct1 values + f'''insert into {dbname}.ct1 values ( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar_测试_0', { now_time + 8 } ) ( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar_测试_9', { now_time + 9 } ) ''' ) tdSql.execute( - f'''insert into ct4 values + f'''insert into {dbname}.ct4 values ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -227,7 +226,7 @@ class TDTestCase: ) tdSql.execute( - f'''insert into ct2 values + f'''insert into {dbname}.ct2 values ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -243,13 +242,13 @@ class TDTestCase: ) for i in range(rows): - insert_data = f'''insert into t1 values + insert_data = f'''insert into {dbname}.t1 values ( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}, "binary_{i}", "nchar_测试_{i}", { now_time - 1000 * i } ) ''' tdSql.execute(insert_data) tdSql.execute( - f'''insert into t1 values + f'''insert into {dbname}.t1 values ( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -269,22 +268,23 @@ class TDTestCase: tdSql.prepare() tdLog.printNoPrefix("==========step1:create table") - self.__create_tb() + self.__create_tb(dbname="db") tdLog.printNoPrefix("==========step2:insert data") self.rows = 10 - self.__insert_data(self.rows) + self.__insert_data(self.rows, dbname="db") tdLog.printNoPrefix("==========step3:all check") - self.all_test() + self.all_test(dbname="db") - tdDnodes.stop(1) - tdDnodes.start(1) + # tdDnodes.stop(1) + # tdDnodes.start(1) + tdSql.execute("flush database db") tdSql.execute("use db") tdLog.printNoPrefix("==========step4:after wal, all check again ") - self.all_test() + self.all_test(dbname="db") def stop(self): tdSql.close() diff --git a/tests/system-test/2-query/concat_ws2.py b/tests/system-test/2-query/concat_ws2.py index 477e5d1b55..caaae6cecb 100644 --- a/tests/system-test/2-query/concat_ws2.py +++ b/tests/system-test/2-query/concat_ws2.py @@ -137,23 +137,23 @@ class TDTestCase: return sqls - def __test_current(self): # sourcery skip: use-itertools-product + def __test_current(self, dbname="db"): # sourcery skip: use-itertools-product tdLog.printNoPrefix("==========current sql condition check , must return query ok==========") tbname = [ - "ct1", - "ct2", - "ct4", + f"{dbname}.ct1", + f"{dbname}.ct2", + f"{dbname}.ct4", ] for tb in tbname: for i in range(2,8): self.__concat_ws_check(tb,i) tdLog.printNoPrefix(f"==========current sql condition check in {tb}, col num: {i} over==========") - def __test_error(self): + def __test_error(self, dbname="db"): tdLog.printNoPrefix("==========err sql condition check , must return error==========") tbname = [ - "t1", - "stb1" + f"{dbname}.t1", + f"{dbname}.stb1" ] for tb in tbname: @@ -164,22 +164,21 @@ class TDTestCase: tdLog.printNoPrefix(f"==========err sql condition check in {tb} over==========") - def all_test(self): - self.__test_current() - self.__test_error() + def all_test(self, dbname="db"): + self.__test_current(dbname="db") + self.__test_error(dbname="db") - def __create_tb(self): - tdSql.prepare() + def __create_tb(self, dbname="db"): tdLog.printNoPrefix("==========step1:create table") - create_stb_sql = f'''create table stb1( + create_stb_sql = f'''create table {dbname}.stb1( ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp ) tags (t1 int) ''' - create_ntb_sql = f'''create table t1( + create_ntb_sql = f'''create table {dbname}.t1( ts timestamp, {INT_COL} int, {BINT_COL} bigint, {SINT_COL} smallint, {TINT_COL} tinyint, {FLOAT_COL} float, {DOUBLE_COL} double, {BOOL_COL} bool, {BINARY_COL} binary(16), {NCHAR_COL} nchar(32), {TS_COL} timestamp @@ -189,29 +188,29 @@ class TDTestCase: tdSql.execute(create_ntb_sql) for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )') - def __insert_data(self, rows): + def __insert_data(self, rows, dbname="db"): now_time = int(datetime.datetime.timestamp(datetime.datetime.now()) * 1000) for i in range(rows): tdSql.execute( - f"insert into ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct1 values ( { now_time - i * 1000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f"insert into ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct4 values ( { now_time - i * 7776000000 }, {i}, {11111 * i}, {111 * i % 32767 }, {11 * i % 127}, {1.11*i}, {1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f"insert into ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" + f"insert into {dbname}.ct2 values ( { now_time - i * 7776000000 }, {-i}, {-11111 * i}, {-111 * i % 32767 }, {-11 * i % 127}, {-1.11*i}, {-1100.0011*i}, {i%2}, 'binary{i}', 'nchar_测试_{i}', { now_time + 1 * i } )" ) tdSql.execute( - f'''insert into ct1 values + f'''insert into {dbname}.ct1 values ( { now_time - rows * 5 }, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar_测试_0', { now_time + 8 } ) ( { now_time + 10000 }, { rows }, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar_测试_9', { now_time + 9 } ) ''' ) tdSql.execute( - f'''insert into ct4 values + f'''insert into {dbname}.ct4 values ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -227,7 +226,7 @@ class TDTestCase: ) tdSql.execute( - f'''insert into ct2 values + f'''insert into {dbname}.ct2 values ( { now_time - rows * 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3888000000 + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time + 7776000000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -243,13 +242,13 @@ class TDTestCase: ) for i in range(rows): - insert_data = f'''insert into t1 values + insert_data = f'''insert into {dbname}.t1 values ( { now_time - i * 3600000 }, {i}, {i * 11111}, { i % 32767 }, { i % 127}, { i * 1.11111 }, { i * 1000.1111 }, { i % 2}, "binary_{i}", "nchar_测试_{i}", { now_time - 1000 * i } ) ''' tdSql.execute(insert_data) tdSql.execute( - f'''insert into t1 values + f'''insert into {dbname}.t1 values ( { now_time + 10800000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - (( rows // 2 ) * 60 + 30) * 60000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( { now_time - rows * 3600000 }, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) @@ -269,22 +268,23 @@ class TDTestCase: tdSql.prepare() tdLog.printNoPrefix("==========step1:create table") - self.__create_tb() + self.__create_tb(dbname="db") tdLog.printNoPrefix("==========step2:insert data") self.rows = 10 - self.__insert_data(self.rows) + self.__insert_data(self.rows, dbname="db") tdLog.printNoPrefix("==========step3:all check") - self.all_test() + self.all_test(dbname="db") - tdDnodes.stop(1) - tdDnodes.start(1) + # tdDnodes.stop(1) + # tdDnodes.start(1) + tdSql.execute("flush database db") tdSql.execute("use db") tdLog.printNoPrefix("==========step4:after wal, all check again ") - self.all_test() + self.all_test(dbname="db") def stop(self): tdSql.close() diff --git a/tests/system-test/2-query/cos.py b/tests/system-test/2-query/cos.py index e0941b9157..ab6814727e 100644 --- a/tests/system-test/2-query/cos.py +++ b/tests/system-test/2-query/cos.py @@ -9,48 +9,48 @@ from util.cases import * class TDTestCase: - updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , - "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, - "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143} + # updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , + # "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, + # "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143} def init(self, conn, powSql): tdLog.debug(f"start to excute {__file__}") tdSql.init(conn.cursor()) - def prepare_datas(self): + def prepare_datas(self, dbname="db"): tdSql.execute( - '''create table stb1 + f'''create table {dbname}.stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t1 int) ''' ) tdSql.execute( - ''' - create table t1 + f''' + create table {dbname}.t1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) ''' ) for i in range(4): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( {i+1} )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( {i+1} )') for i in range(9): tdSql.execute( - f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) tdSql.execute( - f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) - tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") - tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdSql.execute( - f'''insert into t1 values + f'''insert into {dbname}.t1 values ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a ) ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a ) @@ -84,12 +84,17 @@ class TDTestCase: auto_result.append(row_check) check_status = True + print("========",pow_query, origin_query ) for row_index , row in enumerate(pow_result): for col_index , elem in enumerate(row): - if auto_result[row_index][col_index] == None and not (auto_result[row_index][col_index] == None and elem == None): + if auto_result[row_index][col_index] == None and elem: check_status = False - elif auto_result[row_index][col_index] != None and (auto_result[row_index][col_index] - elem > 0.00000001): + elif auto_result[row_index][col_index] != None and ((auto_result[row_index][col_index] != elem) and (str(auto_result[row_index][col_index])[:6] != str(elem)[:6] )): + # elif auto_result[row_index][col_index] != None and (abs(auto_result[row_index][col_index] - elem) > 0.000001): + print("=====") + print(row_index, col_index) + print(auto_result[row_index][col_index], elem, origin_result[row_index][col_index]) check_status = False else: pass @@ -99,68 +104,68 @@ class TDTestCase: else: tdLog.info("cos value check pass , it work as expected ,sql is \"%s\" "%pow_query ) - def test_errors(self): + def test_errors(self, dbname="db"): error_sql_lists = [ - "select cos from t1", - # "select cos(-+--+c1 ) from t1", - # "select +-cos(c1) from t1", - # "select ++-cos(c1) from t1", - # "select ++--cos(c1) from t1", - # "select - -cos(c1)*0 from t1", - # "select cos(tbname+1) from t1 ", - "select cos(123--123)==1 from t1", - "select cos(c1) as 'd1' from t1", - "select cos(c1 ,c2) from t1", - "select cos(c1 ,NULL ) from t1", - "select cos(,) from t1;", - "select cos(cos(c1) ab from t1)", - "select cos(c1 ) as int from t1", - "select cos from stb1", - # "select cos(-+--+c1) from stb1", - # "select +-cos(c1) from stb1", - # "select ++-cos(c1) from stb1", - # "select ++--cos(c1) from stb1", - # "select - -cos(c1)*0 from stb1", - # "select cos(tbname+1) from stb1 ", - "select cos(123--123)==1 from stb1", - "select cos(c1) as 'd1' from stb1", - "select cos(c1 ,c2 ) from stb1", - "select cos(c1 ,NULL) from stb1", - "select cos(,) from stb1;", - "select cos(cos(c1) ab from stb1)", - "select cos(c1) as int from stb1" + f"select cos from {dbname}.t1", + # f"select cos(-+--+c1 ) from {dbname}.t1", + # f"select +-cos(c1) from {dbname}.t1", + # f"select ++-cos(c1) from {dbname}.t1", + # f"select ++--cos(c1) from {dbname}.t1", + # f"select - -cos(c1)*0 from {dbname}.t1", + # f"select cos(tbname+1) from {dbname}.t1 ", + f"select cos(123--123)==1 from {dbname}.t1", + f"select cos(c1) as 'd1' from {dbname}.t1", + f"select cos(c1 ,c2) from {dbname}.t1", + f"select cos(c1 ,NULL ) from {dbname}.t1", + f"select cos(,) from {dbname}.t1;", + f"select cos(cos(c1) ab from {dbname}.t1)", + f"select cos(c1 ) as int from {dbname}.t1", + f"select cos from {dbname}.stb1", + # f"select cos(-+--+c1) from {dbname}.stb1", + # f"select +-cos(c1) from {dbname}.stb1", + # f"select ++-cos(c1) from {dbname}.stb1", + # f"select ++--cos(c1) from {dbname}.stb1", + # f"select - -cos(c1)*0 from {dbname}.stb1", + # f"select cos(tbname+1) from {dbname}.stb1 ", + f"select cos(123--123)==1 from {dbname}.stb1", + f"select cos(c1) as 'd1' from {dbname}.stb1", + f"select cos(c1 ,c2 ) from {dbname}.stb1", + f"select cos(c1 ,NULL) from {dbname}.stb1", + f"select cos(,) from {dbname}.stb1;", + f"select cos(cos(c1) ab from {dbname}.stb1)", + f"select cos(c1) as int from {dbname}.stb1" ] for error_sql in error_sql_lists: tdSql.error(error_sql) - def support_types(self): + def support_types(self, dbname="db"): type_error_sql_lists = [ - "select cos(ts) from t1" , - "select cos(c7) from t1", - "select cos(c8) from t1", - "select cos(c9) from t1", - "select cos(ts) from ct1" , - "select cos(c7) from ct1", - "select cos(c8) from ct1", - "select cos(c9) from ct1", - "select cos(ts) from ct3" , - "select cos(c7) from ct3", - "select cos(c8) from ct3", - "select cos(c9) from ct3", - "select cos(ts) from ct4" , - "select cos(c7) from ct4", - "select cos(c8) from ct4", - "select cos(c9) from ct4", - "select cos(ts) from stb1" , - "select cos(c7) from stb1", - "select cos(c8) from stb1", - "select cos(c9) from stb1" , + f"select cos(ts) from {dbname}.t1" , + f"select cos(c7) from {dbname}.t1", + f"select cos(c8) from {dbname}.t1", + f"select cos(c9) from {dbname}.t1", + f"select cos(ts) from {dbname}.ct1" , + f"select cos(c7) from {dbname}.ct1", + f"select cos(c8) from {dbname}.ct1", + f"select cos(c9) from {dbname}.ct1", + f"select cos(ts) from {dbname}.ct3" , + f"select cos(c7) from {dbname}.ct3", + f"select cos(c8) from {dbname}.ct3", + f"select cos(c9) from {dbname}.ct3", + f"select cos(ts) from {dbname}.ct4" , + f"select cos(c7) from {dbname}.ct4", + f"select cos(c8) from {dbname}.ct4", + f"select cos(c9) from {dbname}.ct4", + f"select cos(ts) from {dbname}.stb1" , + f"select cos(c7) from {dbname}.stb1", + f"select cos(c8) from {dbname}.stb1", + f"select cos(c9) from {dbname}.stb1" , - "select cos(ts) from stbbb1" , - "select cos(c7) from stbbb1", + f"select cos(ts) from {dbname}.stbbb1" , + f"select cos(c7) from {dbname}.stbbb1", - "select cos(ts) from tbname", - "select cos(c9) from tbname" + f"select cos(ts) from {dbname}.tbname", + f"select cos(c9) from {dbname}.tbname" ] @@ -169,103 +174,103 @@ class TDTestCase: type_sql_lists = [ - "select cos(c1) from t1", - "select cos(c2) from t1", - "select cos(c3) from t1", - "select cos(c4) from t1", - "select cos(c5) from t1", - "select cos(c6) from t1", + f"select cos(c1) from {dbname}.t1", + f"select cos(c2) from {dbname}.t1", + f"select cos(c3) from {dbname}.t1", + f"select cos(c4) from {dbname}.t1", + f"select cos(c5) from {dbname}.t1", + f"select cos(c6) from {dbname}.t1", - "select cos(c1) from ct1", - "select cos(c2) from ct1", - "select cos(c3) from ct1", - "select cos(c4) from ct1", - "select cos(c5) from ct1", - "select cos(c6) from ct1", + f"select cos(c1) from {dbname}.ct1", + f"select cos(c2) from {dbname}.ct1", + f"select cos(c3) from {dbname}.ct1", + f"select cos(c4) from {dbname}.ct1", + f"select cos(c5) from {dbname}.ct1", + f"select cos(c6) from {dbname}.ct1", - "select cos(c1) from ct3", - "select cos(c2) from ct3", - "select cos(c3) from ct3", - "select cos(c4) from ct3", - "select cos(c5) from ct3", - "select cos(c6) from ct3", + f"select cos(c1) from {dbname}.ct3", + f"select cos(c2) from {dbname}.ct3", + f"select cos(c3) from {dbname}.ct3", + f"select cos(c4) from {dbname}.ct3", + f"select cos(c5) from {dbname}.ct3", + f"select cos(c6) from {dbname}.ct3", - "select cos(c1) from stb1", - "select cos(c2) from stb1", - "select cos(c3) from stb1", - "select cos(c4) from stb1", - "select cos(c5) from stb1", - "select cos(c6) from stb1", + f"select cos(c1) from {dbname}.stb1", + f"select cos(c2) from {dbname}.stb1", + f"select cos(c3) from {dbname}.stb1", + f"select cos(c4) from {dbname}.stb1", + f"select cos(c5) from {dbname}.stb1", + f"select cos(c6) from {dbname}.stb1", - "select cos(c6) as alisb from stb1", - "select cos(c6) alisb from stb1", + f"select cos(c6) as alisb from {dbname}.stb1", + f"select cos(c6) alisb from {dbname}.stb1", ] for type_sql in type_sql_lists: tdSql.query(type_sql) - def basic_cosin_function(self): + def basic_cos_function(self, dbname="db"): # basic query - tdSql.query("select c1 from ct3") + tdSql.query(f"select c1 from {dbname}.ct3") tdSql.checkRows(0) - tdSql.query("select c1 from t1") + tdSql.query(f"select c1 from {dbname}.t1") tdSql.checkRows(12) - tdSql.query("select c1 from stb1") + tdSql.query(f"select c1 from {dbname}.stb1") tdSql.checkRows(25) # used for empty table , ct3 is empty - tdSql.query("select cos(c1) from ct3") + tdSql.query(f"select cos(c1) from {dbname}.ct3") tdSql.checkRows(0) - tdSql.query("select cos(c2) from ct3") + tdSql.query(f"select cos(c2) from {dbname}.ct3") tdSql.checkRows(0) - tdSql.query("select cos(c3) from ct3") + tdSql.query(f"select cos(c3) from {dbname}.ct3") tdSql.checkRows(0) - tdSql.query("select cos(c4) from ct3") + tdSql.query(f"select cos(c4) from {dbname}.ct3") tdSql.checkRows(0) - tdSql.query("select cos(c5) from ct3") + tdSql.query(f"select cos(c5) from {dbname}.ct3") tdSql.checkRows(0) - tdSql.query("select cos(c6) from ct3") + tdSql.query(f"select cos(c6) from {dbname}.ct3") tdSql.checkRows(0) # # used for regular table - tdSql.query("select cos(c1) from t1") + tdSql.query(f"select cos(c1) from {dbname}.t1") tdSql.checkData(0, 0, None) tdSql.checkData(1 , 0, 0.540302306) tdSql.checkData(3 , 0, -0.989992497) tdSql.checkData(5 , 0, None) - tdSql.query("select c1, c2, c3 , c4, c5 from t1") + tdSql.query(f"select c1, c2, c3 , c4, c5 from {dbname}.t1") tdSql.checkData(1, 4, 1.11000) tdSql.checkData(3, 3, 33) tdSql.checkData(5, 4, None) - tdSql.query("select ts,c1, c2, c3 , c4, c5 from t1") + tdSql.query(f"select ts,c1, c2, c3 , c4, c5 from {dbname}.t1") tdSql.checkData(1, 5, 1.11000) tdSql.checkData(3, 4, 33) tdSql.checkData(5, 5, None) - self.check_result_auto_cos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from t1", "select cos(abs(c1)), cos(abs(c2)) ,cos(abs(c3)), cos(abs(c4)), cos(abs(c5)) from t1") + self.check_result_auto_cos( f"select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from {dbname}.t1", f"select cos(abs(c1)), cos(abs(c2)) ,cos(abs(c3)), cos(abs(c4)), cos(abs(c5)) from {dbname}.t1") # used for sub table - tdSql.query("select c2 ,cos(c2) from ct1") + tdSql.query(f"select c2 ,cos(c2) from {dbname}.ct1") tdSql.checkData(0, 1, 0.975339851) tdSql.checkData(1 , 1, -0.830564903) tdSql.checkData(3 , 1, 0.602244939) tdSql.checkData(4 , 1, 1.000000000) - tdSql.query("select c1, c5 ,cos(c5) from ct4") + tdSql.query(f"select c1, c5 ,cos(c5) from {dbname}.ct4") tdSql.checkData(0 , 2, None) tdSql.checkData(1 , 2, -0.855242438) tdSql.checkData(2 , 2, 0.083882969) tdSql.checkData(3 , 2, 0.929841474) tdSql.checkData(5 , 2, None) - self.check_result_auto_cos( "select c1, c2, c3 , c4, c5 from ct1", "select cos(c1), cos(c2) ,cos(c3), cos(c4), cos(c5) from ct1") + self.check_result_auto_cos( f"select c1, c2, c3 , c4, c5 from {dbname}.ct1", f"select cos(c1), cos(c2) ,cos(c3), cos(c4), cos(c5) from {dbname}.ct1") # nest query for cos functions - tdSql.query("select c4 , cos(c4) ,cos(cos(c4)) , cos(cos(cos(c4))) from ct1;") + tdSql.query(f"select c4 , cos(c4) ,cos(cos(c4)) , cos(cos(cos(c4))) from {dbname}.ct1;") tdSql.checkData(0 , 0 , 88) tdSql.checkData(0 , 1 , 0.999373284) tdSql.checkData(0 , 2 , 0.540829563) @@ -283,22 +288,22 @@ class TDTestCase: # used for stable table - tdSql.query("select cos(c1) from stb1") + tdSql.query(f"select cos(c1) from {dbname}.stb1") tdSql.checkRows(25) # used for not exists table - tdSql.error("select cos(c1) from stbbb1") - tdSql.error("select cos(c1) from tbname") - tdSql.error("select cos(c1) from ct5") + tdSql.error(f"select cos(c1) from {dbname}.stbbb1") + tdSql.error(f"select cos(c1) from {dbname}.tbname") + tdSql.error(f"select cos(c1) from {dbname}.ct5") # mix with common col - tdSql.query("select c1, cos(c1) from ct1") - tdSql.query("select c2, cos(c2) from ct4") + tdSql.query(f"select c1, cos(c1) from {dbname}.ct1") + tdSql.query(f"select c2, cos(c2) from {dbname}.ct4") # mix with common functions - tdSql.query("select c1, cos(c1),cos(c1), cos(cos(c1)) from ct4 ") + tdSql.query(f"select c1, cos(c1),cos(c1), cos(cos(c1)) from {dbname}.ct4 ") tdSql.checkData(0 , 0 ,None) tdSql.checkData(0 , 1 ,None) tdSql.checkData(0 , 2 ,None) @@ -309,24 +314,24 @@ class TDTestCase: tdSql.checkData(3 , 2 ,0.960170287) tdSql.checkData(3 , 3 ,0.573380480) - tdSql.query("select c1, cos(c1),c5, floor(c5) from stb1 ") + tdSql.query(f"select c1, cos(c1),c5, floor(c5) from {dbname}.stb1 ") # # mix with agg functions , not support - tdSql.error("select c1, cos(c1),c5, count(c5) from stb1 ") - tdSql.error("select c1, cos(c1),c5, count(c5) from ct1 ") - tdSql.error("select cos(c1), count(c5) from stb1 ") - tdSql.error("select cos(c1), count(c5) from ct1 ") - tdSql.error("select c1, count(c5) from ct1 ") - tdSql.error("select c1, count(c5) from stb1 ") + tdSql.error(f"select c1, cos(c1),c5, count(c5) from {dbname}.stb1 ") + tdSql.error(f"select c1, cos(c1),c5, count(c5) from {dbname}.ct1 ") + tdSql.error(f"select cos(c1), count(c5) from {dbname}.stb1 ") + tdSql.error(f"select cos(c1), count(c5) from {dbname}.ct1 ") + tdSql.error(f"select c1, count(c5) from {dbname}.ct1 ") + tdSql.error(f"select c1, count(c5) from {dbname}.stb1 ") # agg functions mix with agg functions - tdSql.query("select max(c5), count(c5) from stb1") - tdSql.query("select max(c5), count(c5) from ct1") + tdSql.query(f"select max(c5), count(c5) from {dbname}.stb1") + tdSql.query(f"select max(c5), count(c5) from {dbname}.ct1") # # bug fix for compute - tdSql.query("select c1, cos(c1) -0 ,cos(c1-4)-0 from ct4 ") + tdSql.query(f"select c1, cos(c1) -0 ,cos(c1-4)-0 from {dbname}.ct4 ") tdSql.checkData(0, 0, None) tdSql.checkData(0, 1, None) tdSql.checkData(0, 2, None) @@ -334,43 +339,42 @@ class TDTestCase: tdSql.checkData(1, 1, -0.145500034) tdSql.checkData(1, 2, -0.653643621) - tdSql.query(" select c1, cos(c1) -0 ,cos(c1-0.1)-0.1 from ct4") + tdSql.query(f" select c1, cos(c1) -0 ,cos(c1-0.1)-0.1 from {dbname}.ct4") tdSql.checkData(0, 0, None) tdSql.checkData(0, 1, None) tdSql.checkData(0, 2, None) tdSql.checkData(1, 0, 8) tdSql.checkData(1, 1, -0.145500034) tdSql.checkData(1, 2, -0.146002126) + tdSql.query(f"select c1, cos(c1), c2, cos(c2), c3, cos(c3) from {dbname}.ct1") - tdSql.query("select c1, cos(c1), c2, cos(c2), c3, cos(c3) from ct1") - def test_big_number(self): + def test_big_number(self, dbname="db"): - tdSql.query("select c1, cos(100000000) from ct1") # bigint to double data overflow + tdSql.query(f"select c1, cos(100000000) from {dbname}.ct1") # bigint to double data overflow tdSql.checkData(4, 1, math.cos(100000000)) - - tdSql.query("select c1, cos(10000000000000) from ct1") # bigint to double data overflow + tdSql.query(f"select c1, cos(10000000000000) from {dbname}.ct1") # bigint to double data overflow tdSql.checkData(4, 1, math.cos(10000000000000)) - tdSql.query("select c1, cos(10000000000000000000000000) from ct1") # bigint to double data overflow - tdSql.query("select c1, cos(10000000000000000000000000.0) from ct1") # 10000000000000000000000000.0 is a double value + tdSql.query(f"select c1, cos(10000000000000000000000000) from {dbname}.ct1") # bigint to double data overflow + tdSql.query(f"select c1, cos(10000000000000000000000000.0) from {dbname}.ct1") # 10000000000000000000000000.0 is a double value tdSql.checkData(1, 1, math.cos(10000000000000000000000000.0)) - tdSql.query("select c1, cos(10000000000000000000000000000000000) from ct1") # bigint to double data overflow - tdSql.query("select c1, cos(10000000000000000000000000000000000.0) from ct1") # 10000000000000000000000000.0 is a double value + tdSql.query(f"select c1, cos(10000000000000000000000000000000000) from {dbname}.ct1") # bigint to double data overflow + tdSql.query(f"select c1, cos(10000000000000000000000000000000000.0) from {dbname}.ct1") # 10000000000000000000000000.0 is a double value tdSql.checkData(4, 1, math.cos(10000000000000000000000000000000000.0)) - tdSql.query("select c1, cos(10000000000000000000000000000000000000000) from ct1") # bigint to double data overflow - tdSql.query("select c1, cos(10000000000000000000000000000000000000000.0) from ct1") # 10000000000000000000000000.0 is a double value + tdSql.query(f"select c1, cos(10000000000000000000000000000000000000000) from {dbname}.ct1") # bigint to double data overflow + tdSql.query(f"select c1, cos(10000000000000000000000000000000000000000.0) from {dbname}.ct1") # 10000000000000000000000000.0 is a double value tdSql.checkData(4, 1, math.cos(10000000000000000000000000000000000000000.0)) - tdSql.query("select c1, cos(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) from ct1") # bigint to double data overflow + tdSql.query(f"select c1, cos(10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) from {dbname}.ct1") # bigint to double data overflow - def abs_func_filter(self): - tdSql.execute("use db") - tdSql.query("select c1, abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(cos(c1)-0.5) from ct4 where c1>5 ") + def abs_func_filter(self, dbname="db"): + tdSql.execute(f"use {dbname}") + tdSql.query(f"select c1, abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(cos(c1)-0.5) from {dbname}.ct4 where c1>5 ") tdSql.checkRows(3) tdSql.checkData(0,0,8) tdSql.checkData(0,1,8.000000000) @@ -378,7 +382,7 @@ class TDTestCase: tdSql.checkData(0,3,7.900000000) tdSql.checkData(0,4,0.000000000) - tdSql.query("select c1, abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(cos(c1)-0.5) from ct4 where c1=5 ") + tdSql.query(f"select c1, abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(cos(c1)-0.5) from {dbname}.ct4 where c1=5 ") tdSql.checkRows(1) tdSql.checkData(0,0,5) tdSql.checkData(0,1,5.000000000) @@ -386,7 +390,7 @@ class TDTestCase: tdSql.checkData(0,3,4.900000000) tdSql.checkData(0,4,0.000000000) - tdSql.query("select c1,c2 , abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(cos(c1)-0.5) from ct4 where c1>cos(c1) limit 1 ") + tdSql.query(f"select c1,c2 , abs(c1) -0 ,ceil(c1-0.1)-0 ,floor(c1+0.1)-0.1 ,ceil(cos(c1)-0.5) from {dbname}.ct4 where c1>cos(c1) limit 1 ") tdSql.checkRows(1) tdSql.checkData(0,0,8) tdSql.checkData(0,1,88888) @@ -395,44 +399,38 @@ class TDTestCase: tdSql.checkData(0,4,7.900000000) tdSql.checkData(0,5,0.000000000) - def pow_Arithmetic(self): - pass - - def check_boundary_values(self): + def check_boundary_values(self, dbname="bound_test"): PI=3.1415926 - tdSql.execute("drop database if exists bound_test") - tdSql.execute("create database if not exists bound_test") + tdSql.execute(f"drop database if exists {dbname}") + tdSql.execute(f"create database if not exists {dbname}") time.sleep(3) - tdSql.execute("use bound_test") + tdSql.execute(f"use {dbname}") tdSql.execute( - "create table stb_bound (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(32),c9 nchar(32), c10 timestamp) tags (t1 int);" + f"create table {dbname}.stb_bound (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(32),c9 nchar(32), c10 timestamp) tags (t1 int);" ) - tdSql.execute(f'create table sub1_bound using stb_bound tags ( 1 )') + tdSql.execute(f'create table {dbname}.sub1_bound using {dbname}.stb_bound tags ( 1 )') tdSql.execute( - f"insert into sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" + f"insert into {dbname}.sub1_bound values ( now()-1s, 2147483647, 9223372036854775807, 32767, 127, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" ) tdSql.execute( - f"insert into sub1_bound values ( now()-1s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" + f"insert into {dbname}.sub1_bound values ( now()-1s, -2147483647, -9223372036854775807, -32767, -127, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" ) tdSql.execute( - f"insert into sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" + f"insert into {dbname}.sub1_bound values ( now(), 2147483646, 9223372036854775806, 32766, 126, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" ) tdSql.execute( - f"insert into sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" + f"insert into {dbname}.sub1_bound values ( now(), -2147483646, -9223372036854775806, -32766, -126, -3.40E+38, -1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" ) - tdSql.error( - f"insert into sub1_bound values ( now()+1s, 2147483648, 9223372036854775808, 32768, 128, 3.40E+38, 1.7e+308, True, 'binary_tb1', 'nchar_tb1', now() )" - ) - self.check_result_auto_cos( "select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from sub1_bound ", "select cos(abs(c1)), cos(abs(c2)) ,cos(abs(c3)), cos(abs(c4)), cos(abs(c5)) from sub1_bound") + # self.check_result_auto_cos( f"select abs(c1), abs(c2), abs(c3) , abs(c4), abs(c5) from {dbname}.sub1_bound ", f"select cos(abs(c1)), cos(abs(c2)) ,cos(abs(c3)), cos(abs(c4)), cos(abs(c5)) from {dbname}.sub1_bound") - self.check_result_auto_cos( "select c1, c2, c3 , c3, c2 ,c1 from sub1_bound ", "select cos(c1), cos(c2) ,cos(c3), cos(c3), cos(c2) ,cos(c1) from sub1_bound") + self.check_result_auto_cos( f"select c1, c2, c3 , c3, c2 ,c1 from {dbname}.sub1_bound ", f"select cos(c1), cos(c2) ,cos(c3), cos(c3), cos(c2) ,cos(c1) from {dbname}.sub1_bound") - self.check_result_auto_cos("select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from sub1_bound" , "select cos(abs(c1)) from sub1_bound" ) + self.check_result_auto_cos(f"select abs(abs(abs(abs(abs(abs(abs(abs(abs(c1))))))))) nest_col_func from {dbname}.sub1_bound" , f"select cos(abs(c1)) from {dbname}.sub1_bound" ) # check basic elem for table per row - tdSql.query("select cos(abs(c1)) ,cos(abs(c2)) , cos(abs(c3)) , cos(abs(c4)), cos(abs(c5)), cos(abs(c6)) from sub1_bound ") + tdSql.query(f"select cos(abs(c1)) ,cos(abs(c2)) , cos(abs(c3)) , cos(abs(c4)), cos(abs(c5)), cos(abs(c6)) from {dbname}.sub1_bound ") tdSql.checkData(0,0,math.cos(2147483647)) tdSql.checkData(0,1,math.cos(9223372036854775807)) tdSql.checkData(0,2,math.cos(32767)) @@ -450,45 +448,44 @@ class TDTestCase: tdSql.checkData(3,4,math.cos(339999995214436424907732413799364296704.00000)) # check + - * / in functions - tdSql.query("select cos(abs(c1+1)) ,cos(abs(c2)) , cos(abs(c3*1)) , cos(abs(c4/2)), cos(abs(c5))/2, cos(abs(c6)) from sub1_bound ") + tdSql.query(f"select cos(abs(c1+1)) ,cos(abs(c2)) , cos(abs(c3*1)) , cos(abs(c4/2)), cos(abs(c5))/2, cos(abs(c6)) from {dbname}.sub1_bound ") tdSql.checkData(0,0,math.cos(2147483648.000000000)) tdSql.checkData(0,1,math.cos(9223372036854775807)) tdSql.checkData(0,2,math.cos(32767.000000000)) tdSql.checkData(0,3,math.cos(63.500000000)) - tdSql.execute("create stable st (ts timestamp, num1 float, num2 double) tags (t1 int);") - tdSql.execute(f'create table tb1 using st tags (1)') - tdSql.execute(f'create table tb2 using st tags (2)') - tdSql.execute(f'create table tb3 using st tags (3)') - tdSql.execute('insert into tb1 values (now()-40s, {}, {})'.format(PI/2 ,PI/2 )) - tdSql.execute('insert into tb1 values (now()-30s, {}, {})'.format(PI ,PI )) - tdSql.execute('insert into tb1 values (now()-20s, {}, {})'.format(PI*1.5 ,PI*1.5)) - tdSql.execute('insert into tb1 values (now()-10s, {}, {})'.format(PI*2 ,PI*2)) - tdSql.execute('insert into tb1 values (now(), {}, {})'.format(PI*2.5 ,PI*2.5)) + tdSql.execute(f"create stable {dbname}.st (ts timestamp, num1 float, num2 double) tags (t1 int);") + tdSql.execute(f'create table {dbname}.tb1 using {dbname}.st tags (1)') + tdSql.execute(f'create table {dbname}.tb2 using {dbname}.st tags (2)') + tdSql.execute(f'create table {dbname}.tb3 using {dbname}.st tags (3)') + tdSql.execute(f'insert into {dbname}.tb1 values (now()-40s, {PI/2}, {PI/2})') + tdSql.execute(f'insert into {dbname}.tb1 values (now()-30s, {PI}, {PI})') + tdSql.execute(f'insert into {dbname}.tb1 values (now()-20s, {PI*1.5}, {PI*1.5})') + tdSql.execute(f'insert into {dbname}.tb1 values (now()-10s, {PI*2}, {PI*2})') + tdSql.execute(f'insert into {dbname}.tb1 values (now(), {PI*2.5}, {PI*2.5})') - tdSql.execute('insert into tb2 values (now()-40s, {}, {})'.format(PI/2 ,PI/2 )) - tdSql.execute('insert into tb2 values (now()-30s, {}, {})'.format(PI ,PI )) - tdSql.execute('insert into tb2 values (now()-20s, {}, {})'.format(PI*1.5 ,PI*1.5)) - tdSql.execute('insert into tb2 values (now()-10s, {}, {})'.format(PI*2 ,PI*2)) - tdSql.execute('insert into tb2 values (now(), {}, {})'.format(PI*2.5 ,PI*2.5)) + tdSql.execute(f'insert into {dbname}.tb2 values (now()-40s, {PI/2}, {PI/2})') + tdSql.execute(f'insert into {dbname}.tb2 values (now()-30s, {PI}, {PI})') + tdSql.execute(f'insert into {dbname}.tb2 values (now()-20s, {PI*1.5}, {PI*1.5})') + tdSql.execute(f'insert into {dbname}.tb2 values (now()-10s, {PI*2}, {PI*2})') + tdSql.execute(f'insert into {dbname}.tb2 values (now(), {PI*2.5}, {PI*2.5})') for i in range(100): - tdSql.execute('insert into tb3 values (now()+{}s, {}, {})'.format(i,PI*(5+i)/2 ,PI*(5+i)/2)) + tdSql.execute(f'insert into {dbname}.tb3 values (now()+{i}s, {PI*(5+i)/2}, {PI*(5+i)/2})') - self.check_result_auto_cos("select num1,num2 from tb3;" , "select cos(num1),cos(num2) from tb3") + # self.check_result_auto_cos(f"select num1,num2 from {dbname}.tb3;" , f"select cos(num1),cos(num2) from {dbname}.tb3") - def support_super_table_test(self): - tdSql.execute(" use db ") - self.check_result_auto_cos( " select c5 from stb1 order by ts " , "select cos(c5) from stb1 order by ts" ) - self.check_result_auto_cos( " select c5 from stb1 order by tbname " , "select cos(c5) from stb1 order by tbname" ) - self.check_result_auto_cos( " select c5 from stb1 where c1 > 0 order by tbname " , "select cos(c5) from stb1 where c1 > 0 order by tbname" ) - self.check_result_auto_cos( " select c5 from stb1 where c1 > 0 order by tbname " , "select cos(c5) from stb1 where c1 > 0 order by tbname" ) + def support_super_table_test(self, dbname="db"): + tdSql.execute(f" use {dbname} ") + self.check_result_auto_cos( f" select c5 from {dbname}.stb1 order by ts " , f"select cos(c5) from {dbname}.stb1 order by ts" ) + self.check_result_auto_cos( f" select c5 from {dbname}.stb1 order by tbname " , f"select cos(c5) from {dbname}.stb1 order by tbname" ) + self.check_result_auto_cos( f" select c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select cos(c5) from {dbname}.stb1 where c1 > 0 order by tbname" ) + self.check_result_auto_cos( f" select c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select cos(c5) from {dbname}.stb1 where c1 > 0 order by tbname" ) - self.check_result_auto_cos( " select t1,c5 from stb1 order by ts " , "select cos(t1), cos(c5) from stb1 order by ts" ) - self.check_result_auto_cos( " select t1,c5 from stb1 order by tbname " , "select cos(t1) ,cos(c5) from stb1 order by tbname" ) - self.check_result_auto_cos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select cos(t1) ,cos(c5) from stb1 where c1 > 0 order by tbname" ) - self.check_result_auto_cos( " select t1,c5 from stb1 where c1 > 0 order by tbname " , "select cos(t1) , cos(c5) from stb1 where c1 > 0 order by tbname" ) - pass + self.check_result_auto_cos( f" select t1,c5 from {dbname}.stb1 order by ts " , f"select cos(t1), cos(c5) from {dbname}.stb1 order by ts" ) + self.check_result_auto_cos( f" select t1,c5 from {dbname}.stb1 order by tbname " , f"select cos(t1) ,cos(c5) from {dbname}.stb1 order by tbname" ) + self.check_result_auto_cos( f" select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select cos(t1) ,cos(c5) from {dbname}.stb1 where c1 > 0 order by tbname" ) + self.check_result_auto_cos( f" select t1,c5 from {dbname}.stb1 where c1 > 0 order by tbname " , f"select cos(t1) , cos(c5) from {dbname}.stb1 where c1 > 0 order by tbname" ) def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring tdSql.prepare() @@ -507,7 +504,7 @@ class TDTestCase: tdLog.printNoPrefix("==========step4: cos basic query ============") - self.basic_cosin_function() + self.basic_cos_function() tdLog.printNoPrefix("==========step5: big number cos query ============") diff --git a/tests/system-test/2-query/count.py b/tests/system-test/2-query/count.py index e047225c1f..4d2a1cf07c 100644 --- a/tests/system-test/2-query/count.py +++ b/tests/system-test/2-query/count.py @@ -5,13 +5,14 @@ from util.sqlset import * class TDTestCase: def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) - tdSql.init(conn.cursor(),logSql) + tdSql.init(conn.cursor(),False) self.setsql = TDSetSql() self.rowNum = 10 self.ts = 1537146000000 - self.ntbname = 'ntb' - self.stbname = 'stb' + dbname = "db" + self.ntbname = f'{dbname}.ntb' + self.stbname = f'{dbname}.stb' self.column_dict = { 'ts':'timestamp', 'c1':'int', diff --git a/tests/system-test/2-query/count_partition.py b/tests/system-test/2-query/count_partition.py index a25b4c09c1..90a6d9225b 100644 --- a/tests/system-test/2-query/count_partition.py +++ b/tests/system-test/2-query/count_partition.py @@ -11,17 +11,17 @@ class TDTestCase: self.row_nums = 10 self.tb_nums = 10 self.ts = 1537146000000 - - def prepare_datas(self, stb_name , tb_nums , row_nums ): - tdSql.execute(" use db ") - tdSql.execute(f" create stable {stb_name} (ts timestamp , c1 int , c2 bigint , c3 float , c4 double , c5 smallint , c6 tinyint , c7 bool , c8 binary(36) , c9 nchar(36) , uc1 int unsigned,\ + + def prepare_datas(self, stb_name , tb_nums , row_nums, dbname="db" ): + tdSql.execute(f" use {dbname} ") + tdSql.execute(f" create stable {dbname}.{stb_name} (ts timestamp , c1 int , c2 bigint , c3 float , c4 double , c5 smallint , c6 tinyint , c7 bool , c8 binary(36) , c9 nchar(36) , uc1 int unsigned,\ uc2 bigint unsigned ,uc3 smallint unsigned , uc4 tinyint unsigned ) tags(t1 timestamp , t2 int , t3 bigint , t4 float , t5 double , t6 smallint , t7 tinyint , t8 bool , t9 binary(36)\ , t10 nchar(36) , t11 int unsigned , t12 bigint unsigned ,t13 smallint unsigned , t14 tinyint unsigned ) ") - + for i in range(tb_nums): - tbname = f"sub_{stb_name}_{i}" + tbname = f"{dbname}.sub_{stb_name}_{i}" ts = self.ts + i*10000 - tdSql.execute(f"create table {tbname} using {stb_name} tags ({ts} , {i} , {i}*10 ,{i}*1.0,{i}*1.0 , 1 , 2, 'true', 'binary_{i}' ,'nchar_{i}',{i},{i},10,20 )") + tdSql.execute(f"create table {tbname} using {dbname}.{stb_name} tags ({ts} , {i} , {i}*10 ,{i}*1.0,{i}*1.0 , 1 , 2, 'true', 'binary_{i}' ,'nchar_{i}',{i},{i},10,20 )") for row in range(row_nums): ts = self.ts + row*1000 @@ -30,143 +30,144 @@ class TDTestCase: for null in range(5): ts = self.ts + row_nums*1000 + null*1000 tdSql.execute(f"insert into {tbname} values({ts} , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL )") - - def basic_query(self): - tdSql.query("select count(*) from stb") + + def basic_query(self, dbname="db"): + tdSql.query(f"select count(*) from {dbname}.stb") tdSql.checkData(0,0,(self.row_nums + 5 )*self.tb_nums) - tdSql.query("select count(c1) from stb") + tdSql.query(f"select count(c1) from {dbname}.stb") tdSql.checkData(0,0,(self.row_nums )*self.tb_nums) - tdSql.query(" select tbname , count(*) from stb partition by tbname ") + tdSql.query(f"select tbname , count(*) from {dbname}.stb partition by tbname ") tdSql.checkRows(self.tb_nums) - tdSql.query(" select count(c1) from stb group by t1 order by t1 ") + tdSql.query(f"select count(c1) from {dbname}.stb group by t1 order by t1 ") tdSql.checkRows(self.tb_nums) - tdSql.error(" select count(c1) from stb group by c1 order by t1 ") - tdSql.error(" select count(t1) from stb group by c1 order by t1 ") - tdSql.query(" select count(c1) from stb group by tbname order by tbname ") + tdSql.error(f"select count(c1) from {dbname}.stb group by c1 order by t1 ") + tdSql.error(f"select count(t1) from {dbname}.stb group by c1 order by t1 ") + tdSql.query(f"select count(c1) from {dbname}.stb group by tbname order by tbname ") tdSql.checkRows(self.tb_nums) - # bug need fix - # tdSql.query(" select count(t1) from stb group by t2 order by t2 ") + # bug need fix + # tdSql.query(f"select count(t1) from {dbname}.stb group by t2 order by t2 ") # tdSql.checkRows(self.tb_nums) - tdSql.query(" select count(c1) from stb group by c1 order by c1 ") + tdSql.query(f"select count(c1) from {dbname}.stb group by c1 order by c1 ") tdSql.checkRows(self.row_nums+1) - tdSql.query(" select c1 , count(c1) from stb group by c1 order by c1 ") + tdSql.query(f"select c1 , count(c1) from {dbname}.stb group by c1 order by c1 ") tdSql.checkRows(self.row_nums+1) - tdSql.query("select count(c1) from stb group by abs(c1) order by abs(c1)") + tdSql.query(f"select count(c1) from {dbname}.stb group by abs(c1) order by abs(c1)") tdSql.checkRows(self.row_nums+1) - tdSql.query("select abs(c1+c3), count(c1+c3) from stb group by abs(c1+c3) order by abs(c1+c3)") + tdSql.query(f"select abs(c1+c3), count(c1+c3) from {dbname}.stb group by abs(c1+c3) order by abs(c1+c3)") tdSql.checkRows(self.row_nums+1) - tdSql.query("select count(c1+c3)+max(c2) ,abs(c1) from stb group by abs(c1) order by abs(c1)") + tdSql.query(f"select count(c1+c3)+max(c2) ,abs(c1) from {dbname}.stb group by abs(c1) order by abs(c1)") tdSql.checkRows(self.row_nums+1) - tdSql.error("select count(c1+c3)+max(c2) ,abs(c1) ,abs(t1) from stb group by abs(c1) order by abs(t1)+c2") - tdSql.error("select count(c1+c3)+max(c2) ,abs(c1) from stb group by abs(c1) order by abs(c1)+c2") - tdSql.query("select abs(c1+c3)+abs(c2) , count(c1+c3)+count(c2) from stb group by abs(c1+c3)+abs(c2) order by abs(c1+c3)+abs(c2)") + tdSql.error(f"select count(c1+c3)+max(c2) ,abs(c1) ,abs(t1) from {dbname}.stb group by abs(c1) order by abs(t1)+c2") + tdSql.error(f"select count(c1+c3)+max(c2) ,abs(c1) from {dbname}.stb group by abs(c1) order by abs(c1)+c2") + tdSql.query(f"select abs(c1+c3)+abs(c2) , count(c1+c3)+count(c2) from {dbname}.stb group by abs(c1+c3)+abs(c2) order by abs(c1+c3)+abs(c2)") tdSql.checkRows(self.row_nums+1) - tdSql.query("select count(c1) , count(t2) from stb where abs(c1+t2)=1 partition by tbname") + tdSql.query(f"select count(c1) , count(t2) from {dbname}.stb where abs(c1+t2)=1 partition by tbname") tdSql.checkRows(2) - tdSql.query("select count(c1) from stb where abs(c1+t2)=1 partition by tbname") + tdSql.query(f"select count(c1) from {dbname}.stb where abs(c1+t2)=1 partition by tbname") tdSql.checkRows(2) - - tdSql.query("select tbname , count(c1) from stb partition by tbname order by tbname") + + tdSql.query(f"select tbname , count(c1) from {dbname}.stb partition by tbname order by tbname") tdSql.checkRows(self.tb_nums) tdSql.checkData(0,1,self.row_nums) - tdSql.error("select tbname , count(c1) from stb partition by t1 order by t1") - tdSql.error("select tbname , count(t1) from stb partition by t1 order by t1") - tdSql.error("select tbname , count(t1) from stb partition by t2 order by t2") + tdSql.error(f"select tbname , count(c1) from {dbname}.stb partition by t1 order by t1") + tdSql.error(f"select tbname , count(t1) from {dbname}.stb partition by t1 order by t1") + tdSql.error(f"select tbname , count(t1) from {dbname}.stb partition by t2 order by t2") - # # bug need fix - # tdSql.query("select t2 , count(t1) from stb partition by t2 order by t2") + # # bug need fix + # tdSql.query(f"select t2 , count(t1) from {dbname}.stb partition by t2 order by t2") # tdSql.checkRows(self.tb_nums) - tdSql.query("select tbname , count(c1) from stb partition by tbname order by tbname") + tdSql.query(f"select tbname , count(c1) from {dbname}.stb partition by tbname order by tbname") tdSql.checkRows(self.tb_nums) tdSql.checkData(0,1,self.row_nums) - - tdSql.error("select tbname , count(c1) from stb partition by t2 order by t2") - tdSql.query("select c2, count(c1) from stb partition by c2 order by c2 desc") + tdSql.error(f"select tbname , count(c1) from {dbname}.stb partition by t2 order by t2") + + tdSql.query(f"select c2, count(c1) from {dbname}.stb partition by c2 order by c2 desc") tdSql.checkRows(self.tb_nums+1) tdSql.checkData(0,1,self.tb_nums) - tdSql.error("select tbname , count(c1) from stb partition by c1 order by c2") + tdSql.error(f"select tbname , count(c1) from {dbname}.stb partition by c1 order by c2") - tdSql.query("select tbname , abs(t2) from stb partition by c2 order by t2") + tdSql.query(f"select tbname , abs(t2) from {dbname}.stb partition by c2 order by t2") tdSql.checkRows(self.tb_nums*(self.row_nums+5)) - tdSql.query("select count(c1) , count(t2) from stb partition by c2 ") + tdSql.query(f"select count(c1) , count(t2) from {dbname}.stb partition by c2 ") tdSql.checkRows(self.row_nums+1) tdSql.checkData(0,1,self.row_nums) - tdSql.query("select count(c1) , count(t2) ,c2 from stb partition by c2 order by c2") + tdSql.query(f"select count(c1) , count(t2) ,c2 from {dbname}.stb partition by c2 order by c2") tdSql.checkRows(self.row_nums+1) - tdSql.query("select count(c1) , count(t1) ,max(c2) ,tbname from stb partition by tbname order by tbname") + tdSql.query(f"select count(c1) , count(t1) ,max(c2) ,tbname from {dbname}.stb partition by tbname order by tbname") tdSql.checkRows(self.tb_nums) tdSql.checkCols(4) - tdSql.query("select count(c1) , count(t2) ,t1 from stb partition by t1 order by t1") + tdSql.query(f"select count(c1) , count(t2) ,t1 from {dbname}.stb partition by t1 order by t1") tdSql.checkRows(self.tb_nums) tdSql.checkData(0,0,self.row_nums) - # bug need fix - # tdSql.query("select count(c1) , count(t1) ,abs(c1) from stb partition by abs(c1) order by abs(c1)") + # bug need fix + # tdSql.query(f"select count(c1) , count(t1) ,abs(c1) from {dbname}.stb partition by abs(c1) order by abs(c1)") # tdSql.checkRows(self.row_nums+1) - - tdSql.query("select count(ceil(c2)) , count(floor(t2)) ,count(floor(c2)) from stb partition by abs(c2) order by abs(c2)") + + tdSql.query(f"select count(ceil(c2)) , count(floor(t2)) ,count(floor(c2)) from {dbname}.stb partition by abs(c2) order by abs(c2)") tdSql.checkRows(self.row_nums+1) - tdSql.query("select count(ceil(c1-2)) , count(floor(t2+1)) ,max(c2-c1) from stb partition by abs(floor(c1)) order by abs(floor(c1))") + tdSql.query(f"select count(ceil(c1-2)) , count(floor(t2+1)) ,max(c2-c1) from {dbname}.stb partition by abs(floor(c1)) order by abs(floor(c1))") tdSql.checkRows(self.row_nums+1) - - # interval - tdSql.query("select count(c1) from stb interval(2s) sliding(1s)") + + # interval + tdSql.query(f"select count(c1) from {dbname}.stb interval(2s) sliding(1s)") # bug need fix - tdSql.query('select max(c1) from stb where ts>="2022-07-06 16:00:00.000 " and ts < "2022-07-06 17:00:00.000 " interval(50s) sliding(30s) fill(NULL)') + tdSql.query(f'select max(c1) from {dbname}.stb where ts>="2022-07-06 16:00:00.000 " and ts < "2022-07-06 17:00:00.000 " interval(50s) sliding(30s) fill(NULL)') - tdSql.query(" select tbname , count(c1) from stb partition by tbname interval(10s) slimit 5 soffset 1 ") + tdSql.query(f"select tbname , count(c1) from {dbname}.stb partition by tbname interval(10s) slimit 5 soffset 1 ") - tdSql.query("select tbname , count(c1) from stb partition by tbname interval(10s)") + tdSql.query(f"select tbname , count(c1) from {dbname}.stb partition by tbname interval(10s)") - tdSql.query("select tbname , count(c1) from sub_stb_1 partition by tbname interval(10s)") + tdSql.query(f"select tbname , count(c1) from {dbname}.sub_stb_1 partition by tbname interval(10s)") tdSql.checkData(0,0,'sub_stb_1') tdSql.checkData(0,1,self.row_nums) - # tdSql.query(" select tbname , count(c1) from stb partition by tbname order by tbname slimit 5 soffset 0 ") + # tdSql.query(f"select tbname , count(c1) from {dbname}.stb partition by tbname order by tbname slimit 5 soffset 0 ") # tdSql.checkRows(5) - - # tdSql.query(" select tbname , count(c1) from stb partition by tbname order by tbname slimit 5 soffset 1 ") - # tdSql.checkRows(5) - - tdSql.query(" select tbname , count(c1) from sub_stb_1 partition by tbname interval(10s) sliding(5s) ") - - tdSql.query(f'select max(c1) from stb where ts>={self.ts} and ts < {self.ts}+10000 partition by tbname interval(50s) sliding(30s)') - tdSql.query(f'select max(c1) from stb where ts>={self.ts} and ts < {self.ts}+10000 interval(50s) sliding(30s)') - tdSql.query(f'select tbname , count(c1) from stb where ts>={self.ts} and ts < {self.ts}+10000 partition by tbname interval(50s) sliding(30s)') + + # tdSql.query(f"select tbname , count(c1) from {dbname}.stb partition by tbname order by tbname slimit 5 soffset 1 ") + # tdSql.checkRows(5) + + tdSql.query(f"select tbname , count(c1) from {dbname}.sub_stb_1 partition by tbname interval(10s) sliding(5s) ") + + tdSql.query(f'select max(c1) from {dbname}.stb where ts>={self.ts} and ts < {self.ts}+10000 partition by tbname interval(50s) sliding(30s)') + tdSql.query(f'select max(c1) from {dbname}.stb where ts>={self.ts} and ts < {self.ts}+10000 interval(50s) sliding(30s)') + tdSql.query(f'select tbname , count(c1) from {dbname}.stb where ts>={self.ts} and ts < {self.ts}+10000 partition by tbname interval(50s) sliding(30s)') def run(self): tdSql.prepare() self.prepare_datas("stb",self.tb_nums,self.row_nums) self.basic_query() + dbname="db" + + # # coverage case for taosd crash about bug fix + tdSql.query(f"select sum(c1) from {dbname}.stb where t2+10 >1 ") + tdSql.query(f"select count(c1),count(t1) from {dbname}.stb where -t2<1 ") + tdSql.query(f"select tbname ,max(ceil(c1)) from {dbname}.stb group by tbname ") + tdSql.query(f"select avg(abs(c1)) , tbname from {dbname}.stb group by tbname ") + tdSql.query(f"select t1,c1 from {dbname}.stb where abs(t2+c1)=1 ") - # # coverage case for taosd crash about bug fix - tdSql.query(" select sum(c1) from stb where t2+10 >1 ") - tdSql.query(" select count(c1),count(t1) from stb where -t2<1 ") - tdSql.query(" select tbname ,max(ceil(c1)) from stb group by tbname ") - tdSql.query(" select avg(abs(c1)) , tbname from stb group by tbname ") - tdSql.query(" select t1,c1 from stb where abs(t2+c1)=1 ") - def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__) diff --git a/tests/system-test/2-query/db.py b/tests/system-test/2-query/db.py index a4d603bada..f2d85ebf65 100644 --- a/tests/system-test/2-query/db.py +++ b/tests/system-test/2-query/db.py @@ -10,9 +10,6 @@ import random class TDTestCase: - updatecfgDict = {'debugFlag': 143, "cDebugFlag": 143, "uDebugFlag": 143, "rpcDebugFlag": 143, "tmrDebugFlag": 143, - "jniDebugFlag": 143, "simDebugFlag": 143, "dDebugFlag": 143, "dDebugFlag": 143, "vDebugFlag": 143, "mDebugFlag": 143, "qDebugFlag": 143, - "wDebugFlag": 143, "sDebugFlag": 143, "tsdbDebugFlag": 143, "tqDebugFlag": 143, "fsDebugFlag": 143, "udfDebugFlag": 143} def init(self, conn, logSql): tdLog.debug(f"start to excute {__file__}") @@ -26,22 +23,22 @@ class TDTestCase: tdSql.execute("create table dbms.ntb (ts timestamp, c1 int, c2 bigint)") tdSql.execute("create table dbus.ntb (ts timestamp, c1 int, c2 bigint)") tdSql.execute("create table dbns.ntb (ts timestamp, c1 int, c2 bigint)") - + tdSql.execute("insert into dbms.ntb values ('2022-01-01 08:00:00.001', 1, 2)") tdSql.execute("insert into dbms.ntb values ('2022-01-01 08:00:00.002', 3, 4)") - + tdSql.execute("insert into dbus.ntb values ('2022-01-01 08:00:00.000001', 1, 2)") tdSql.execute("insert into dbus.ntb values ('2022-01-01 08:00:00.000002', 3, 4)") - + tdSql.execute("insert into dbns.ntb values ('2022-01-01 08:00:00.000000001', 1, 2)") tdSql.execute("insert into dbns.ntb values ('2022-01-01 08:00:00.000000002', 3, 4)") - + tdSql.query("select count(c1) from dbms.ntb interval(1a)") tdSql.checkRows(2) - + tdSql.query("select count(c1) from dbus.ntb interval(1u)") tdSql.checkRows(2) - + tdSql.query("select count(c1) from dbns.ntb interval(1b)") tdSql.checkRows(2) diff --git a/tests/system-test/2-query/diff.py b/tests/system-test/2-query/diff.py index c6800d9a8a..76d4891a1c 100644 --- a/tests/system-test/2-query/diff.py +++ b/tests/system-test/2-query/diff.py @@ -18,188 +18,117 @@ class TDTestCase: def run(self): tdSql.prepare() + dbname = "db" tdSql.execute( - "create table ntb(ts timestamp,c1 int,c2 double,c3 float)") + f"create table {dbname}.ntb(ts timestamp,c1 int,c2 double,c3 float)") tdSql.execute( - "insert into ntb values(now,1,1.0,10.5)(now+1s,10,-100.0,5.1)(now+10s,-1,15.1,5.0)") + f"insert into {dbname}.ntb values(now,1,1.0,10.5)(now+1s,10,-100.0,5.1)(now+10s,-1,15.1,5.0)") - tdSql.query("select diff(c1,0) from ntb") + tdSql.query(f"select diff(c1,0) from {dbname}.ntb") tdSql.checkRows(2) tdSql.checkData(0, 0, 9) tdSql.checkData(1, 0, -11) - tdSql.query("select diff(c1,1) from ntb") + tdSql.query(f"select diff(c1,1) from {dbname}.ntb") tdSql.checkRows(2) tdSql.checkData(0, 0, 9) tdSql.checkData(1, 0, None) - tdSql.query("select diff(c2,0) from ntb") + tdSql.query(f"select diff(c2,0) from {dbname}.ntb") tdSql.checkRows(2) tdSql.checkData(0, 0, -101) tdSql.checkData(1, 0, 115.1) - tdSql.query("select diff(c2,1) from ntb") + tdSql.query(f"select diff(c2,1) from {dbname}.ntb") tdSql.checkRows(2) tdSql.checkData(0, 0, None) tdSql.checkData(1, 0, 115.1) - tdSql.query("select diff(c3,0) from ntb") + tdSql.query(f"select diff(c3,0) from {dbname}.ntb") tdSql.checkRows(2) tdSql.checkData(0, 0, -5.4) tdSql.checkData(1, 0, -0.1) - tdSql.query("select diff(c3,1) from ntb") + tdSql.query(f"select diff(c3,1) from {dbname}.ntb") tdSql.checkRows(2) tdSql.checkData(0, 0, None) tdSql.checkData(1, 0, None) - tdSql.execute('''create table stb(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + tdSql.execute(f'''create table {dbname}.stb(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))''') - tdSql.execute("create table stb_1 using stb tags('beijing')") + tdSql.execute(f"create table {dbname}.stb_1 using {dbname}.stb tags('beijing')") tdSql.execute( - "insert into stb_1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ', 0, 0, 0, 0)" % (self.ts - 1)) + f"insert into {dbname}.stb_1 values(%d, 0, 0, 0, 0, 0.0, 0.0, False, ' ', ' ', 0, 0, 0, 0)" % (self.ts - 1)) # diff verifacation - tdSql.query("select diff(col1) from stb_1") + tdSql.query(f"select diff(col1) from {dbname}.stb_1") tdSql.checkRows(0) - tdSql.query("select diff(col2) from stb_1") + tdSql.query(f"select diff(col2) from {dbname}.stb_1") tdSql.checkRows(0) - tdSql.query("select diff(col3) from stb_1") + tdSql.query(f"select diff(col3) from {dbname}.stb_1") tdSql.checkRows(0) - tdSql.query("select diff(col4) from stb_1") + tdSql.query(f"select diff(col4) from {dbname}.stb_1") tdSql.checkRows(0) - tdSql.query("select diff(col5) from stb_1") + tdSql.query(f"select diff(col5) from {dbname}.stb_1") tdSql.checkRows(0) - tdSql.query("select diff(col6) from stb_1") + tdSql.query(f"select diff(col6) from {dbname}.stb_1") tdSql.checkRows(0) - tdSql.query("select diff(col7) from stb_1") + tdSql.query(f"select diff(col7) from {dbname}.stb_1") tdSql.checkRows(0) for i in range(self.rowNum): - tdSql.execute("insert into stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + tdSql.execute(f"insert into {dbname}.stb_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" % (self.ts + i, 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.error("select diff(ts) from stb") - tdSql.error("select diff(ts) from stb_1") + tdSql.error(f"select diff(ts) from {dbname}.stb") + tdSql.error(f"select diff(ts) from {dbname}.stb_1") - # tdSql.error("select diff(col7) from stb") + # tdSql.error(f"select diff(col7) from {dbname}.stb") - tdSql.error("select diff(col8) from stb") - tdSql.error("select diff(col8) from stb_1") - tdSql.error("select diff(col9) from stb") - tdSql.error("select diff(col9) from stb_1") - tdSql.error("select diff(col11) from stb_1") - tdSql.error("select diff(col12) from stb_1") - tdSql.error("select diff(col13) from stb_1") - tdSql.error("select diff(col14) from stb_1") + tdSql.error(f"select diff(col8) from {dbname}.stb") + tdSql.error(f"select diff(col8) from {dbname}.stb_1") + tdSql.error(f"select diff(col9) from {dbname}.stb") + tdSql.error(f"select diff(col9) from {dbname}.stb_1") + tdSql.error(f"select diff(col11) from {dbname}.stb_1") + tdSql.error(f"select diff(col12) from {dbname}.stb_1") + tdSql.error(f"select diff(col13) from {dbname}.stb_1") + tdSql.error(f"select diff(col14) from {dbname}.stb_1") + tdSql.query(f"select ts,diff(col1),ts from {dbname}.stb_1") - tdSql.query("select diff(col1) from stb_1") + tdSql.query(f"select diff(col1) from {dbname}.stb_1") tdSql.checkRows(10) - tdSql.query("select diff(col2) from stb_1") + tdSql.query(f"select diff(col2) from {dbname}.stb_1") tdSql.checkRows(10) - tdSql.query("select diff(col3) from stb_1") + tdSql.query(f"select diff(col3) from {dbname}.stb_1") tdSql.checkRows(10) - tdSql.query("select diff(col4) from stb_1") + tdSql.query(f"select diff(col4) from {dbname}.stb_1") tdSql.checkRows(10) - tdSql.query("select diff(col5) from stb_1") + tdSql.query(f"select diff(col5) from {dbname}.stb_1") tdSql.checkRows(10) - tdSql.query("select diff(col6) from stb_1") + tdSql.query(f"select diff(col6) from {dbname}.stb_1") tdSql.checkRows(10) - # check selectivity - tdSql.query("select ts, diff(col1), col2 from stb_1") - tdSql.checkRows(10) - tdSql.checkData(0, 0, "2018-09-17 09:00:00.000") - tdSql.checkData(1, 0, "2018-09-17 09:00:00.001") - tdSql.checkData(2, 0, "2018-09-17 09:00:00.002") - tdSql.checkData(3, 0, "2018-09-17 09:00:00.003") - tdSql.checkData(4, 0, "2018-09-17 09:00:00.004") - tdSql.checkData(5, 0, "2018-09-17 09:00:00.005") - tdSql.checkData(6, 0, "2018-09-17 09:00:00.006") - tdSql.checkData(7, 0, "2018-09-17 09:00:00.007") - tdSql.checkData(8, 0, "2018-09-17 09:00:00.008") - tdSql.checkData(9, 0, "2018-09-17 09:00:00.009") - - tdSql.checkData(0, 1, 1) - tdSql.checkData(1, 1, 1) - tdSql.checkData(2, 1, 1) - tdSql.checkData(3, 1, 1) - tdSql.checkData(4, 1, 1) - tdSql.checkData(5, 1, 1) - tdSql.checkData(6, 1, 1) - tdSql.checkData(7, 1, 1) - tdSql.checkData(8, 1, 1) - tdSql.checkData(9, 1, 1) - - tdSql.checkData(0, 2, 0) - tdSql.checkData(1, 2, 1) - tdSql.checkData(2, 2, 2) - tdSql.checkData(3, 2, 3) - tdSql.checkData(4, 2, 4) - tdSql.checkData(5, 2, 5) - tdSql.checkData(6, 2, 6) - tdSql.checkData(7, 2, 7) - tdSql.checkData(8, 2, 8) - tdSql.checkData(9, 2, 9) - - tdSql.query("select ts, diff(col1), col2 from stb order by ts") - tdSql.checkRows(10) - - tdSql.checkData(0, 0, "2018-09-17 09:00:00.000") - tdSql.checkData(1, 0, "2018-09-17 09:00:00.001") - tdSql.checkData(2, 0, "2018-09-17 09:00:00.002") - tdSql.checkData(3, 0, "2018-09-17 09:00:00.003") - tdSql.checkData(4, 0, "2018-09-17 09:00:00.004") - tdSql.checkData(5, 0, "2018-09-17 09:00:00.005") - tdSql.checkData(6, 0, "2018-09-17 09:00:00.006") - tdSql.checkData(7, 0, "2018-09-17 09:00:00.007") - tdSql.checkData(8, 0, "2018-09-17 09:00:00.008") - tdSql.checkData(9, 0, "2018-09-17 09:00:00.009") - - tdSql.checkData(0, 1, 1) - tdSql.checkData(1, 1, 1) - tdSql.checkData(2, 1, 1) - tdSql.checkData(3, 1, 1) - tdSql.checkData(4, 1, 1) - tdSql.checkData(5, 1, 1) - tdSql.checkData(6, 1, 1) - tdSql.checkData(7, 1, 1) - tdSql.checkData(8, 1, 1) - tdSql.checkData(9, 1, 1) - - tdSql.checkData(0, 2, 0) - tdSql.checkData(1, 2, 1) - tdSql.checkData(2, 2, 2) - tdSql.checkData(3, 2, 3) - tdSql.checkData(4, 2, 4) - tdSql.checkData(5, 2, 5) - tdSql.checkData(6, 2, 6) - tdSql.checkData(7, 2, 7) - tdSql.checkData(8, 2, 8) - tdSql.checkData(9, 2, 9) - - - tdSql.execute('''create table stb1(ts timestamp, col1 tinyint, col2 smallint, col3 int, col4 bigint, col5 float, col6 double, + tdSql.execute(f'''create table {dbname}.stb1(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))''') - tdSql.execute("create table stb1_1 using stb tags('shanghai')") + tdSql.execute(f"create table {dbname}.stb1_1 using {dbname}.stb tags('shanghai')") for i in range(self.rowNum): - tdSql.execute("insert into stb1_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + tdSql.execute(f"insert into {dbname}.stb1_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" % (self.ts + i, 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)) for i in range(self.rowNum): - tdSql.execute("insert into stb1_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" + tdSql.execute(f"insert into {dbname}.stb1_1 values(%d, %d, %d, %d, %d, %f, %f, %d, 'taosdata%d', '涛思数据%d', %d, %d, %d, %d)" % (self.ts - i-1, 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.query("select diff(col1,0) from stb1_1") + tdSql.query(f"select diff(col1,0) from {dbname}.stb1_1") tdSql.checkRows(19) - tdSql.query("select diff(col1,1) from stb1_1") + tdSql.query(f"select diff(col1,1) from {dbname}.stb1_1") tdSql.checkRows(19) tdSql.checkData(0,0,None) diff --git a/tests/system-test/2-query/distinct.py b/tests/system-test/2-query/distinct.py index 937ff78c71..7214caec96 100644 --- a/tests/system-test/2-query/distinct.py +++ b/tests/system-test/2-query/distinct.py @@ -16,6 +16,8 @@ class TDTestCase: def run(self): # sourcery skip: extract-duplicate-method, remove-redundant-fstring tdSql.prepare() + dbname = "db" + tdLog.printNoPrefix("==========step1:create table") tdSql.execute("create stable db.stb1 (ts timestamp, c1 int, c2 int) tags(t0 tinyint, t1 int, t2 int)") tdSql.execute("create stable db.stb2 (ts timestamp, c2 int, c3 binary(16)) tags(t2 binary(16), t3 binary(16), t4 int)") @@ -34,223 +36,224 @@ class TDTestCase: tdSql.execute(f"insert into db.t0{i} values (now-9d, {i}, '{(i+2)%3}')") tdSql.execute(f"insert into db.t0{i} values (now-8d, {i}, '{(i)%3}')") tdSql.execute(f"insert into db.t0{i} (ts )values (now-7d)") - # tdSql.execute("create table db.t100num using db.stb1 tags(null, null, null)") - # tdSql.execute("create table db.t0100num using db.stb2 tags(null, null, null)") - # tdSql.execute(f"insert into db.t100num values (now-10d, {tbnum-1}, 1)") - # tdSql.execute(f"insert into db.t100num values (now-9d, {tbnum-1}, 0)") - # tdSql.execute(f"insert into db.t100num values (now-8d, {tbnum-1}, 2)") - # tdSql.execute(f"insert into db.t100num (ts )values (now-7d)") - # tdSql.execute(f"insert into db.t0100num values (now-10d, {tbnum-1}, 1)") - # tdSql.execute(f"insert into db.t0100num values (now-9d, {tbnum-1}, 0)") - # tdSql.execute(f"insert into db.t0100num values (now-8d, {tbnum-1}, 2)") - # tdSql.execute(f"insert into db.t0100num (ts )values (now-7d)") + tdSql.execute("create table db.t100num using db.stb1 tags(null, null, null)") + tdSql.execute("create table db.t0100num using db.stb2 tags(null, null, null)") + tdSql.execute(f"insert into db.t100num values (now-10d, {tbnum-1}, 1)") + tdSql.execute(f"insert into db.t100num values (now-9d, {tbnum-1}, 0)") + tdSql.execute(f"insert into db.t100num values (now-8d, {tbnum-1}, 2)") + tdSql.execute(f"insert into db.t100num (ts )values (now-7d)") + tdSql.execute(f"insert into db.t0100num values (now-10d, {tbnum-1}, 1)") + tdSql.execute(f"insert into db.t0100num values (now-9d, {tbnum-1}, 0)") + tdSql.execute(f"insert into db.t0100num values (now-8d, {tbnum-1}, 2)") + tdSql.execute(f"insert into db.t0100num (ts )values (now-7d)") - #========== distinct multi-data-coloumn ========== - # tdSql.query(f"select distinct c1 from stb1 where c1 <{tbnum}") - # tdSql.checkRows(tbnum) - # tdSql.query(f"select distinct c2 from stb1") - # tdSql.checkRows(4) - # tdSql.query(f"select distinct c1,c2 from stb1 where c1 <{tbnum}") - # tdSql.checkRows(tbnum*3) - # tdSql.query(f"select distinct c1,c1 from stb1 where c1 <{tbnum}") - # tdSql.checkRows(tbnum) - # tdSql.query(f"select distinct c1,c2 from stb1 where c1 <{tbnum} limit 3") - # tdSql.checkRows(3) - # tdSql.query(f"select distinct c1,c2 from stb1 where c1 <{tbnum} limit 3 offset {tbnum*3-2}") - # tdSql.checkRows(2) - - tdSql.query(f"select distinct c1 from t1 where c1 <{tbnum}") - tdSql.checkRows(1) - tdSql.query(f"select distinct c2 from t1") + # #========== distinct multi-data-coloumn ========== + tdSql.query(f"select distinct c1 from {dbname}.stb1 where c1 <{tbnum}") + tdSql.checkRows(tbnum) + tdSql.query(f"select distinct c2 from {dbname}.stb1") tdSql.checkRows(4) - tdSql.query(f"select distinct c1,c2 from t1 where c1 <{tbnum}") + tdSql.query(f"select distinct c1,c2 from {dbname}.stb1 where c1 <{tbnum}") + tdSql.checkRows(tbnum*3) + tdSql.query(f"select distinct c1,c1 from {dbname}.stb1 where c1 <{tbnum}") + tdSql.checkRows(tbnum) + tdSql.query(f"select distinct c1,c2 from {dbname}.stb1 where c1 <{tbnum} limit 3") tdSql.checkRows(3) - tdSql.query(f"select distinct c1,c1 from t1 ") + tdSql.query(f"select distinct c1,c2 from {dbname}.stb1 where c1 <{tbnum} limit 3 offset {tbnum*3-2}") tdSql.checkRows(2) - tdSql.query(f"select distinct c1,c1 from t1 where c1 <{tbnum}") + + tdSql.query(f"select distinct c1 from {dbname}.t1 where c1 <{tbnum}") tdSql.checkRows(1) - tdSql.query(f"select distinct c1,c2 from t1 where c1 <{tbnum} limit 3") + tdSql.query(f"select distinct c2 from {dbname}.t1") + tdSql.checkRows(4) + tdSql.query(f"select distinct c1,c2 from {dbname}.t1 where c1 <{tbnum}") tdSql.checkRows(3) - tdSql.query(f"select distinct c1,c2 from t1 where c1 <{tbnum} limit 3 offset 2") + tdSql.query(f"select distinct c1,c1 from {dbname}.t1 ") + tdSql.checkRows(2) + tdSql.query(f"select distinct c1,c1 from {dbname}.t1 where c1 <{tbnum}") + tdSql.checkRows(1) + tdSql.query(f"select distinct c1,c2 from {dbname}.t1 where c1 <{tbnum} limit 3") + tdSql.checkRows(3) + tdSql.query(f"select distinct c1,c2 from {dbname}.t1 where c1 <{tbnum} limit 3 offset 2") tdSql.checkRows(1) - # tdSql.query(f"select distinct c3 from stb2 where c2 <{tbnum} ") + # tdSql.query(f"select distinct c3 from {dbname}.stb2 where c2 <{tbnum} ") # tdSql.checkRows(3) - # tdSql.query(f"select distinct c3, c2 from stb2 where c2 <{tbnum} limit 2") + # tdSql.query(f"select distinct c3, c2 from {dbname}.stb2 where c2 <{tbnum} limit 2") # tdSql.checkRows(2) - # tdSql.error("select distinct c5 from stb1") - tdSql.error("select distinct c5 from t1") - tdSql.error("select distinct c1 from db.*") - tdSql.error("select c2, distinct c1 from stb1") - tdSql.error("select c2, distinct c1 from t1") - tdSql.error("select distinct c2 from ") - tdSql.error("distinct c2 from stb1") - tdSql.error("distinct c2 from t1") - tdSql.error("select distinct c1, c2, c3 from stb1") - tdSql.error("select distinct c1, c2, c3 from t1") - tdSql.error("select distinct stb1.c1, stb1.c2, stb2.c2, stb2.c3 from stb1") - tdSql.error("select distinct stb1.c1, stb1.c2, stb2.c2, stb2.c3 from t1") - tdSql.error("select distinct t1.c1, t1.c2, t2.c1, t2.c2 from t1") - # tdSql.query(f"select distinct c1 c2, c2 c3 from stb1 where c1 <{tbnum}") - # tdSql.checkRows(tbnum*3) - tdSql.query(f"select distinct c1 c2, c2 c3 from t1 where c1 <{tbnum}") + # tdSql.error(f"select distinct c5 from {dbname}.stb1") + tdSql.error(f"select distinct c5 from {dbname}.t1") + tdSql.error(f"select distinct c1 from db.*") + tdSql.error(f"select c2, distinct c1 from {dbname}.stb1") + tdSql.error(f"select c2, distinct c1 from {dbname}.t1") + tdSql.error(f"select distinct c2 from ") + tdSql.error("distinct c2 from {dbname}.stb1") + tdSql.error("distinct c2 from {dbname}.t1") + tdSql.error(f"select distinct c1, c2, c3 from {dbname}.stb1") + tdSql.error(f"select distinct c1, c2, c3 from {dbname}.t1") + tdSql.error(f"select distinct stb1.c1, stb1.c2, stb2.c2, stb2.c3 from {dbname}.stb1") + tdSql.error(f"select distinct stb1.c1, stb1.c2, stb2.c2, stb2.c3 from {dbname}.t1") + tdSql.error(f"select distinct t1.c1, t1.c2, t2.c1, t2.c2 from {dbname}.t1") + tdSql.query(f"select distinct c1 c2, c2 c3 from {dbname}.stb1 where c1 <{tbnum}") + tdSql.checkRows(tbnum*3) + tdSql.query(f"select distinct c1 c2, c2 c3 from {dbname}.t1 where c1 <{tbnum}") tdSql.checkRows(3) - # tdSql.error("select distinct c1, c2 from stb1 order by ts") - tdSql.error("select distinct c1, c2 from t1 order by ts") - # tdSql.error("select distinct c1, ts from stb1 group by c2") - tdSql.error("select distinct c1, ts from t1 group by c2") - # tdSql.error("select distinct c1, max(c2) from stb1 ") - # tdSql.error("select distinct c1, max(c2) from t1 ") - # tdSql.error("select max(c2), distinct c1 from stb1 ") - tdSql.error("select max(c2), distinct c1 from t1 ") - # tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 group by t0") - tdSql.error("select distinct c1, c2 from t1 where c1 > 3 group by t0") - # tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 interval(1d) ") - tdSql.error("select distinct c1, c2 from t1 where c1 > 3 interval(1d) ") - # tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 interval(1d) fill(next)") - tdSql.error("select distinct c1, c2 from t1 where c1 > 3 interval(1d) fill(next)") - # tdSql.error("select distinct c1, c2 from stb1 where ts > now-10d and ts < now interval(1d) fill(next)") - tdSql.error("select distinct c1, c2 from t1 where ts > now-10d and ts < now interval(1d) fill(next)") - # tdSql.error("select distinct c1, c2 from stb1 where c1 > 3 slimit 1") - # tdSql.error("select distinct c1, c2 from t1 where c1 > 3 slimit 1") - # tdSql.query(f"select distinct c1, c2 from stb1 where c1 between {tbnum-2} and {tbnum} ") - # tdSql.checkRows(6) - tdSql.query(f"select distinct c1, c2 from t1 where c1 between {tbnum-2} and {tbnum} ") + tdSql.error(f"select distinct c1, c2 from {dbname}.stb1 order by ts") + tdSql.error(f"select distinct c1, c2 from {dbname}.t1 order by ts") + tdSql.error(f"select distinct c1, ts from {dbname}.stb1 group by c2") + tdSql.error(f"select distinct c1, ts from {dbname}.t1 group by c2") + tdSql.query(f"select distinct c1, max(c2) from {dbname}.stb1 ") + tdSql.query(f"select distinct c1, max(c2) from {dbname}.t1 ") + tdSql.error(f"select max(c2), distinct c1 from {dbname}.stb1 ") + tdSql.error(f"select max(c2), distinct c1 from {dbname}.t1 ") + tdSql.error(f"select distinct c1, c2 from {dbname}.stb1 where c1 > 3 group by t0") + tdSql.error(f"select distinct c1, c2 from {dbname}.t1 where c1 > 3 group by t0") + tdSql.error(f"select distinct c1, c2 from {dbname}.stb1 where c1 > 3 interval(1d) ") + tdSql.error(f"select distinct c1, c2 from {dbname}.t1 where c1 > 3 interval(1d) ") + tdSql.error(f"select distinct c1, c2 from {dbname}.stb1 where c1 > 3 interval(1d) fill(next)") + tdSql.error(f"select distinct c1, c2 from {dbname}.t1 where c1 > 3 interval(1d) fill(next)") + tdSql.error(f"select distinct c1, c2 from {dbname}.stb1 where ts > now-10d and ts < now interval(1d) fill(next)") + tdSql.error(f"select distinct c1, c2 from {dbname}.t1 where ts > now-10d and ts < now interval(1d) fill(next)") + tdSql.error(f"select distinct c1, c2 from {dbname}.stb1 where c1 > 3 slimit 1") + tdSql.error(f"select distinct c1, c2 from {dbname}.t1 where c1 > 3 slimit 1") + tdSql.query(f"select distinct c1, c2 from {dbname}.stb1 where c1 between {tbnum-2} and {tbnum} ") + tdSql.checkRows(6) + tdSql.query(f"select distinct c1, c2 from {dbname}.t1 where c1 between {tbnum-2} and {tbnum} ") # tdSql.checkRows(1) - # tdSql.query("select distinct c1, c2 from stb1 where c1 in (1,2,3,4,5)") - # tdSql.checkRows(15) - tdSql.query("select distinct c1, c2 from t1 where c1 in (1,2,3,4,5)") + tdSql.query(f"select distinct c1, c2 from {dbname}.stb1 where c1 in (1,2,3,4,5)") + tdSql.checkRows(15) + tdSql.query(f"select distinct c1, c2 from {dbname}.t1 where c1 in (1,2,3,4,5)") # tdSql.checkRows(1) - # tdSql.query("select distinct c1, c2 from stb1 where c1 in (100,1000,10000)") - # tdSql.checkRows(3) - tdSql.query("select distinct c1, c2 from t1 where c1 in (100,1000,10000)") - # tdSql.checkRows(0) + tdSql.query(f"select distinct c1, c2 from {dbname}.stb1 where c1 in (100,1000,10000)") + tdSql.checkRows(3) + tdSql.query(f"select distinct c1, c2 from {dbname}.t1 where c1 in (100,1000,10000)") + tdSql.checkRows(0) - # tdSql.query(f"select distinct c1,c2 from (select * from stb1 where c1 > {tbnum-2}) ") - # tdSql.checkRows(3) - # tdSql.query(f"select distinct c1,c2 from (select * from t1 where c1 < {tbnum}) ") - # tdSql.checkRows(3) - # tdSql.query(f"select distinct c1,c2 from (select * from stb1 where t2 !=0 and t2 != 1) ") - # tdSql.checkRows(0) - # tdSql.error("select distinct c1, c2 from (select distinct c1, c2 from stb1 where t0 > 2 and t1 < 3) ") - # tdSql.error("select c1, c2 from (select distinct c1, c2 from stb1 where t0 > 2 and t1 < 3) ") - # tdSql.query("select distinct c1, c2 from (select c2, c1 from stb1 where c1 > 2 ) where c1 < 4") - # tdSql.checkRows(3) - # tdSql.error("select distinct c1, c2 from (select c1 from stb1 where t0 > 2 ) where t1 < 3") - # tdSql.error("select distinct c1, c2 from (select c2, c1 from stb1 where c1 > 2 order by ts)") - # tdSql.error("select distinct c1, c2 from (select c2, c1 from t1 where c1 > 2 order by ts)") - # tdSql.error("select distinct c1, c2 from (select c2, c1 from stb1 where c1 > 2 group by c1)") - # tdSql.error("select distinct c1, c2 from (select max(c1) c1, max(c2) c2 from stb1 group by c1)") - # tdSql.error("select distinct c1, c2 from (select max(c1) c1, max(c2) c2 from t1 group by c1)") - # tdSql.query("select distinct c1, c2 from (select max(c1) c1, max(c2) c2 from stb1 )") - # tdSql.checkRows(1) - # tdSql.query("select distinct c1, c2 from (select max(c1) c1, max(c2) c2 from t1 )") - # tdSql.checkRows(1) - # tdSql.error("select distinct stb1.c1, stb1.c2 from stb1 , stb2 where stb1.ts=stb2.ts and stb1.t2=stb2.t4") - # tdSql.error("select distinct t1.c1, t1.c2 from t1 , t2 where t1.ts=t2.ts ") + tdSql.query(f"select distinct c1,c2 from (select * from {dbname}.stb1 where c1 > {tbnum-2}) ") + tdSql.checkRows(3) + tdSql.query(f"select distinct c1,c2 from (select * from {dbname}.t1 where c1 < {tbnum}) ") + tdSql.checkRows(3) + tdSql.query(f"select distinct c1,c2 from (select * from {dbname}.stb1 where t2 !=0 and t2 != 1) ") + tdSql.checkRows(0) + tdSql.query(f"select distinct c1, c2 from (select distinct c1, c2 from {dbname}.stb1 where t0 > 2 and t1 < 3) ") + tdSql.query(f"select c1, c2 from (select distinct c1, c2 from {dbname}.stb1 where t0 > 2 and t1 < 3) ") + tdSql.query(f"select distinct c1, c2 from (select c2, c1 from {dbname}.stb1 where c1 > 2 ) where c1 < 4") + tdSql.checkRows(3) + tdSql.error(f"select distinct c1, c2 from (select c1 from {dbname}.stb1 where t0 > 2 ) where t1 < 3") + tdSql.query(f"select distinct c1, c2 from (select c2, c1 from {dbname}.stb1 where c1 > 2 order by ts)") + tdSql.query(f"select distinct c1, c2 from (select c2, c1 from {dbname}.t1 where c1 > 2 order by ts)") + tdSql.error(f"select distinct c1, c2 from (select c2, c1 from {dbname}.stb1 where c1 > 2 group by c1)") + tdSql.query(f"select distinct c1, c2 from (select max(c1) c1, max(c2) c2 from {dbname}.stb1 group by c1)") + tdSql.query(f"select distinct c1, c2 from (select max(c1) c1, max(c2) c2 from {dbname}.t1 group by c1)") + tdSql.query(f"select distinct c1, c2 from (select max(c1) c1, max(c2) c2 from {dbname}.stb1 )") + tdSql.checkRows(1) + tdSql.query(f"select distinct c1, c2 from (select max(c1) c1, max(c2) c2 from {dbname}.t1 )") + tdSql.checkRows(1) + tdSql.query(f"select distinct stb1.c1, stb1.c2 from {dbname}.stb1, {dbname}.stb2 where stb1.ts=stb2.ts and stb1.t2=stb2.t4") + tdSql.query(f"select distinct t1.c1, t1.c2 from {dbname}.t1, {dbname}.t2 where t1.ts=t2.ts ") - # tdSql.error("select distinct c1, c2 from (select count(c1) c1, count(c2) c2 from stb1 group by ts)") - # tdSql.error("select distinct c1, c2 from (select count(c1) c1, count(c2) c2 from t1 group by ts)") + tdSql.query(f"select distinct c1, c2 from (select count(c1) c1, count(c2) c2 from {dbname}.stb1 group by ts)") + tdSql.query(f"select distinct c1, c2 from (select count(c1) c1, count(c2) c2 from {dbname}.t1 group by ts)") - # #========== suport distinct multi-tags-coloumn ========== - # tdSql.query("select distinct t1 from stb1") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t0, t1 from stb1") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t1, t0 from stb1") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t1, t2 from stb1") - # tdSql.checkRows(maxRemainderNum*2+1) - # tdSql.query("select distinct t0, t1, t2 from stb1") - # tdSql.checkRows(maxRemainderNum*2+1) - # tdSql.query("select distinct t0 t1, t1 t2 from stb1") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t0, t0, t0 from stb1") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t0, t1 from t1") - # tdSql.checkRows(1) - # tdSql.query("select distinct t0, t1 from t100num") - # tdSql.checkRows(1) + #========== suport distinct multi-tags-coloumn ========== + tdSql.query(f"select distinct t1 from {dbname}.stb1") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t0, t1 from {dbname}.stb1") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t1, t0 from {dbname}.stb1") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t1, t2 from {dbname}.stb1") + tdSql.checkRows(maxRemainderNum*2+1) + tdSql.query(f"select distinct t0, t1, t2 from {dbname}.stb1") + tdSql.checkRows(maxRemainderNum*2+1) + tdSql.query(f"select distinct t0 t1, t1 t2 from {dbname}.stb1") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t0, t0, t0 from {dbname}.stb1") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t0, t1 from {dbname}.t1") + tdSql.checkRows(1) + tdSql.query(f"select distinct t0, t1 from {dbname}.t100num") + tdSql.checkRows(1) - # tdSql.query("select distinct t3 from stb2") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t2, t3 from stb2") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t3, t2 from stb2") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t4, t2 from stb2") - # tdSql.checkRows(maxRemainderNum*3+1) - # tdSql.query("select distinct t2, t3, t4 from stb2") - # tdSql.checkRows(maxRemainderNum*3+1) - # tdSql.query("select distinct t2 t1, t3 t2 from stb2") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t3, t3, t3 from stb2") - # tdSql.checkRows(maxRemainderNum+1) - # tdSql.query("select distinct t2, t3 from t01") - # tdSql.checkRows(1) - # tdSql.query("select distinct t3, t4 from t0100num") - # tdSql.checkRows(1) + tdSql.query(f"select distinct t3 from {dbname}.stb2") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t2, t3 from {dbname}.stb2") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t3, t2 from {dbname}.stb2") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t4, t2 from {dbname}.stb2") + tdSql.checkRows(maxRemainderNum*3+1) + tdSql.query(f"select distinct t2, t3, t4 from {dbname}.stb2") + tdSql.checkRows(maxRemainderNum*3+1) + tdSql.query(f"select distinct t2 t1, t3 t2 from {dbname}.stb2") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t3, t3, t3 from {dbname}.stb2") + tdSql.checkRows(maxRemainderNum+1) + tdSql.query(f"select distinct t2, t3 from {dbname}.t01") + tdSql.checkRows(1) + tdSql.query(f"select distinct t3, t4 from {dbname}.t0100num") + tdSql.checkRows(1) - # ########## should be error ######### - # tdSql.error("select distinct from stb1") - # tdSql.error("select distinct t3 from stb1") - # tdSql.error("select distinct t1 from db.*") - # tdSql.error("select distinct t2 from ") - # tdSql.error("distinct t2 from stb1") - # tdSql.error("select distinct stb1") - # tdSql.error("select distinct t0, t1, t2, t3 from stb1") - # tdSql.error("select distinct stb1.t0, stb1.t1, stb2.t2, stb2.t3 from stb1") + ########## should be error ######### + tdSql.error(f"select distinct from {dbname}.stb1") + tdSql.error(f"select distinct t3 from {dbname}.stb1") + tdSql.error(f"select distinct t1 from db.*") + tdSql.error(f"select distinct t2 from ") + tdSql.error(f"distinct t2 from {dbname}.stb1") + tdSql.error(f"select distinct stb1") + tdSql.error(f"select distinct t0, t1, t2, t3 from {dbname}.stb1") + tdSql.error(f"select distinct stb1.t0, stb1.t1, stb2.t2, stb2.t3 from {dbname}.stb1") - # tdSql.error("select dist t0 from stb1") - # tdSql.error("select distinct stb2.t2, stb2.t3 from stb1") - # tdSql.error("select distinct stb2.t2 t1, stb2.t3 t2 from stb1") + tdSql.error(f"select dist t0 from {dbname}.stb1") + tdSql.error(f"select distinct stb2.t2, stb2.t3 from {dbname}.stb1") + tdSql.error(f"select distinct stb2.t2 t1, stb2.t3 t2 from {dbname}.stb1") - # tdSql.error("select distinct t0, t1 from t1 where t0 < 7") + tdSql.query(f"select distinct t0, t1 from {dbname}.t1 where t0 < 7") - # ########## add where condition ########## - # tdSql.query("select distinct t0, t1 from stb1 where t1 > 3") - # tdSql.checkRows(3) - # tdSql.query("select distinct t0, t1 from stb1 where t1 > 3 limit 2") - # tdSql.checkRows(2) - # tdSql.query("select distinct t0, t1 from stb1 where t1 > 3 limit 2 offset 2") - # tdSql.checkRows(1) - # tdSql.query("select distinct t0, t1 from stb1 where t1 > 3 slimit 2") - # tdSql.checkRows(3) - # tdSql.error("select distinct t0, t1 from stb1 where c1 > 2") - # tdSql.query("select distinct t0, t1 from stb1 where t1 > 3 and t1 < 5") - # tdSql.checkRows(1) - # tdSql.error("select distinct stb1.t0, stb1.t1 from stb1, stb2 where stb1.t2=stb2.t4") - # tdSql.error("select distinct t0, t1 from stb1 where stb2.t4 > 2") - # tdSql.error("select distinct t0, t1 from stb1 where t1 > 3 group by t0") - # tdSql.error("select distinct t0, t1 from stb1 where t1 > 3 interval(1d) ") - # tdSql.error("select distinct t0, t1 from stb1 where t1 > 3 interval(1d) fill(next)") - # tdSql.error("select distinct t0, t1 from stb1 where ts > now-10d and ts < now interval(1d) fill(next)") + ########## add where condition ########## + tdSql.query(f"select distinct t0, t1 from {dbname}.stb1 where t1 > 3") + tdSql.checkRows(3) + tdSql.query(f"select distinct t0, t1 from {dbname}.stb1 where t1 > 3 limit 2") + tdSql.checkRows(2) + tdSql.query(f"select distinct t0, t1 from {dbname}.stb1 where t1 > 3 limit 2 offset 2") + tdSql.checkRows(1) + tdSql.error(f"select distinct t0, t1 from {dbname}.stb1 where t1 > 3 slimit 2") + tdSql.query(f"select distinct t0, t1 from {dbname}.stb1 where c1 > 2") + tdSql.query(f"select distinct t0, t1 from {dbname}.stb1 where t1 > 3 and t1 < 5") + tdSql.checkRows(1) + tdSql.error(f"select distinct stb1.t0, stb1.t1 from {dbname}.stb1, {dbname}.stb2 where stb1.t2=stb2.t4") + tdSql.error(f"select distinct t0, t1 from {dbname}.stb1 where stb2.t4 > 2") + tdSql.error(f"select distinct t0, t1 from {dbname}.stb1 where t1 > 3 group by t0") + tdSql.error(f"select distinct t0, t1 from {dbname}.stb1 where t1 > 3 interval(1d) ") + tdSql.error(f"select distinct t0, t1 from {dbname}.stb1 where t1 > 3 interval(1d) fill(next)") + tdSql.error(f"select distinct t0, t1 from {dbname}.stb1 where ts > now-10d and ts < now interval(1d) fill(next)") - # tdSql.error("select max(c1), distinct t0 from stb1 where t0 > 2") - # tdSql.error("select distinct t0, max(c1) from stb1 where t0 > 2") - # tdSql.error("select distinct t0 from stb1 where t0 in (select t0 from stb1 where t0 > 2)") - # tdSql.query("select distinct t0, t1 from stb1 where t0 in (1,2,3,4,5)") - # tdSql.checkRows(5) - # tdSql.query("select distinct t1 from (select t0, t1 from stb1 where t0 > 2) ") - # tdSql.checkRows(4) - # tdSql.error("select distinct t1 from (select distinct t0, t1 from stb1 where t0 > 2 and t1 < 3) ") - # tdSql.error("select distinct t1 from (select distinct t0, t1 from stb1 where t0 > 2 ) where t1 < 3") - # tdSql.query("select distinct t1 from (select t0, t1 from stb1 where t0 > 2 ) where t1 < 3") - # tdSql.checkRows(1) - # tdSql.error("select distinct t1, t0 from (select t1 from stb1 where t0 > 2 ) where t1 < 3") - # tdSql.error("select distinct t1, t0 from (select max(t1) t1, max(t0) t0 from stb1 group by t1)") - # tdSql.error("select distinct t1, t0 from (select max(t1) t1, max(t0) t0 from stb1)") - # tdSql.query("select distinct t1, t0 from (select t1,t0 from stb1 where t0 > 2 ) where t1 < 3") - # tdSql.checkRows(1) - # tdSql.error(" select distinct t1, t0 from (select t1,t0 from stb1 where t0 > 2 order by ts) where t1 < 3") - # tdSql.error("select t1, t0 from (select distinct t1,t0 from stb1 where t0 > 2 ) where t1 < 3") - # tdSql.error(" select distinct t1, t0 from (select t1,t0 from stb1 where t0 > 2 group by ts) where t1 < 3") - # tdSql.error("select distinct stb1.t1, stb1.t2 from stb1 , stb2 where stb1.ts=stb2.ts and stb1.t2=stb2.t4") - # tdSql.error("select distinct t1.t1, t1.t2 from t1 , t2 where t1.ts=t2.ts ") + tdSql.error(f"select max(c1), distinct t0 from {dbname}.stb1 where t0 > 2") + tdSql.query(f"select distinct t0, max(c1) from {dbname}.stb1 where t0 > 2") + tdSql.error(f"select distinct t0 from {dbname}.stb1 where t0 in (select t0 from {dbname}.stb1 where t0 > 2)") + tdSql.query(f"select distinct t0, t1 from {dbname}.stb1 where t0 in (1,2,3,4,5)") + tdSql.checkRows(5) + tdSql.query(f"select distinct t1 from (select t0, t1 from {dbname}.stb1 where t0 > 2) ") + tdSql.checkRows(4) + tdSql.query(f"select distinct t1 from (select distinct t0, t1 from {dbname}.stb1 where t0 > 2 and t1 < 3) ") + # TODO: BUG of TD-17561 + # tdSql.query(f"select distinct t1 from (select distinct t0, t1 from {dbname}.stb1 where t0 > 2 ) where t1 < 3") + tdSql.query(f"select distinct t1 from (select t0, t1 from {dbname}.stb1 where t0 > 2 ) where t1 < 3") + tdSql.checkRows(1) + tdSql.error(f"select distinct t1, t0 from (select t1 from {dbname}.stb1 where t0 > 2 ) where t1 < 3") + tdSql.query(f"select distinct t1, t0 from (select max(t1) t1, max(t0) t0 from {dbname}.stb1 group by t1)") + tdSql.query(f"select distinct t1, t0 from (select max(t1) t1, max(t0) t0 from {dbname}.stb1)") + tdSql.query(f"select distinct t1, t0 from (select t1,t0 from {dbname}.stb1 where t0 > 2 ) where t1 < 3") + tdSql.checkRows(1) + tdSql.query(f"select distinct t1, t0 from (select t1,t0 from {dbname}.stb1 where t0 > 2 order by ts) where t1 < 3") + # TODO: BUG of TD-17561 + # tdSql.error(f"select t1, t0 from (select distinct t1,t0 from {dbname}.stb1 where t0 > 2 ) where t1 < 3") + tdSql.error(f"select distinct t1, t0 from (select t1,t0 from {dbname}.stb1 where t0 > 2 group by ts) where t1 < 3") + tdSql.query(f"select distinct stb1.t1, stb1.t2 from {dbname}.stb1, {dbname}.stb2 where stb1.ts=stb2.ts and stb1.t2=stb2.t4") + tdSql.query(f"select distinct t1.t1, t1.t2 from {dbname}.t1, {dbname}.t2 where t1.ts=t2.ts ") diff --git a/tests/system-test/2-query/distribute_agg_apercentile.py b/tests/system-test/2-query/distribute_agg_apercentile.py index eb5e8333c2..1fd853f9eb 100644 --- a/tests/system-test/2-query/distribute_agg_apercentile.py +++ b/tests/system-test/2-query/distribute_agg_apercentile.py @@ -6,86 +6,60 @@ import random class TDTestCase: - updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , - "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, - "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143, - "maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } + updatecfgDict = {"maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) self.vnode_disbutes = None self.ts = 1537146000000 - def prepare_datas_of_distribute(self): + def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute("create database if not exists testdb keep 3650 duration 1000 vgroups 5") - tdSql.execute(" use testdb ") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f" use {dbname} ") tdSql.execute( - '''create table stb1 + f'''create table {dbname}.stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t0 timestamp, t1 int, t2 bigint, t3 smallint, t4 tinyint, t5 float, t6 double, t7 bool, t8 binary(16),t9 nchar(32)) ''' ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( - f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) tdSql.execute( - f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) for i in range(1,21): if i ==1 or i == 4: continue else: - tbname = "ct"+f'{i}' + tbname = f"{dbname}.ct{i}" for j in range(9): tdSql.execute( f"insert into {tbname} values ( now()-{(i+j)*10}s, {1*(j+i)}, {11111*(j+i)}, {111*(j+i)}, {11*(j)}, {1.11*(j+i)}, {11.11*(j+i)}, {(j+i)%2}, 'binary{j}', 'nchar{j}', now()+{1*j}a )" ) - tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") - tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - - tdSql.execute( - f'''insert into t1 values - ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a ) - ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a ) - ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now()+3a ) - ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now()+4a ) - ( '2021-07-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now()+5a ) - ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a ) - ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) - ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) - ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) - ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ''' - ) + tdSql.execute(f"insert into {dbname}.ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdLog.info(" prepare data for distributed_aggregate done! ") - def check_distribute_datas(self): + def check_distribute_datas(self, dbname="testdb"): # get vgroup_ids of all - tdSql.query("show vgroups ") + tdSql.query(f"show {dbname}.vgroups ") vgroups = tdSql.queryResult vnode_tables={} @@ -95,7 +69,7 @@ class TDTestCase: # check sub_table of per vnode ,make sure sub_table has been distributed - tdSql.query("show tables like 'ct%'") + tdSql.query(f"show {dbname}.tables like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: @@ -109,28 +83,28 @@ class TDTestCase: if count < 2: tdLog.exit(" the datas of all not satisfy sub_table has been distributed ") - def distribute_agg_query(self): + def distribute_agg_query(self, dbname="testdb"): # basic filter - tdSql.query("select apercentile(c1 , 20) from stb1 where c1 is null") + tdSql.query(f"select apercentile(c1 , 20) from {dbname}.stb1 where c1 is null") tdSql.checkRows(0) - tdSql.query("select apercentile(c1 , 20) from stb1 where t1=1") + tdSql.query(f"select apercentile(c1 , 20) from {dbname}.stb1 where t1=1") tdSql.checkData(0,0,2.800000000) - tdSql.query("select apercentile(c1+c2 ,100) from stb1 where c1 =1 ") + tdSql.query(f"select apercentile(c1+c2 ,100) from {dbname}.stb1 where c1 =1 ") tdSql.checkData(0,0,11112.000000000) - tdSql.query("select apercentile(c1 ,10 ) from stb1 where tbname=\"ct2\"") + tdSql.query(f"select apercentile(c1 ,10 ) from {dbname}.stb1 where tbname=\"ct2\"") tdSql.checkData(0,0,2.000000000) - tdSql.query("select apercentile(c1,20) from stb1 partition by tbname") + tdSql.query(f"select apercentile(c1,20) from {dbname}.stb1 partition by tbname") tdSql.checkRows(20) - tdSql.query("select apercentile(c1,20) from stb1 where t1> 4 partition by tbname") + tdSql.query(f"select apercentile(c1,20) from {dbname}.stb1 where t1> 4 partition by tbname") tdSql.checkRows(15) # union all - tdSql.query("select apercentile(c1,20) from stb1 union all select apercentile(c1,20) from stb1 ") + tdSql.query(f"select apercentile(c1,20) from {dbname}.stb1 union all select apercentile(c1,20) from {dbname}.stb1 ") tdSql.checkRows(2) tdSql.checkData(0,0,7.389181281) @@ -138,44 +112,44 @@ class TDTestCase: tdSql.execute(" create database if not exists db ") tdSql.execute(" use db ") - tdSql.execute(" create stable st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") - tdSql.execute(" create table tb1 using st tags(1) ") - tdSql.execute(" create table tb2 using st tags(2) ") + tdSql.execute(" create stable db.st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") + tdSql.execute(" create table db.tb1 using db.st tags(1) ") + tdSql.execute(" create table db.tb2 using db.st tags(2) ") for i in range(10): ts = i*10 + self.ts - tdSql.execute(f" insert into tb1 values({ts},{i},{i}.0)") - tdSql.execute(f" insert into tb2 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb1 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb2 values({ts},{i},{i}.0)") - tdSql.query("select apercentile(tb1.c1,100), apercentile(tb2.c2,100) from tb1, tb2 where tb1.ts=tb2.ts") + tdSql.query(f"select apercentile(tb1.c1,100), apercentile(tb2.c2,100) from db.tb1 tb1, db.tb2 tb2 where tb1.ts=tb2.ts") tdSql.checkRows(1) tdSql.checkData(0,0,9.000000000) tdSql.checkData(0,0,9.000000000) # group by - tdSql.execute(" use testdb ") - tdSql.query(" select max(c1),c1 from stb1 group by t1 ") + tdSql.execute(f"use {dbname} ") + tdSql.query(f" select max(c1),c1 from {dbname}.stb1 group by t1 ") tdSql.checkRows(20) - tdSql.query(" select max(c1),c1 from stb1 group by c1 ") + tdSql.query(f" select max(c1),c1 from {dbname}.stb1 group by c1 ") tdSql.checkRows(30) - tdSql.query(" select max(c1),c2 from stb1 group by c2 ") + tdSql.query(f" select max(c1),c2 from {dbname}.stb1 group by c2 ") tdSql.checkRows(31) # partition by tbname or partition by tag - tdSql.query("select apercentile(c1 ,10)from stb1 partition by tbname") + tdSql.query(f"select apercentile(c1 ,10)from {dbname}.stb1 partition by tbname") query_data = tdSql.queryResult # nest query for support max - tdSql.query("select apercentile(c2+2,10)+1 from (select max(c1) c2 from stb1)") + tdSql.query(f"select apercentile(c2+2,10)+1 from (select max(c1) c2 from {dbname}.stb1)") tdSql.checkData(0,0,31.000000000) - tdSql.query("select apercentile(c1+2,10)+1 as c2 from (select ts ,c1 ,c2 from stb1)") + tdSql.query(f"select apercentile(c1+2,10)+1 as c2 from (select ts ,c1 ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,7.560701700) - tdSql.query("select apercentile(a+2,10)+1 as c2 from (select ts ,abs(c1) a ,c2 from stb1)") + tdSql.query(f"select apercentile(a+2,10)+1 as c2 from (select ts ,abs(c1) a ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,7.560701700) # mixup with other functions - tdSql.query("select max(c1),count(c1),last(c2,c3),spread(c1), apercentile(c1,10) from stb1") + tdSql.query(f"select max(c1),count(c1),last(c2,c3),spread(c1), apercentile(c1,10) from {dbname}.stb1") tdSql.checkData(0,0,28) tdSql.checkData(0,1,184) tdSql.checkData(0,2,-99999) diff --git a/tests/system-test/2-query/distribute_agg_avg.py b/tests/system-test/2-query/distribute_agg_avg.py index 2f449595bd..3892ae0da1 100644 --- a/tests/system-test/2-query/distribute_agg_avg.py +++ b/tests/system-test/2-query/distribute_agg_avg.py @@ -7,11 +7,8 @@ import platform class TDTestCase: - updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , - "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, - "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143, - "maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } + updatecfgDict = {"maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) @@ -34,75 +31,52 @@ class TDTestCase: tdSql.query(avg_sql) tdSql.checkData(0,0,pre_avg) - def prepare_datas_of_distribute(self): + def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute("create database if not exists testdb keep 3650 duration 1000 vgroups 5") - tdSql.execute(" use testdb ") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f" use {dbname} ") tdSql.execute( - '''create table stb1 + f'''create table {dbname}.stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t0 timestamp, t1 int, t2 bigint, t3 smallint, t4 tinyint, t5 float, t6 double, t7 bool, t8 binary(16),t9 nchar(32)) ''' ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( - f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) tdSql.execute( - f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) for i in range(1,21): if i ==1 or i == 4: continue else: - tbname = "ct"+f'{i}' + tbname = f"{dbname}.ct{i}" for j in range(9): tdSql.execute( f"insert into {tbname} values ( now()-{(i+j)*10}s, {1*(j+i)}, {11111*(j+i)}, {111*(j+i)}, {11*(j)}, {1.11*(j+i)}, {11.11*(j+i)}, {(j+i)%2}, 'binary{j}', 'nchar{j}', now()+{1*j}a )" ) - tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") - tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - - tdSql.execute( - f'''insert into t1 values - ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a ) - ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a ) - ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now()+3a ) - ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now()+4a ) - ( '2021-07-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now()+5a ) - ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a ) - ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) - ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) - ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) - ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ''' - ) + tdSql.execute(f"insert into {dbname}.ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdLog.info(" prepare data for distributed_aggregate done! ") - def check_distribute_datas(self): + def check_distribute_datas(self, dbname="testdb"): # get vgroup_ids of all - tdSql.query("show vgroups ") + tdSql.query(f"show {dbname}.vgroups ") vgroups = tdSql.queryResult vnode_tables={} @@ -112,7 +86,7 @@ class TDTestCase: # check sub_table of per vnode ,make sure sub_table has been distributed - tdSql.query("show tables like 'ct%'") + tdSql.query(f"show {dbname}.tables like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: @@ -126,7 +100,7 @@ class TDTestCase: if count < 2: tdLog.exit(" the datas of all not satisfy sub_table has been distributed ") - def check_avg_distribute_diff_vnode(self,col_name): + def check_avg_distribute_diff_vnode(self,col_name, dbname="testdb"): vgroup_ids = [] for k ,v in self.vnode_disbutes.items(): @@ -144,9 +118,9 @@ class TDTestCase: tbname_filters = tbname_ins[:-1] - avg_sql = f"select avg({col_name}) from stb1 where tbname in ({tbname_filters});" + avg_sql = f"select avg({col_name}) from {dbname}.stb1 where tbname in ({tbname_filters});" - same_sql = f"select {col_name} from stb1 where tbname in ({tbname_filters}) and {col_name} is not null " + same_sql = f"select {col_name} from {dbname}.stb1 where tbname in ({tbname_filters}) and {col_name} is not null " tdSql.query(same_sql) pre_data = np.array(tdSql.queryResult)[np.array(tdSql.queryResult) != None] @@ -157,16 +131,16 @@ class TDTestCase: tdSql.query(avg_sql) tdSql.checkData(0,0,pre_avg) - def check_avg_status(self): + def check_avg_status(self, dbname="testdb"): # check max function work status - tdSql.query("show tables like 'ct%'") + tdSql.query(f"show {dbname}.tables like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: - tablenames.append(table_name[0]) + tablenames.append(f"{dbname}.{table_name[0]}") - tdSql.query("desc stb1") + tdSql.query(f"desc {dbname}.stb1") col_names = tdSql.queryResult colnames = [] @@ -182,41 +156,41 @@ class TDTestCase: for colname in colnames: if colname.startswith("c"): - self.check_avg_distribute_diff_vnode(colname) + self.check_avg_distribute_diff_vnode(colname, dbname) else: - # self.check_avg_distribute_diff_vnode(colname) # bug for tag + # self.check_avg_distribute_diff_vnode(colname, dbname) # bug for tag pass - def distribute_agg_query(self): + def distribute_agg_query(self, dbname="testdb"): # basic filter - tdSql.query(" select avg(c1) from stb1 ") + tdSql.query(f"select avg(c1) from {dbname}.stb1 ") tdSql.checkData(0,0,14.086956522) - tdSql.query(" select avg(a) from (select avg(c1) a from stb1 partition by tbname) ") + tdSql.query(f"select avg(a) from (select avg(c1) a from {dbname}.stb1 partition by tbname) ") tdSql.checkData(0,0,14.292307692) - tdSql.query(" select avg(c1) from stb1 where t1=1") + tdSql.query(f"select avg(c1) from {dbname}.stb1 where t1=1") tdSql.checkData(0,0,6.000000000) - tdSql.query("select avg(c1+c2) from stb1 where c1 =1 ") + tdSql.query(f"select avg(c1+c2) from {dbname}.stb1 where c1 =1 ") tdSql.checkData(0,0,11112.000000000) - tdSql.query("select avg(c1) from stb1 where tbname=\"ct2\"") + tdSql.query(f"select avg(c1) from {dbname}.stb1 where tbname=\"ct2\"") tdSql.checkData(0,0,6.000000000) - tdSql.query("select avg(c1) from stb1 partition by tbname") + tdSql.query(f"select avg(c1) from {dbname}.stb1 partition by tbname") tdSql.checkRows(20) - tdSql.query("select avg(c1) from stb1 where t1> 4 partition by tbname") + tdSql.query(f"select avg(c1) from {dbname}.stb1 where t1> 4 partition by tbname") tdSql.checkRows(15) # union all - tdSql.query("select avg(c1) from stb1 union all select avg(c1) from stb1 ") + tdSql.query(f"select avg(c1) from {dbname}.stb1 union all select avg(c1) from {dbname}.stb1 ") tdSql.checkRows(2) tdSql.checkData(0,0,14.086956522) - tdSql.query("select avg(a) from (select avg(c1) a from stb1 union all select avg(c1) a from stb1)") + tdSql.query(f"select avg(a) from (select avg(c1) a from {dbname}.stb1 union all select avg(c1) a from {dbname}.stb1)") tdSql.checkRows(1) tdSql.checkData(0,0,14.086956522) @@ -224,38 +198,38 @@ class TDTestCase: tdSql.execute(" create database if not exists db ") tdSql.execute(" use db ") - tdSql.execute(" create stable st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") - tdSql.execute(" create table tb1 using st tags(1) ") - tdSql.execute(" create table tb2 using st tags(2) ") + tdSql.execute(" create stable db.st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") + tdSql.execute(" create table db.tb1 using db.st tags(1) ") + tdSql.execute(" create table db.tb2 using db.st tags(2) ") for i in range(10): ts = i*10 + self.ts - tdSql.execute(f" insert into tb1 values({ts},{i},{i}.0)") - tdSql.execute(f" insert into tb2 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb1 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb2 values({ts},{i},{i}.0)") - tdSql.query("select avg(tb1.c1), avg(tb2.c2) from tb1, tb2 where tb1.ts=tb2.ts") + tdSql.query(f"select avg(tb1.c1), avg(tb2.c2) from db.tb1 tb1, db.tb2 tb2 where tb1.ts=tb2.ts") tdSql.checkRows(1) tdSql.checkData(0,0,4.500000000) tdSql.checkData(0,1,4.500000000) # group by - tdSql.execute(" use testdb ") + tdSql.execute(f" use {dbname} ") # partition by tbname or partition by tag - tdSql.query("select avg(c1) from stb1 partition by tbname") + tdSql.query(f"select avg(c1) from {dbname}.stb1 partition by tbname") tdSql.checkRows(20) # nest query for support max - tdSql.query("select avg(c2+2)+1 from (select avg(c1) c2 from stb1)") + tdSql.query(f"select avg(c2+2)+1 from (select avg(c1) c2 from {dbname}.stb1)") tdSql.checkData(0,0,17.086956522) - tdSql.query("select avg(c1+2) as c2 from (select ts ,c1 ,c2 from stb1)") + tdSql.query(f"select avg(c1+2) as c2 from (select ts ,c1 ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,16.086956522) - tdSql.query("select avg(a+2) as c2 from (select ts ,abs(c1) a ,c2 from stb1)") + tdSql.query(f"select avg(a+2) as c2 from (select ts ,abs(c1) a ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,16.086956522) # mixup with other functions - tdSql.query("select max(c1),count(c1),last(c2,c3),sum(c1+c2),avg(c1) from stb1") + tdSql.query(f"select max(c1),count(c1),last(c2,c3),sum(c1+c2),avg(c1) from {dbname}.stb1") tdSql.checkData(0,0,28) tdSql.checkData(0,1,184) tdSql.checkData(0,2,-99999) diff --git a/tests/system-test/2-query/distribute_agg_count.py b/tests/system-test/2-query/distribute_agg_count.py index 67f7e28325..835d1eeb57 100644 --- a/tests/system-test/2-query/distribute_agg_count.py +++ b/tests/system-test/2-query/distribute_agg_count.py @@ -6,11 +6,8 @@ import random class TDTestCase: - updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , - "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, - "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143, - "maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } + updatecfgDict = {"maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) tdSql.init(conn.cursor()) @@ -35,76 +32,52 @@ class TDTestCase: else: tdLog.info(" count function work as expected, sql : %s "% max_sql) - - def prepare_datas_of_distribute(self): + def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute("create database if not exists testdb keep 3650 duration 1000 vgroups 5") - tdSql.execute(" use testdb ") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f" use {dbname} ") tdSql.execute( - '''create table stb1 + f'''create table {dbname}.stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t0 timestamp, t1 int, t2 bigint, t3 smallint, t4 tinyint, t5 float, t6 double, t7 bool, t8 binary(16),t9 nchar(32)) ''' ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( - f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) tdSql.execute( - f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) for i in range(1,21): if i ==1 or i == 4: continue else: - tbname = "ct"+f'{i}' + tbname = f"{dbname}.ct{i}" for j in range(9): tdSql.execute( f"insert into {tbname} values ( now()-{(i+j)*10}s, {1*(j+i)}, {11111*(j+i)}, {111*(j+i)}, {11*(j)}, {1.11*(j+i)}, {11.11*(j+i)}, {(j+i)%2}, 'binary{j}', 'nchar{j}', now()+{1*j}a )" ) - tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") - tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - - tdSql.execute( - f'''insert into t1 values - ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a ) - ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a ) - ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now()+3a ) - ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now()+4a ) - ( '2021-07-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now()+5a ) - ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a ) - ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) - ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) - ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) - ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ''' - ) + tdSql.execute(f"insert into {dbname}.ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdLog.info(" prepare data for distributed_aggregate done! ") - def check_distribute_datas(self): + def check_distribute_datas(self, dbname="testdb"): # get vgroup_ids of all - tdSql.query("show vgroups ") + tdSql.query(f"show {dbname}.vgroups ") vgroups = tdSql.queryResult vnode_tables={} @@ -114,7 +87,7 @@ class TDTestCase: # check sub_table of per vnode ,make sure sub_table has been distributed - tdSql.query("show tables like 'ct%'") + tdSql.query(f"show {dbname}.tables like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: @@ -128,7 +101,7 @@ class TDTestCase: if count < 2: tdLog.exit(" the datas of all not satisfy sub_table has been distributed ") - def check_count_distribute_diff_vnode(self,col_name): + def check_count_distribute_diff_vnode(self,col_name, dbname="testdb"): vgroup_ids = [] for k ,v in self.vnode_disbutes.items(): @@ -146,9 +119,9 @@ class TDTestCase: tbname_filters = tbname_ins[:-1] - max_sql = f"select count({col_name}) from stb1 where tbname in ({tbname_filters});" + max_sql = f"select count({col_name}) from {dbname}.stb1 where tbname in ({tbname_filters});" - same_sql = f"select sum(c) from (select {col_name} ,1 as c from stb1 where tbname in ({tbname_filters}) and {col_name} is not null) " + same_sql = f"select sum(c) from (select {col_name} ,1 as c from {dbname}.stb1 where tbname in ({tbname_filters}) and {col_name} is not null) " tdSql.query(max_sql) max_result = tdSql.queryResult @@ -161,16 +134,16 @@ class TDTestCase: else: tdLog.info(" count function work as expected, sql : %s "% max_sql) - def check_count_status(self): + def check_count_status(self, dbname="testdb"): # check max function work status - tdSql.query("show tables like 'ct%'") + tdSql.query(f"show {dbname}.tables like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: - tablenames.append(table_name[0]) + tablenames.append(f"{dbname}.{table_name[0]}") - tdSql.query("desc stb1") + tdSql.query(f"desc {dbname}.stb1") col_names = tdSql.queryResult colnames = [] @@ -186,34 +159,33 @@ class TDTestCase: for colname in colnames: if colname.startswith("c"): - self.check_count_distribute_diff_vnode(colname) + self.check_count_distribute_diff_vnode(colname, dbname) else: - # self.check_count_distribute_diff_vnode(colname) # bug for tag + # self.check_count_distribute_diff_vnode(colname, dbname) # bug for tag pass - - def distribute_agg_query(self): + def distribute_agg_query(self, dbname="testdb"): # basic filter - tdSql.query("select count(c1) from stb1 ") + tdSql.query(f"select count(c1) from {dbname}.stb1 ") tdSql.checkData(0,0,184) - tdSql.query("select count(c1) from stb1 where t1=1") + tdSql.query(f"select count(c1) from {dbname}.stb1 where t1=1") tdSql.checkData(0,0,9) - tdSql.query("select count(c1+c2) from stb1 where c1 =1 ") + tdSql.query(f"select count(c1+c2) from {dbname}.stb1 where c1 =1 ") tdSql.checkData(0,0,2) - tdSql.query("select count(c1) from stb1 where tbname=\"ct2\"") + tdSql.query(f"select count(c1) from {dbname}.stb1 where tbname=\"ct2\"") tdSql.checkData(0,0,9) - tdSql.query("select count(c1) from stb1 partition by tbname") + tdSql.query(f"select count(c1) from {dbname}.stb1 partition by tbname") tdSql.checkRows(20) - tdSql.query("select count(c1) from stb1 where t1> 4 partition by tbname") + tdSql.query(f"select count(c1) from {dbname}.stb1 where t1> 4 partition by tbname") tdSql.checkRows(15) # union all - tdSql.query("select count(c1) from stb1 union all select count(c1) from stb1 ") + tdSql.query(f"select count(c1) from {dbname}.stb1 union all select count(c1) from {dbname}.stb1 ") tdSql.checkRows(2) tdSql.checkData(0,0,184) @@ -221,60 +193,60 @@ class TDTestCase: tdSql.execute(" create database if not exists db ") tdSql.execute(" use db ") - tdSql.execute(" create stable st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") - tdSql.execute(" create table tb1 using st tags(1) ") - tdSql.execute(" create table tb2 using st tags(2) ") + tdSql.execute(" create stable db.st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") + tdSql.execute(" create table db.tb1 using db.st tags(1) ") + tdSql.execute(" create table db.tb2 using db.st tags(2) ") for i in range(10): ts = i*10 + self.ts - tdSql.execute(f" insert into tb1 values({ts},{i},{i}.0)") - tdSql.execute(f" insert into tb2 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb1 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb2 values({ts},{i},{i}.0)") - tdSql.query("select count(tb1.c1), count(tb2.c2) from tb1, tb2 where tb1.ts=tb2.ts") + tdSql.query(f"select count(tb1.c1), count(tb2.c2) from db.tb1 tb1, db.tb2 tb2 where tb1.ts=tb2.ts") tdSql.checkRows(1) tdSql.checkData(0,0,10) tdSql.checkData(0,1,10) # group by - tdSql.execute(" use testdb ") + tdSql.execute(f" use {dbname} ") - tdSql.query(" select count(*) from stb1 ") + tdSql.query(f"select count(*) from {dbname}.stb1 ") tdSql.checkData(0,0,187) - tdSql.query(" select count(*) from stb1 group by t1 ") + tdSql.query(f"select count(*) from {dbname}.stb1 group by t1 ") tdSql.checkRows(20) - tdSql.query(" select count(*) from stb1 group by c1 ") + tdSql.query(f"select count(*) from {dbname}.stb1 group by c1 ") tdSql.checkRows(30) - tdSql.query(" select count(*) from stb1 group by c2 ") + tdSql.query(f"select count(*) from {dbname}.stb1 group by c2 ") tdSql.checkRows(31) # partition by tbname or partition by tag - tdSql.query("select max(c1),tbname from stb1 partition by tbname") + tdSql.query(f"select max(c1),tbname from {dbname}.stb1 partition by tbname") query_data = tdSql.queryResult for row in query_data: - tbname = row[1] - tdSql.query(" select max(c1) from %s "%tbname) + tbname = f"{dbname}.{row[1]}" + tdSql.query(f"select max(c1) from %s "%tbname) tdSql.checkData(0,0,row[0]) - tdSql.query("select max(c1),tbname from stb1 partition by t1") + tdSql.query(f"select max(c1),tbname from {dbname}.stb1 partition by t1") query_data = tdSql.queryResult for row in query_data: - tbname = row[1] - tdSql.query(" select max(c1) from %s "%tbname) + tbname = f"{dbname}.{row[1]}" + tdSql.query(f"select max(c1) from %s "%tbname) tdSql.checkData(0,0,row[0]) # nest query for support max - tdSql.query("select abs(c2+2)+1 from (select count(c1) c2 from stb1)") + tdSql.query(f"select abs(c2+2)+1 from (select count(c1) c2 from {dbname}.stb1)") tdSql.checkData(0,0,187.000000000) - tdSql.query("select count(c1+2) as c2 from (select ts ,c1 ,c2 from stb1)") + tdSql.query(f"select count(c1+2) as c2 from (select ts ,c1 ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,184) - tdSql.query("select count(a+2) as c2 from (select ts ,abs(c1) a ,c2 from stb1)") + tdSql.query(f"select count(a+2) as c2 from (select ts ,abs(c1) a ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,184) # mixup with other functions - tdSql.query("select max(c1),count(c1),last(c2,c3) from stb1") + tdSql.query(f"select max(c1),count(c1),last(c2,c3) from {dbname}.stb1") tdSql.checkData(0,0,28) tdSql.checkData(0,1,184) tdSql.checkData(0,2,-99999) diff --git a/tests/system-test/2-query/distribute_agg_max.py b/tests/system-test/2-query/distribute_agg_max.py index d4b71dbdd7..a7b31a2084 100644 --- a/tests/system-test/2-query/distribute_agg_max.py +++ b/tests/system-test/2-query/distribute_agg_max.py @@ -6,10 +6,8 @@ import random class TDTestCase: - updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , - "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, - "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143, - "maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } + + updatecfgDict = {"maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) @@ -36,75 +34,52 @@ class TDTestCase: tdLog.info(" max function work as expected, sql : %s "% max_sql) - def prepare_datas_of_distribute(self): + def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute("create database if not exists testdb keep 3650 duration 1000 vgroups 5") - tdSql.execute(" use testdb ") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f" use {dbname} ") tdSql.execute( - '''create table stb1 + f'''create table {dbname}.stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t0 timestamp, t1 int, t2 bigint, t3 smallint, t4 tinyint, t5 float, t6 double, t7 bool, t8 binary(16),t9 nchar(32)) ''' ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( - f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) tdSql.execute( - f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) for i in range(1,21): if i ==1 or i == 4: continue else: - tbname = "ct"+f'{i}' + tbname = f"{dbname}.ct{i}" for j in range(9): tdSql.execute( f"insert into {tbname} values ( now()-{(i+j)*10}s, {1*(j+i)}, {11111*(j+i)}, {111*(j+i)}, {11*(j)}, {1.11*(j+i)}, {11.11*(j+i)}, {(j+i)%2}, 'binary{j}', 'nchar{j}', now()+{1*j}a )" ) - tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") - tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - - tdSql.execute( - f'''insert into t1 values - ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a ) - ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a ) - ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now()+3a ) - ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now()+4a ) - ( '2021-07-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now()+5a ) - ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a ) - ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) - ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) - ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) - ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ''' - ) + tdSql.execute(f"insert into {dbname}.ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdLog.info(" prepare data for distributed_aggregate done! ") - def check_distribute_datas(self): + def check_distribute_datas(self, dbname="testdb"): # get vgroup_ids of all - tdSql.query("show vgroups ") + tdSql.query(f"show {dbname}.vgroups ") vgroups = tdSql.queryResult vnode_tables={} @@ -112,9 +87,8 @@ class TDTestCase: for vgroup_id in vgroups: vnode_tables[vgroup_id[0]]=[] - # check sub_table of per vnode ,make sure sub_table has been distributed - tdSql.query("show tables like 'ct%'") + tdSql.query(f"show {dbname}.tables like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: @@ -128,7 +102,7 @@ class TDTestCase: if count < 2: tdLog.exit(" the datas of all not satisfy sub_table has been distributed ") - def check_max_distribute_diff_vnode(self,col_name): + def check_max_distribute_diff_vnode(self,col_name, dbname="testdb"): vgroup_ids = [] for k ,v in self.vnode_disbutes.items(): @@ -146,9 +120,9 @@ class TDTestCase: tbname_filters = tbname_ins[:-1] - max_sql = f"select max({col_name}) from stb1 where tbname in ({tbname_filters});" + max_sql = f"select max({col_name}) from {dbname}.stb1 where tbname in ({tbname_filters});" - same_sql = f"select {col_name} from stb1 where tbname in ({tbname_filters}) order by {col_name} desc limit 1" + same_sql = f"select {col_name} from {dbname}.stb1 where tbname in ({tbname_filters}) order by {col_name} desc limit 1" tdSql.query(max_sql) max_result = tdSql.queryResult @@ -161,16 +135,16 @@ class TDTestCase: else: tdLog.info(" max function work as expected, sql : %s "% max_sql) - def check_max_status(self): + def check_max_status(self, dbname="testdb"): # check max function work status - tdSql.query("show tables like 'ct%'") + tdSql.query(f"show {dbname}.tables like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: - tablenames.append(table_name[0]) + tablenames.append(f"{dbname}.{table_name[0]}") - tdSql.query("desc stb1") + tdSql.query(f"desc {dbname}.stb1") col_names = tdSql.queryResult colnames = [] @@ -186,34 +160,33 @@ class TDTestCase: for colname in colnames: if colname.startswith("c"): - self.check_max_distribute_diff_vnode(colname) + self.check_max_distribute_diff_vnode(colname, dbname) else: - # self.check_max_distribute_diff_vnode(colname) # bug for tag + # self.check_max_distribute_diff_vnode(colname, dbname) # bug for tag pass - - def distribute_agg_query(self): + def distribute_agg_query(self, dbname="testdb"): # basic filter - tdSql.query("select max(c1) from stb1 where c1 is null") + tdSql.query(f"select max(c1) from {dbname}.stb1 where c1 is null") tdSql.checkRows(0) - tdSql.query("select max(c1) from stb1 where t1=1") + tdSql.query(f"select max(c1) from {dbname}.stb1 where t1=1") tdSql.checkData(0,0,10) - tdSql.query("select max(c1+c2) from stb1 where c1 =1 ") + tdSql.query(f"select max(c1+c2) from {dbname}.stb1 where c1 =1 ") tdSql.checkData(0,0,11112.000000000) - tdSql.query("select max(c1) from stb1 where tbname=\"ct2\"") + tdSql.query(f"select max(c1) from {dbname}.stb1 where tbname=\"ct2\"") tdSql.checkData(0,0,10) - tdSql.query("select max(c1) from stb1 partition by tbname") + tdSql.query(f"select max(c1) from {dbname}.stb1 partition by tbname") tdSql.checkRows(20) - tdSql.query("select max(c1) from stb1 where t1> 4 partition by tbname") + tdSql.query(f"select max(c1) from {dbname}.stb1 where t1> 4 partition by tbname") tdSql.checkRows(15) # union all - tdSql.query("select max(c1) from stb1 union all select max(c1) from stb1 ") + tdSql.query(f"select max(c1) from {dbname}.stb1 union all select max(c1) from {dbname}.stb1 ") tdSql.checkRows(2) tdSql.checkData(0,0,28) @@ -221,45 +194,45 @@ class TDTestCase: tdSql.execute(" create database if not exists db ") tdSql.execute(" use db ") - tdSql.execute(" create stable st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") - tdSql.execute(" create table tb1 using st tags(1) ") - tdSql.execute(" create table tb2 using st tags(2) ") + tdSql.execute(" create stable db.st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") + tdSql.execute(" create table db.tb1 using db.st tags(1) ") + tdSql.execute(" create table db.tb2 using db.st tags(2) ") for i in range(10): ts = i*10 + self.ts - tdSql.execute(f" insert into tb1 values({ts},{i},{i}.0)") - tdSql.execute(f" insert into tb2 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb1 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb2 values({ts},{i},{i}.0)") - tdSql.query("select max(tb1.c1), tb2.c2 from tb1, tb2 where tb1.ts=tb2.ts") + tdSql.query(f"select max(tb1.c1), tb2.c2 from db.tb1 tb1, db.tb2 tb2 where tb1.ts=tb2.ts") tdSql.checkRows(1) tdSql.checkData(0,0,9) tdSql.checkData(0,0,9.00000) # group by - tdSql.execute(" use testdb ") - tdSql.query(" select max(c1),c1 from stb1 group by t1 ") + tdSql.execute("use testdb ") + tdSql.query(f"select max(c1),c1 from {dbname}.stb1 group by t1 ") tdSql.checkRows(20) - tdSql.query(" select max(c1),c1 from stb1 group by c1 ") + tdSql.query(f"select max(c1),c1 from {dbname}.stb1 group by c1 ") tdSql.checkRows(30) - tdSql.query(" select max(c1),c2 from stb1 group by c2 ") + tdSql.query(f"select max(c1),c2 from {dbname}.stb1 group by c2 ") tdSql.checkRows(31) # selective common cols of datas - tdSql.query("select max(c1),c2,c3,c5 from stb1") + tdSql.query(f"select max(c1),c2,c3,c5 from {dbname}.stb1") tdSql.checkRows(1) tdSql.checkData(0,0,28) tdSql.checkData(0,1,311108) tdSql.checkData(0,2,3108) tdSql.checkData(0,3,31.08000) - tdSql.query("select max(c1),t1,c2,t3 from stb1") + tdSql.query(f"select max(c1),t1,c2,t3 from {dbname}.stb1") tdSql.checkRows(1) tdSql.checkData(0,0,28) tdSql.checkData(0,1,19) tdSql.checkData(0,2,311108) - tdSql.query("select max(c1),ceil(t1),pow(c2,1)+2,abs(t3) from stb1") + tdSql.query(f"select max(c1),ceil(t1),pow(c2,1)+2,abs(t3) from {dbname}.stb1") tdSql.checkRows(1) tdSql.checkData(0,0,28) tdSql.checkData(0,1,19) @@ -267,32 +240,32 @@ class TDTestCase: tdSql.checkData(0,3,2109) # partition by tbname or partition by tag - tdSql.query("select max(c1),tbname from stb1 partition by tbname") + tdSql.query(f"select max(c1),tbname from {dbname}.stb1 partition by tbname") query_data = tdSql.queryResult for row in query_data: - tbname = row[1] - tdSql.query(" select max(c1) from %s "%tbname) + tbname = f"{dbname}.{row[1]}" + tdSql.query(f"select max(c1) from %s "%tbname) tdSql.checkData(0,0,row[0]) - tdSql.query("select max(c1),tbname from stb1 partition by t1") + tdSql.query(f"select max(c1),tbname from {dbname}.stb1 partition by t1") query_data = tdSql.queryResult for row in query_data: - tbname = row[1] - tdSql.query(" select max(c1) from %s "%tbname) + tbname = f"{dbname}.{row[1]}" + tdSql.query(f"select max(c1) from %s "%tbname) tdSql.checkData(0,0,row[0]) # nest query for support max - tdSql.query("select abs(c2+2)+1 from (select max(c1) c2 from stb1)") + tdSql.query(f"select abs(c2+2)+1 from (select max(c1) c2 from {dbname}.stb1)") tdSql.checkData(0,0,31.000000000) - tdSql.query("select max(c1+2)+1 as c2 from (select ts ,c1 ,c2 from stb1)") + tdSql.query(f"select max(c1+2)+1 as c2 from (select ts ,c1 ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,31.000000000) - tdSql.query("select max(a+2)+1 as c2 from (select ts ,abs(c1) a ,c2 from stb1)") + tdSql.query(f"select max(a+2)+1 as c2 from (select ts ,abs(c1) a ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,31.000000000) # mixup with other functions - tdSql.query("select max(c1),count(c1),last(c2,c3) from stb1") + tdSql.query(f"select max(c1),count(c1),last(c2,c3) from {dbname}.stb1") tdSql.checkData(0,0,28) tdSql.checkData(0,1,184) tdSql.checkData(0,2,-99999) diff --git a/tests/system-test/2-query/distribute_agg_min.py b/tests/system-test/2-query/distribute_agg_min.py index 059efe02cd..cc50092451 100644 --- a/tests/system-test/2-query/distribute_agg_min.py +++ b/tests/system-test/2-query/distribute_agg_min.py @@ -6,10 +6,8 @@ import random class TDTestCase: - updatecfgDict = {'debugFlag': 143 ,"cDebugFlag":143,"uDebugFlag":143 ,"rpcDebugFlag":143 , "tmrDebugFlag":143 , - "jniDebugFlag":143 ,"simDebugFlag":143,"dDebugFlag":143, "dDebugFlag":143,"vDebugFlag":143,"mDebugFlag":143,"qDebugFlag":143, - "wDebugFlag":143,"sDebugFlag":143,"tsdbDebugFlag":143,"tqDebugFlag":143 ,"fsDebugFlag":143 ,"udfDebugFlag":143, - "maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } + + updatecfgDict = {"maxTablesPerVnode":2 ,"minTablesPerVnode":2,"tableIncStepPerVnode":2 } def init(self, conn, logSql): tdLog.debug("start to execute %s" % __file__) @@ -35,76 +33,52 @@ class TDTestCase: else: tdLog.info(" min function work as expected, sql : %s "% min_sql) - - def prepare_datas_of_distribute(self): + def prepare_datas_of_distribute(self, dbname="testdb"): # prepate datas for 20 tables distributed at different vgroups - tdSql.execute("create database if not exists testdb keep 3650 duration 1000 vgroups 5") - tdSql.execute(" use testdb ") + tdSql.execute(f"create database if not exists {dbname} keep 3650 duration 1000 vgroups 5") + tdSql.execute(f" use {dbname} ") tdSql.execute( - '''create table stb1 + f'''create table {dbname}.stb1 (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) tags (t0 timestamp, t1 int, t2 bigint, t3 smallint, t4 tinyint, t5 float, t6 double, t7 bool, t8 binary(16),t9 nchar(32)) ''' ) - tdSql.execute( - ''' - create table t1 - (ts timestamp, c1 int, c2 bigint, c3 smallint, c4 tinyint, c5 float, c6 double, c7 bool, c8 binary(16),c9 nchar(32), c10 timestamp) - ''' - ) for i in range(20): - tdSql.execute(f'create table ct{i+1} using stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') + tdSql.execute(f'create table {dbname}.ct{i+1} using {dbname}.stb1 tags ( now(), {1*i}, {11111*i}, {111*i}, {1*i}, {1.11*i}, {11.11*i}, {i%2}, "binary{i}", "nchar{i}" )') for i in range(9): tdSql.execute( - f"insert into ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct1 values ( now()-{i*10}s, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) tdSql.execute( - f"insert into ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" + f"insert into {dbname}.ct4 values ( now()-{i*90}d, {1*i}, {11111*i}, {111*i}, {11*i}, {1.11*i}, {11.11*i}, {i%2}, 'binary{i}', 'nchar{i}', now()+{1*i}a )" ) for i in range(1,21): if i ==1 or i == 4: continue else: - tbname = "ct"+f'{i}' + tbname = f"{dbname}.ct{i}" for j in range(9): tdSql.execute( f"insert into {tbname} values ( now()-{(i+j)*10}s, {1*(j+i)}, {11111*(j+i)}, {111*(j+i)}, {11*(j)}, {1.11*(j+i)}, {11.11*(j+i)}, {(j+i)%2}, 'binary{j}', 'nchar{j}', now()+{1*j}a )" ) - tdSql.execute("insert into ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") - tdSql.execute("insert into ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()-45s, 0, 0, 0, 0, 0, 0, 0, 'binary0', 'nchar0', now()+8a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+10s, 9, -99999, -999, -99, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+15s, 9, -99999, -999, -99, -9.99, NULL, 1, 'binary9', 'nchar9', now()+9a )") + tdSql.execute(f"insert into {dbname}.ct1 values (now()+20s, 9, -99999, -999, NULL, -9.99, -99.99, 1, 'binary9', 'nchar9', now()+9a )") - tdSql.execute("insert into ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - tdSql.execute("insert into ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") - - tdSql.execute( - f'''insert into t1 values - ( '2020-04-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2020-10-21 01:01:01.000', 1, 11111, 111, 11, 1.11, 11.11, 1, "binary1", "nchar1", now()+1a ) - ( '2020-12-31 01:01:01.000', 2, 22222, 222, 22, 2.22, 22.22, 0, "binary2", "nchar2", now()+2a ) - ( '2021-01-01 01:01:06.000', 3, 33333, 333, 33, 3.33, 33.33, 0, "binary3", "nchar3", now()+3a ) - ( '2021-05-07 01:01:10.000', 4, 44444, 444, 44, 4.44, 44.44, 1, "binary4", "nchar4", now()+4a ) - ( '2021-07-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ( '2021-09-30 01:01:16.000', 5, 55555, 555, 55, 5.55, 55.55, 0, "binary5", "nchar5", now()+5a ) - ( '2022-02-01 01:01:20.000', 6, 66666, 666, 66, 6.66, 66.66, 1, "binary6", "nchar6", now()+6a ) - ( '2022-10-28 01:01:26.000', 7, 00000, 000, 00, 0.00, 00.00, 1, "binary7", "nchar7", "1970-01-01 08:00:00.000" ) - ( '2022-12-01 01:01:30.000', 8, -88888, -888, -88, -8.88, -88.88, 0, "binary8", "nchar8", "1969-01-01 01:00:00.000" ) - ( '2022-12-31 01:01:36.000', 9, -99999999999999999, -999, -99, -9.99, -999999999999999999999.99, 1, "binary9", "nchar9", "1900-01-01 00:00:00.000" ) - ( '2023-02-21 01:01:01.000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) - ''' - ) + tdSql.execute(f"insert into {dbname}.ct4 values (now()-810d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()-400d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") + tdSql.execute(f"insert into {dbname}.ct4 values (now()+90d, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ) ") tdLog.info(" prepare data for distributed_aggregate done! ") - def check_distribute_datas(self): + def check_distribute_datas(self, dbname="testdb"): # get vgroup_ids of all - tdSql.query("show vgroups ") + tdSql.query(f"show {dbname}.vgroups ") vgroups = tdSql.queryResult vnode_tables={} @@ -112,9 +86,8 @@ class TDTestCase: for vgroup_id in vgroups: vnode_tables[vgroup_id[0]]=[] - # check sub_table of per vnode ,make sure sub_table has been distributed - tdSql.query("show tables like 'ct%'") + tdSql.query(f"show {dbname}.tables like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: @@ -128,7 +101,7 @@ class TDTestCase: if count < 2: tdLog.exit(" the datas of all not satisfy sub_table has been distributed ") - def check_min_distribute_diff_vnode(self,col_name): + def check_min_distribute_diff_vnode(self,col_name, dbname="testdb"): vgroup_ids = [] for k ,v in self.vnode_disbutes.items(): @@ -146,9 +119,9 @@ class TDTestCase: tbname_filters = tbname_ins[:-1] - min_sql = f"select min({col_name}) from stb1 where tbname in ({tbname_filters});" + min_sql = f"select min({col_name}) from {dbname}.stb1 where tbname in ({tbname_filters});" - same_sql = f"select {col_name} from stb1 where tbname in ({tbname_filters}) and {col_name} is not null order by {col_name} asc limit 1" + same_sql = f"select {col_name} from {dbname}.stb1 where tbname in ({tbname_filters}) and {col_name} is not null order by {col_name} asc limit 1" tdSql.query(min_sql) min_result = tdSql.queryResult @@ -161,16 +134,16 @@ class TDTestCase: else: tdLog.info(" min function work as expected, sql : %s "% min_sql) - def check_min_status(self): - # check max function work status + def check_min_status(self, dbname="testdb"): + # check min function work status - tdSql.query("show tables like 'ct%'") + tdSql.query(f"show {dbname}.tables like 'ct%'") table_names = tdSql.queryResult tablenames = [] for table_name in table_names: - tablenames.append(table_name[0]) + tablenames.append(f"{dbname}.{table_name[0]}") - tdSql.query("desc stb1") + tdSql.query(f"desc {dbname}.stb1") col_names = tdSql.queryResult colnames = [] @@ -182,119 +155,117 @@ class TDTestCase: for colname in colnames: self.check_min_functions(tablename,colname) - # check max function for different vnode + # check min function for different vnode for colname in colnames: if colname.startswith("c"): - self.check_min_distribute_diff_vnode(colname) + self.check_min_distribute_diff_vnode(colname, dbname) else: - # self.check_min_distribute_diff_vnode(colname) # bug for tag + # self.check_min_distribute_diff_vnode(colname, dbname) # bug for tag pass - - def distribute_agg_query(self): + def distribute_agg_query(self, dbname="testdb"): # basic filter - tdSql.query("select min(c1) from stb1 where c1 is null") + tdSql.query(f"select min(c1) from {dbname}.stb1 where c1 is null") tdSql.checkRows(0) - tdSql.query("select min(c1) from stb1 where t1=1") + tdSql.query(f"select min(c1) from {dbname}.stb1 where t1=1") tdSql.checkData(0,0,2) - tdSql.query("select min(c1+c2) from stb1 where c1 =1 ") + tdSql.query(f"select min(c1+c2) from {dbname}.stb1 where c1 =1 ") tdSql.checkData(0,0,11112.000000000) - tdSql.query("select min(c1) from stb1 where tbname=\"ct2\"") - tdSql.checkData(0,0,2) + tdSql.query(f"select min(c1) from {dbname}.stb1 where tbname=\"ct2\"") + tdSql.checkData(0, 0, 2) - tdSql.query("select min(c1) from stb1 partition by tbname") + tdSql.query(f"select min(c1) from {dbname}.stb1 partition by tbname") tdSql.checkRows(20) - tdSql.query("select min(c1) from stb1 where t1> 4 partition by tbname") + tdSql.query(f"select min(c1) from {dbname}.stb1 where t1> 4 partition by tbname") tdSql.checkRows(15) # union all - tdSql.query("select min(c1) from stb1 union all select min(c1) from stb1 ") + tdSql.query(f"select min(c1) from {dbname}.stb1 union all select min(c1) from {dbname}.stb1 ") tdSql.checkRows(2) - tdSql.checkData(0,0,0) + tdSql.checkData(0, 0, 0) # join tdSql.execute(" create database if not exists db ") tdSql.execute(" use db ") - tdSql.execute(" create stable st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") - tdSql.execute(" create table tb1 using st tags(1) ") - tdSql.execute(" create table tb2 using st tags(2) ") + tdSql.execute(" create stable db.st (ts timestamp , c1 int ,c2 float) tags(t1 int) ") + tdSql.execute(" create table db.tb1 using db.st tags(1) ") + tdSql.execute(" create table db.tb2 using db.st tags(2) ") for i in range(10): ts = i*10 + self.ts - tdSql.execute(f" insert into tb1 values({ts},{i},{i}.0)") - tdSql.execute(f" insert into tb2 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb1 values({ts},{i},{i}.0)") + tdSql.execute(f" insert into db.tb2 values({ts},{i},{i}.0)") - tdSql.query("select min(tb1.c1), tb2.c2 from tb1, tb2 where tb1.ts=tb2.ts") + tdSql.query(f"select min(tb1.c1), tb2.c2 from db.tb1 tb1, db.tb2 tb2 where tb1.ts=tb2.ts") tdSql.checkRows(1) tdSql.checkData(0,0,0) tdSql.checkData(0,0,0.00000) # group by - tdSql.execute(" use testdb ") - tdSql.query(" select min(c1),c1 from stb1 group by t1 ") + tdSql.execute(f"use {dbname} ") + tdSql.query(f"select min(c1),c1 from {dbname}.stb1 group by t1 ") tdSql.checkRows(20) - tdSql.query(" select min(c1),c1 from stb1 group by c1 ") + tdSql.query(f"select min(c1),c1 from {dbname}.stb1 group by c1 ") tdSql.checkRows(30) - tdSql.query(" select min(c1),c2 from stb1 group by c2 ") + tdSql.query(f"select min(c1),c2 from {dbname}.stb1 group by c2 ") tdSql.checkRows(31) # selective common cols of datas - tdSql.query("select min(c1),c2,c3,c5 from stb1") + tdSql.query(f"select min(c1),c2,c3,c5 from {dbname}.stb1") tdSql.checkRows(1) tdSql.checkData(0,0,0) tdSql.checkData(0,1,0) tdSql.checkData(0,2,0) tdSql.checkData(0,3,0) - tdSql.query("select min(c1),t1,c2,t3 from stb1 where c1 >5") + tdSql.query(f"select min(c1),t1,c2,t3 from {dbname}.stb1 where c1 > 5") tdSql.checkRows(1) tdSql.checkData(0,0,6) tdSql.checkData(0,2,66666) - tdSql.query("select min(c1),ceil(t1),pow(c2,1)+2,abs(t3) from stb1 where c1>12") + tdSql.query(f"select min(c1),ceil(t1),pow(c2,1)+2,abs(t3) from {dbname}.stb1 where c1 > 12") tdSql.checkRows(1) tdSql.checkData(0,0,13) tdSql.checkData(0,2,144445.000000000) # partition by tbname or partition by tag - tdSql.query("select min(c1),tbname from stb1 partition by tbname") + tdSql.query(f"select min(c1),tbname from {dbname}.stb1 partition by tbname") query_data = tdSql.queryResult for row in query_data: - tbname = row[1] - tdSql.query(" select min(c1) from %s "%tbname) + tbname = f"{dbname}.{row[1]}" + tdSql.query(f"select min(c1) from %s "%tbname) tdSql.checkData(0,0,row[0]) - tdSql.query("select min(c1),tbname from stb1 partition by t1") + tdSql.query(f"select min(c1),tbname from {dbname}.stb1 partition by t1") query_data = tdSql.queryResult for row in query_data: - tbname = row[1] - tdSql.query(" select min(c1) from %s "%tbname) + tbname = f"{dbname}.{row[1]}" + tdSql.query(f"select min(c1) from %s "%tbname) tdSql.checkData(0,0,row[0]) - # nest query for support max - tdSql.query("select abs(c2+2)+1 from (select min(c1) c2 from stb1)") + # nest query for support min + tdSql.query(f"select abs(c2+2)+1 from (select min(c1) c2 from {dbname}.stb1)") tdSql.checkData(0,0,3.000000000) - tdSql.query("select min(c1+2)+1 as c2 from (select ts ,c1 ,c2 from stb1)") + tdSql.query(f"select min(c1+2)+1 as c2 from (select ts ,c1 ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,3.000000000) - tdSql.query("select min(a+2)+1 as c2 from (select ts ,abs(c1) a ,c2 from stb1)") + tdSql.query(f"select min(a+2)+1 as c2 from (select ts ,abs(c1) a ,c2 from {dbname}.stb1)") tdSql.checkData(0,0,3.000000000) # mixup with other functions - tdSql.query("select max(c1),count(c1),last(c2,c3),min(c1) from stb1") + tdSql.query(f"select max(c1),count(c1),last(c2,c3) from {dbname}.stb1") tdSql.checkData(0,0,28) tdSql.checkData(0,1,184) tdSql.checkData(0,2,-99999) tdSql.checkData(0,3,-999) - tdSql.checkData(0,4,0) def run(self): diff --git a/tests/system-test/7-tmq/tmqShow.py b/tests/system-test/7-tmq/tmqShow.py index 6b7e7375ff..6f8183bf06 100644 --- a/tests/system-test/7-tmq/tmqShow.py +++ b/tests/system-test/7-tmq/tmqShow.py @@ -51,32 +51,32 @@ class TDTestCase: tdCom.create_ctable(tdSql, dbname=paraDict["dbName"],stbname=paraDict["stbName"],tag_elm_list=paraDict['tagSchema'],count=paraDict["ctbNum"], default_ctbname_prefix=paraDict['ctbPrefix']) # tdLog.info("insert data") # tmqCom.insert_data(tdSql,paraDict["dbName"],paraDict["ctbPrefix"],paraDict["ctbNum"],paraDict["rowsPerTbl"],paraDict["batchNum"],paraDict["startTs"]) - + tdLog.info("create 4 topics") sqlString = "create topic %s as database %s" %(topicNameList[0], paraDict['dbName']) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) - + sqlString = "create topic %s as stable %s.%s" %(topicNameList[1], paraDict['dbName'], paraDict['stbName']) tdLog.info("create topic sql: %s"%sqlString) - tdSql.execute(sqlString) + tdSql.execute(sqlString) queryString = "select * from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) sqlString = "create topic %s as %s" %(topicNameList[2], queryString) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) - + queryString = "select ts, log(c1), ceil(pow(c1,3)) from %s.%s where c1 %% 7 == 0" %(paraDict['dbName'], paraDict['stbName']) sqlString = "create topic %s as %s " %(topicNameList[3], queryString) tdLog.info("create topic sql: %s"%sqlString) tdSql.execute(sqlString) tdSql.query("show topics") - tdLog.debug(tdSql.queryResult) + tdLog.debug(tdSql.queryResult) rows = tdSql.getRows() if rows != len(consumerIdList): tdLog.exit("topic rows error") - + for i in range (rows): topicName = tdSql.getData(i,0) matchFlag = 0 @@ -87,24 +87,24 @@ class TDTestCase: break if matchFlag == 0: tdLog.exit("topic name: %s is error", topicName) - + # init consume info, and start tmq_sim, then check consume result tdLog.info("insert consume info to consume processor") expectrowcnt = paraDict["rowsPerTbl"] * paraDict["ctbNum"] topicList = topicNameList[0] ifcheckdata = 0 - ifManualCommit = 0 + ifManualCommit = 0 keyList = 'group.id:%s, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest'%consumeGroupIdList[0] tmqCom.insertConsumerInfo(consumerIdList[0], expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) - + topicList = topicNameList[1] keyList = 'group.id:%s, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest'%consumeGroupIdList[1] tmqCom.insertConsumerInfo(consumerIdList[1], expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) - + topicList = topicNameList[2] keyList = 'group.id:%s, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest'%consumeGroupIdList[2] tmqCom.insertConsumerInfo(consumerIdList[2], expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) - + topicList = topicNameList[3] keyList = 'group.id:%s, enable.auto.commit:false, auto.commit.interval.ms:6000, auto.offset.reset:earliest'%consumeGroupIdList[3] tmqCom.insertConsumerInfo(consumerIdList[3], expectrowcnt,topicList,keyList,ifcheckdata,ifManualCommit) @@ -118,27 +118,27 @@ class TDTestCase: time.sleep(5) tdLog.info("check show consumers") tdSql.query("show consumers") - # tdLog.info(tdSql.queryResult) + # tdLog.info(tdSql.queryResult) rows = tdSql.getRows() tdLog.info("show consumers rows: %d"%rows) if rows != len(topicNameList): tdLog.exit("show consumers rows error") - - tdLog.info("check show subscriptions") + + tdLog.info("check show subscriptions") tdSql.query("show subscriptions") - # tdLog.debug(tdSql.queryResult) + # tdLog.debug(tdSql.queryResult) rows = tdSql.getRows() tdLog.info("show subscriptions rows: %d"%rows) if rows != paraDict['vgroups'] * len(topicNameList): tdLog.exit("show subscriptions rows error") pThread.join() - + tdLog.info("insert process end, and start to check consume result") expectRows = len(consumerIdList) _ = tmqCom.selectConsumeResult(expectRows) - - time.sleep(10) + + time.sleep(10) for i in range(len(topicNameList)): tdSql.query("drop topic %s"%topicNameList[i]) diff --git a/tests/system-test/7-tmq/tmq_taosx.py b/tests/system-test/7-tmq/tmq_taosx.py new file mode 100644 index 0000000000..a136d0a1a2 --- /dev/null +++ b/tests/system-test/7-tmq/tmq_taosx.py @@ -0,0 +1,91 @@ + +import taos +import sys +import time +import socket +import os +import threading + +from util.log import * +from util.sql import * +from util.cases import * +from util.dnodes import * +from util.common import * +sys.path.append("./7-tmq") +from tmqCommon import * + +class TDTestCase: + def init(self, conn, logSql): + tdLog.debug(f"start to excute {__file__}") + tdSql.init(conn.cursor()) + #tdSql.init(conn.cursor(), logSql) # output sql.txt file + + def checkFileContent(self): + buildPath = tdCom.getBuildPath() + cfgPath = tdCom.getClientCfgPath() + cmdStr = '%s/build/bin/tmq_taosx_ci -c %s'%(buildPath, cfgPath) + tdLog.info(cmdStr) + os.system(cmdStr) + + srcFile = '%s/../log/tmq_taosx_tmp.source'%(cfgPath) + dstFile = '%s/../log/tmq_taosx_tmp.result'%(cfgPath) + tdLog.info("compare file: %s, %s"%(srcFile, dstFile)) + + consumeFile = open(srcFile, mode='r') + queryFile = open(dstFile, mode='r') + + while True: + dst = queryFile.readline() + src = consumeFile.readline() + + if dst: + if dst != src: + tdLog.exit("compare error: %s != %s"%src, dst) + else: + break + + tdSql.execute('use db_taosx') + tdSql.query("select * from ct3") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 51) + tdSql.checkData(0, 4, 940) + tdSql.checkData(1, 1, 23) + tdSql.checkData(1, 4, None) + + tdSql.query("select * from ct1") + tdSql.checkRows(4) + + tdSql.query("select * from ct2") + tdSql.checkRows(0) + + tdSql.query("select * from ct0") + tdSql.checkRows(2) + tdSql.checkData(0, 3, "a") + tdSql.checkData(1, 4, None) + + tdSql.query("select * from n1") + tdSql.checkRows(2) + tdSql.checkData(0, 1, "eeee") + tdSql.checkData(1, 2, 940) + + tdSql.query("select * from jt") + tdSql.checkRows(2) + tdSql.checkData(0, 1, 11) + tdSql.checkData(0, 2, None) + tdSql.checkData(1, 1, 1) + tdSql.checkData(1, 2, '{"k1":1,"k2":"hello"}') + + return + + def run(self): + tdSql.prepare() + self.checkFileContent() + + def stop(self): + tdSql.close() + tdLog.success(f"{__file__} successfully executed") + +event = threading.Event() + +tdCases.addLinux(__file__, TDTestCase()) +tdCases.addWindows(__file__, TDTestCase()) diff --git a/tests/system-test/fulltest.sh b/tests/system-test/fulltest.sh index cb2a75754d..0f72eaa172 100755 --- a/tests/system-test/fulltest.sh +++ b/tests/system-test/fulltest.sh @@ -27,7 +27,7 @@ python3 ./test.py -f 1-insert/alter_stable.py python3 ./test.py -f 1-insert/alter_table.py python3 ./test.py -f 1-insert/insertWithMoreVgroup.py python3 ./test.py -f 1-insert/table_comment.py -#python3 ./test.py -f 1-insert/time_range_wise.py +python3 ./test.py -f 1-insert/time_range_wise.py python3 ./test.py -f 1-insert/block_wise.py python3 ./test.py -f 1-insert/create_retentions.py python3 ./test.py -f 1-insert/table_param_ttl.py @@ -59,17 +59,44 @@ python3 ./test.py -f 2-query/ceil.py python3 ./test.py -f 2-query/ceil.py -R python3 ./test.py -f 2-query/char_length.py python3 ./test.py -f 2-query/char_length.py -R -python3 ./test.py -f 2-query/check_tsdb.py -python3 ./test.py -f 2-query/check_tsdb.py -R +# python3 ./test.py -f 2-query/check_tsdb.py +# python3 ./test.py -f 2-query/check_tsdb.py -R +python3 ./test.py -f 2-query/concat.py +python3 ./test.py -f 2-query/concat.py -R +python3 ./test.py -f 2-query/concat_ws.py +python3 ./test.py -f 2-query/concat_ws.py -R +python3 ./test.py -f 2-query/concat_ws2.py +python3 ./test.py -f 2-query/concat_ws2.py -R +python3 ./test.py -f 2-query/cos.py +python3 ./test.py -f 2-query/cos.py -R +python3 ./test.py -f 2-query/count_partition.py +python3 ./test.py -f 2-query/count_partition.py -R +python3 ./test.py -f 2-query/count.py +python3 ./test.py -f 2-query/count.py -R +python3 ./test.py -f 2-query/db.py +python3 ./test.py -f 2-query/db.py -R +python3 ./test.py -f 2-query/diff.py +python3 ./test.py -f 2-query/diff.py -R +python3 ./test.py -f 2-query/distinct.py +python3 ./test.py -f 2-query/distinct.py -R +python3 ./test.py -f 2-query/distribute_agg_apercentile.py +python3 ./test.py -f 2-query/distribute_agg_apercentile.py -R +python3 ./test.py -f 2-query/distribute_agg_avg.py +python3 ./test.py -f 2-query/distribute_agg_avg.py -R +python3 ./test.py -f 2-query/distribute_agg_count.py +python3 ./test.py -f 2-query/distribute_agg_count.py -R +python3 ./test.py -f 2-query/distribute_agg_max.py +python3 ./test.py -f 2-query/distribute_agg_max.py -R +python3 ./test.py -f 2-query/distribute_agg_min.py +python3 ./test.py -f 2-query/distribute_agg_min.py -R + + + python3 ./test.py -f 1-insert/update_data.py python3 ./test.py -f 1-insert/delete_data.py -python3 ./test.py -f 2-query/db.py - -python3 ./test.py -f 2-query/db.py -python3 ./test.py -f 2-query/distinct.py python3 ./test.py -f 2-query/varchar.py python3 ./test.py -f 2-query/ltrim.py python3 ./test.py -f 2-query/rtrim.py @@ -81,10 +108,7 @@ python3 ./test.py -f 2-query/join2.py python3 ./test.py -f 2-query/substr.py python3 ./test.py -f 2-query/union.py python3 ./test.py -f 2-query/union1.py -python3 ./test.py -f 2-query/concat.py python3 ./test.py -f 2-query/concat2.py -python3 ./test.py -f 2-query/concat_ws.py -python3 ./test.py -f 2-query/concat_ws2.py python3 ./test.py -f 2-query/spread.py python3 ./test.py -f 2-query/hyperloglog.py python3 ./test.py -f 2-query/explain.py @@ -97,13 +121,11 @@ python3 ./test.py -f 2-query/Now.py python3 ./test.py -f 2-query/Today.py python3 ./test.py -f 2-query/max.py python3 ./test.py -f 2-query/min.py -python3 ./test.py -f 2-query/count.py python3 ./test.py -f 2-query/last.py python3 ./test.py -f 2-query/first.py python3 ./test.py -f 2-query/To_iso8601.py python3 ./test.py -f 2-query/To_unixtimestamp.py python3 ./test.py -f 2-query/timetruncate.py -python3 ./test.py -f 2-query/diff.py python3 ./test.py -f 2-query/Timediff.py python3 ./test.py -f 2-query/json_tag.py @@ -115,7 +137,6 @@ python3 ./test.py -f 2-query/log.py python3 ./test.py -f 2-query/pow.py python3 ./test.py -f 2-query/sqrt.py python3 ./test.py -f 2-query/sin.py -python3 ./test.py -f 2-query/cos.py python3 ./test.py -f 2-query/tan.py python3 ./test.py -f 2-query/query_cols_tags_and_or.py # python3 ./test.py -f 2-query/nestedQuery.py @@ -126,7 +147,6 @@ python3 ./test.py -f 2-query/query_cols_tags_and_or.py python3 ./test.py -f 2-query/elapsed.py python3 ./test.py -f 2-query/csum.py python3 ./test.py -f 2-query/mavg.py -python3 ./test.py -f 2-query/diff.py python3 ./test.py -f 2-query/sample.py python3 ./test.py -f 2-query/function_diff.py python3 ./test.py -f 2-query/unique.py @@ -135,17 +155,11 @@ python3 ./test.py -f 2-query/function_stateduration.py python3 ./test.py -f 2-query/statecount.py python3 ./test.py -f 2-query/tail.py python3 ./test.py -f 2-query/ttl_comment.py -python3 ./test.py -f 2-query/distribute_agg_count.py -python3 ./test.py -f 2-query/distribute_agg_max.py -python3 ./test.py -f 2-query/distribute_agg_min.py python3 ./test.py -f 2-query/distribute_agg_sum.py python3 ./test.py -f 2-query/distribute_agg_spread.py -python3 ./test.py -f 2-query/distribute_agg_apercentile.py -python3 ./test.py -f 2-query/distribute_agg_avg.py python3 ./test.py -f 2-query/distribute_agg_stddev.py python3 ./test.py -f 2-query/twa.py python3 ./test.py -f 2-query/irate.py -python3 ./test.py -f 2-query/count_partition.py python3 ./test.py -f 2-query/function_null.py python3 ./test.py -f 2-query/queryQnode.py python3 ./test.py -f 2-query/max_partition.py @@ -168,12 +182,12 @@ python3 ./test.py -f 6-cluster/5dnode3mnodeRestartDnodeInsertData.py -N 5 -M 3 # python3 ./test.py -f 6-cluster/5dnode3mnodeRestartMnodeInsertData.py -N 5 -M 3 # python3 ./test.py -f 6-cluster/5dnode3mnodeRestartVnodeInsertData.py -N 5 -M 3 -python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 6 -M 3 -C 5 +python3 ./test.py -f 6-cluster/5dnode3mnodeAdd1Ddnoe.py -N 6 -M 3 -C 5 # BUG python3 ./test.py -f 6-cluster/5dnode3mnodeStopInsert.py # python3 ./test.py -f 6-cluster/5dnode3mnodeDrop.py -N 5 # python3 test.py -f 6-cluster/5dnode3mnodeStopConnect.py -N 5 -M 3 -python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3 +python3 ./test.py -f 7-tmq/dropDbR3ConflictTransaction.py -N 3 python3 ./test.py -f 7-tmq/basic5.py python3 ./test.py -f 7-tmq/subscribeDb.py python3 ./test.py -f 7-tmq/subscribeDb0.py @@ -209,8 +223,8 @@ python3 ./test.py -f 7-tmq/tmqConsFromTsdb-mutilVg-mutilCtb.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-1ctb-funcNFilter.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb-funcNFilter.py python3 ./test.py -f 7-tmq/tmqConsFromTsdb1-mutilVg-mutilCtb.py -python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py -python3 ./test.py -f 7-tmq/tmqDnodeRestart.py +#python3 ./test.py -f 7-tmq/tmqAutoCreateTbl.py +#python3 ./test.py -f 7-tmq/tmqDnodeRestart.py python3 ./test.py -f 7-tmq/tmqUpdate-1ctb.py python3 ./test.py -f 7-tmq/tmqUpdateWithConsume.py python3 ./test.py -f 7-tmq/tmqUpdate-multiCtb-snapshot0.py @@ -227,6 +241,7 @@ python3 ./test.py -f 7-tmq/tmqUdf-multCtb-snapshot1.py python3 ./test.py -f 7-tmq/stbTagFilter-1ctb.py python3 ./test.py -f 7-tmq/dataFromTsdbNWal.py python3 ./test.py -f 7-tmq/dataFromTsdbNWal-multiCtb.py +python3 ./test.py -f 7-tmq/tmq_taosx.py # python3 ./test.py -f 7-tmq/stbTagFilter-multiCtb.py #------------querPolicy 2----------- @@ -250,7 +265,7 @@ python3 ./test.py -f 2-query/concat.py -Q 2 python3 ./test.py -f 2-query/concat2.py -Q 2 python3 ./test.py -f 2-query/concat_ws.py -Q 2 python3 ./test.py -f 2-query/concat_ws2.py -Q 2 -python3 ./test.py -f 2-query/check_tsdb.py -Q 2 +#python3 ./test.py -f 2-query/check_tsdb.py -Q 2 python3 ./test.py -f 2-query/spread.py -Q 2 python3 ./test.py -f 2-query/hyperloglog.py -Q 2 python3 ./test.py -f 2-query/explain.py -Q 2 @@ -295,7 +310,6 @@ python3 ./test.py -f 2-query/avg.py -Q 2 # python3 ./test.py -f 2-query/elapsed.py -Q 2 python3 ./test.py -f 2-query/csum.py -Q 2 python3 ./test.py -f 2-query/mavg.py -Q 2 -python3 ./test.py -f 2-query/diff.py -Q 2 python3 ./test.py -f 2-query/sample.py -Q 2 python3 ./test.py -f 2-query/function_diff.py -Q 2 python3 ./test.py -f 2-query/unique.py -Q 2 @@ -340,7 +354,7 @@ python3 ./test.py -f 2-query/concat.py -Q 3 python3 ./test.py -f 2-query/concat2.py -Q 3 python3 ./test.py -f 2-query/concat_ws.py -Q 3 python3 ./test.py -f 2-query/concat_ws2.py -Q 3 -python3 ./test.py -f 2-query/check_tsdb.py -Q 3 +#python3 ./test.py -f 2-query/check_tsdb.py -Q 3 python3 ./test.py -f 2-query/spread.py -Q 3 python3 ./test.py -f 2-query/hyperloglog.py -Q 3 python3 ./test.py -f 2-query/explain.py -Q 3 @@ -383,7 +397,6 @@ python3 ./test.py -f 2-query/query_cols_tags_and_or.py -Q 3 # python3 ./test.py -f 2-query/elapsed.py -Q 3 python3 ./test.py -f 2-query/csum.py -Q 3 python3 ./test.py -f 2-query/mavg.py -Q 3 -python3 ./test.py -f 2-query/diff.py -Q 3 python3 ./test.py -f 2-query/sample.py -Q 3 python3 ./test.py -f 2-query/function_diff.py -Q 3 python3 ./test.py -f 2-query/unique.py -Q 3 diff --git a/tests/test/c/CMakeLists.txt b/tests/test/c/CMakeLists.txt index 5db97a0f0f..605eef9be3 100644 --- a/tests/test/c/CMakeLists.txt +++ b/tests/test/c/CMakeLists.txt @@ -1,6 +1,7 @@ add_executable(tmq_demo tmqDemo.c) add_executable(tmq_sim tmqSim.c) add_executable(create_table createTable.c) +add_executable(tmq_taosx_ci tmq_taosx_ci.c) target_link_libraries( create_table PUBLIC taos_static @@ -22,6 +23,13 @@ target_link_libraries( PUBLIC common PUBLIC os ) +target_link_libraries( + tmq_taosx_ci + PUBLIC taos_static + PUBLIC util + PUBLIC common + PUBLIC os +) add_executable(sdbDump sdbDump.c) target_link_libraries( diff --git a/tests/test/c/tmqSim.c b/tests/test/c/tmqSim.c index 6a18263d50..d39ade7e91 100644 --- a/tests/test/c/tmqSim.c +++ b/tests/test/c/tmqSim.c @@ -630,7 +630,7 @@ static int32_t meta_msg_process(TAOS_RES* msg, SThreadInfo* pInfo, int32_t msgIn { tmq_raw_data raw = {0}; - int32_t code = tmq_get_raw_meta(msg, &raw); + int32_t code = tmq_get_raw(msg, &raw); if(code == TSDB_CODE_SUCCESS){ int retCode = queryDB(pInfo->taos, "use metadb"); @@ -641,7 +641,7 @@ static int32_t meta_msg_process(TAOS_RES* msg, SThreadInfo* pInfo, int32_t msgIn } taosFprintfFile(g_fp, "raw:%p\n", &raw); - taos_write_raw_meta(pInfo->taos, raw); + tmq_write_raw(pInfo->taos, raw); } char* result = tmq_get_json_meta(msg); diff --git a/tests/test/c/tmq_taosx_ci.c b/tests/test/c/tmq_taosx_ci.c new file mode 100644 index 0000000000..ece7ad4819 --- /dev/null +++ b/tests/test/c/tmq_taosx_ci.c @@ -0,0 +1,520 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#include +#include +#include +#include +#include +#include "taos.h" +#include "types.h" + +static int running = 1; +TdFilePtr g_fp = NULL; +char dir[64]={0}; + +static TAOS* use_db(){ + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + if (pConn == NULL) { + return NULL; + } + + TAOS_RES* pRes = taos_query(pConn, "use db_taosx"); + if (taos_errno(pRes) != 0) { + printf("error in use db_taosx, reason:%s\n", taos_errstr(pRes)); + return NULL; + } + taos_free_result(pRes); + return pConn; +} + +static void msg_process(TAOS_RES* msg) { + /*memset(buf, 0, 1024);*/ + printf("-----------topic-------------: %s\n", tmq_get_topic_name(msg)); + printf("db: %s\n", tmq_get_db_name(msg)); + printf("vg: %d\n", tmq_get_vgroup_id(msg)); + TAOS *pConn = use_db(); + if (tmq_get_res_type(msg) == TMQ_RES_TABLE_META) { + char* result = tmq_get_json_meta(msg); + if (result) { + printf("meta result: %s\n", result); + } + taosFprintfFile(g_fp, result); + taosFprintfFile(g_fp, "\n"); + tmq_free_json_meta(result); + } + + tmq_raw_data raw = {0}; + tmq_get_raw(msg, &raw); + int32_t ret = tmq_write_raw(pConn, raw); + printf("write raw data: %s\n", tmq_err2str(ret)); + +// else{ +// while(1){ +// int numOfRows = 0; +// void *pData = NULL; +// taos_fetch_raw_block(msg, &numOfRows, &pData); +// if(numOfRows == 0) break; +// printf("write data: tbname:%s, numOfRows:%d\n", tmq_get_table_name(msg), numOfRows); +// int ret = taos_write_raw_block(pConn, numOfRows, pData, tmq_get_table_name(msg)); +// printf("write raw data: %s\n", tmq_err2str(ret)); +// } +// } + + taos_close(pConn); +} + +int32_t init_env() { + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + if (pConn == NULL) { + return -1; + } + + TAOS_RES* pRes = taos_query(pConn, "drop database if exists db_taosx"); + if (taos_errno(pRes) != 0) { + printf("error in drop db_taosx, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create database if not exists db_taosx vgroups 1"); + if (taos_errno(pRes) != 0) { + printf("error in create db_taosx, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "drop database if exists abc1"); + if (taos_errno(pRes) != 0) { + printf("error in drop db, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create database if not exists abc1 vgroups 1"); + if (taos_errno(pRes) != 0) { + printf("error in create db, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "use abc1"); + if (taos_errno(pRes) != 0) { + printf("error in use db, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, + "create stable if not exists st1 (ts timestamp, c1 int, c2 float, c3 binary(16)) tags(t1 int, t3 " + "nchar(8), t4 bool)"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table if not exists ct0 using st1 tags(1000, \"ttt\", true)"); + if (taos_errno(pRes) != 0) { + printf("failed to create child table tu1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into ct0 values(1626006833600, 1, 2, 'a')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct0, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table if not exists ct1 using st1(t1) tags(2000)"); + if (taos_errno(pRes) != 0) { + printf("failed to create child table ct1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table if not exists ct2 using st1(t1) tags(NULL)"); + if (taos_errno(pRes) != 0) { + printf("failed to create child table ct2, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into ct1 values(1626006833600, 3, 4, 'b')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table if not exists ct3 using st1(t1) tags(3000)"); + if (taos_errno(pRes) != 0) { + printf("failed to create child table ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into ct3 values(1626006833600, 5, 6, 'c') ct1 values(1626006833601, 2, 3, 'sds') (1626006833602, 4, 5, 'ddd') ct0 values(1626006833602, 4, 3, 'hwj') ct1 values(now+5s, 23, 32, 's21ds')"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "alter table st1 add column c4 bigint"); + if (taos_errno(pRes) != 0) { + printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "alter table st1 modify column c3 binary(64)"); + if (taos_errno(pRes) != 0) { + printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into ct3 values(1626006833605, 53, 63, 'cffffffffffffffffffffffffffff', 8989898899999) (1626006833609, 51, 62, 'c333', 940)"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into ct3 select * from ct1"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "alter table st1 add tag t2 binary(64)"); + if (taos_errno(pRes) != 0) { + printf("failed to alter super table st1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "alter table ct3 set tag t1=5000"); + if (taos_errno(pRes) != 0) { + printf("failed to slter child table ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "delete from abc1 .ct3 where ts < 1626006833606"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into ct3, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table if not exists n1(ts timestamp, c1 int, c2 nchar(4))"); + if (taos_errno(pRes) != 0) { + printf("failed to create normal table n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "alter table n1 add column c3 bigint"); + if (taos_errno(pRes) != 0) { + printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "alter table n1 modify column c2 nchar(8)"); + if (taos_errno(pRes) != 0) { + printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "alter table n1 rename column c3 cc3"); + if (taos_errno(pRes) != 0) { + printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "alter table n1 comment 'hello'"); + if (taos_errno(pRes) != 0) { + printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "alter table n1 drop column c1"); + if (taos_errno(pRes) != 0) { + printf("failed to alter normal table n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into n1 values(now, 'eeee', 8989898899999) (now+9s, 'c333', 940)"); + if (taos_errno(pRes) != 0) { + printf("failed to insert into n1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table jt(ts timestamp, i int) tags(t json)"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table jt, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table jt1 using jt tags('{\"k1\":1, \"k2\":\"hello\"}')"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table jt, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create table jt2 using jt tags('')"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table jt2, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into jt1 values(now, 1)"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table jt1, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "insert into jt2 values(now, 11)"); + if (taos_errno(pRes) != 0) { + printf("failed to create super table jt2, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + taos_close(pConn); + return 0; +} + +int32_t create_topic() { + printf("create topic\n"); + TAOS_RES* pRes; + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + if (pConn == NULL) { + return -1; + } + + pRes = taos_query(pConn, "use abc1"); + if (taos_errno(pRes) != 0) { + printf("error in use db, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + pRes = taos_query(pConn, "create topic topic_ctb_column with meta as database abc1"); + if (taos_errno(pRes) != 0) { + printf("failed to create topic topic_ctb_column, reason:%s\n", taos_errstr(pRes)); + return -1; + } + taos_free_result(pRes); + + taos_close(pConn); + return 0; +} + +void tmq_commit_cb_print(tmq_t* tmq, int32_t code, void* param) { + printf("commit %d tmq %p param %p\n", code, tmq, param); +} + +tmq_t* build_consumer() { +#if 0 + TAOS* pConn = taos_connect("localhost", "root", "taosdata", NULL, 0); + assert(pConn != NULL); + + TAOS_RES* pRes = taos_query(pConn, "use abc1"); + if (taos_errno(pRes) != 0) { + printf("error in use db, reason:%s\n", taos_errstr(pRes)); + } + taos_free_result(pRes); +#endif + + tmq_conf_t* conf = tmq_conf_new(); + tmq_conf_set(conf, "group.id", "tg2"); + tmq_conf_set(conf, "client.id", "my app 1"); + tmq_conf_set(conf, "td.connect.user", "root"); + tmq_conf_set(conf, "td.connect.pass", "taosdata"); + tmq_conf_set(conf, "msg.with.table.name", "true"); + tmq_conf_set(conf, "enable.auto.commit", "true"); + tmq_conf_set(conf, "enable.heartbeat.background", "true"); + + /*tmq_conf_set(conf, "experimental.snapshot.enable", "true");*/ + + tmq_conf_set_auto_commit_cb(conf, tmq_commit_cb_print, NULL); + tmq_t* tmq = tmq_consumer_new(conf, NULL, 0); + assert(tmq); + tmq_conf_destroy(conf); + return tmq; +} + +tmq_list_t* build_topic_list() { + tmq_list_t* topic_list = tmq_list_new(); + tmq_list_append(topic_list, "topic_ctb_column"); + /*tmq_list_append(topic_list, "tmq_test_db_multi_insert_topic");*/ + return topic_list; +} + +void basic_consume_loop(tmq_t* tmq, tmq_list_t* topics) { + int32_t code; + + if ((code = tmq_subscribe(tmq, topics))) { + fprintf(stderr, "%% Failed to start consuming topics: %s\n", tmq_err2str(code)); + printf("subscribe err\n"); + return; + } + int32_t cnt = 0; + while (running) { + TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 1000); + if (tmqmessage) { + cnt++; + msg_process(tmqmessage); + /*if (cnt >= 2) break;*/ + /*printf("get data\n");*/ + taos_free_result(tmqmessage); + /*} else {*/ + /*break;*/ + /*tmq_commit_sync(tmq, NULL);*/ + }else{ + break; + } + } + + code = tmq_consumer_close(tmq); + if (code) + fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(code)); + else + fprintf(stderr, "%% Consumer closed\n"); +} + +void sync_consume_loop(tmq_t* tmq, tmq_list_t* topics) { + static const int MIN_COMMIT_COUNT = 1; + + int msg_count = 0; + int32_t code; + + if ((code = tmq_subscribe(tmq, topics))) { + fprintf(stderr, "%% Failed to start consuming topics: %s\n", tmq_err2str(code)); + return; + } + + tmq_list_t* subList = NULL; + tmq_subscription(tmq, &subList); + char** subTopics = tmq_list_to_c_array(subList); + int32_t sz = tmq_list_get_size(subList); + printf("subscribed topics: "); + for (int32_t i = 0; i < sz; i++) { + printf("%s, ", subTopics[i]); + } + printf("\n"); + tmq_list_destroy(subList); + + while (running) { + TAOS_RES* tmqmessage = tmq_consumer_poll(tmq, 1000); + if (tmqmessage) { + msg_process(tmqmessage); + taos_free_result(tmqmessage); + + /*tmq_commit_sync(tmq, NULL);*/ + /*if ((++msg_count % MIN_COMMIT_COUNT) == 0) tmq_commit(tmq, NULL, 0);*/ + } + } + + code = tmq_consumer_close(tmq); + if (code) + fprintf(stderr, "%% Failed to close consumer: %s\n", tmq_err2str(code)); + else + fprintf(stderr, "%% Consumer closed\n"); +} + +void initLogFile() { + char f1[256] = {0}; + char f2[256] = {0}; + + sprintf(f1, "%s/../log/tmq_taosx_tmp.source", dir); + sprintf(f2, "%s/../log/tmq_taosx_tmp.result", dir); + TdFilePtr pFile = taosOpenFile(f1, TD_FILE_TEXT | TD_FILE_TRUNC | TD_FILE_STREAM); + if (NULL == pFile) { + fprintf(stderr, "Failed to open %s for save result\n", f1); + exit(-1); + } + g_fp = pFile; + + TdFilePtr pFile2 = taosOpenFile(f2, TD_FILE_TEXT | TD_FILE_TRUNC | TD_FILE_STREAM); + if (NULL == pFile2) { + fprintf(stderr, "Failed to open %s for save result\n", f2); + exit(-1); + } + char *result[] = { + "{\"type\":\"create\",\"tableName\":\"st1\",\"tableType\":\"super\",\"columns\":[{\"name\":\"ts\",\"type\":9},{\"name\":\"c1\",\"type\":4},{\"name\":\"c2\",\"type\":6},{\"name\":\"c3\",\"type\":8,\"length\":16}],\"tags\":[{\"name\":\"t1\",\"type\":4},{\"name\":\"t3\",\"type\":10,\"length\":8},{\"name\":\"t4\",\"type\":1}]}", + "{\"type\":\"create\",\"tableName\":\"ct0\",\"tableType\":\"child\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":1000},{\"name\":\"t3\",\"type\":10,\"value\":\"\\\"ttt\\\"\"},{\"name\":\"t4\",\"type\":1,\"value\":1}]}", + "{\"type\":\"create\",\"tableName\":\"ct1\",\"tableType\":\"child\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":2000}]}", + "{\"type\":\"create\",\"tableName\":\"ct2\",\"tableType\":\"child\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[]}", + "{\"type\":\"create\",\"tableName\":\"ct3\",\"tableType\":\"child\",\"using\":\"st1\",\"tagNum\":3,\"tags\":[{\"name\":\"t1\",\"type\":4,\"value\":3000}]}", + "{\"type\":\"alter\",\"tableName\":\"st1\",\"tableType\":\"super\",\"alterType\":5,\"colName\":\"c4\",\"colType\":5}", + "{\"type\":\"alter\",\"tableName\":\"st1\",\"tableType\":\"super\",\"alterType\":7,\"colName\":\"c3\",\"colType\":8,\"colLength\":64}", + "{\"type\":\"alter\",\"tableName\":\"st1\",\"tableType\":\"super\",\"alterType\":1,\"colName\":\"t2\",\"colType\":8,\"colLength\":64}", + "{\"type\":\"alter\",\"tableName\":\"ct3\",\"tableType\":\"child\",\"alterType\":4,\"colName\":\"t1\",\"colValue\":\"5000\",\"colValueNull\":false}", + "{\"type\":\"create\",\"tableName\":\"n1\",\"tableType\":\"normal\",\"columns\":[{\"name\":\"ts\",\"type\":9},{\"name\":\"c1\",\"type\":4},{\"name\":\"c2\",\"type\":10,\"length\":4}],\"tags\":[]}", + "{\"type\":\"alter\",\"tableName\":\"n1\",\"tableType\":\"normal\",\"alterType\":5,\"colName\":\"c3\",\"colType\":5}", + "{\"type\":\"alter\",\"tableName\":\"n1\",\"tableType\":\"normal\",\"alterType\":7,\"colName\":\"c2\",\"colType\":10,\"colLength\":8}", + "{\"type\":\"alter\",\"tableName\":\"n1\",\"tableType\":\"normal\",\"alterType\":10,\"colName\":\"c3\",\"colNewName\":\"cc3\"}", + "{\"type\":\"alter\",\"tableName\":\"n1\",\"tableType\":\"normal\",\"alterType\":9}", + "{\"type\":\"alter\",\"tableName\":\"n1\",\"tableType\":\"normal\",\"alterType\":6,\"colName\":\"c1\"}", + "{\"type\":\"create\",\"tableName\":\"jt\",\"tableType\":\"super\",\"columns\":[{\"name\":\"ts\",\"type\":9},{\"name\":\"i\",\"type\":4}],\"tags\":[{\"name\":\"t\",\"type\":15}]}", + "{\"type\":\"create\",\"tableName\":\"jt1\",\"tableType\":\"child\",\"using\":\"jt\",\"tagNum\":1,\"tags\":[{\"name\":\"t\",\"type\":15,\"value\":\"{\\\"k1\\\":1,\\\"k2\\\":\\\"hello\\\"}\"}]}", + "{\"type\":\"create\",\"tableName\":\"jt2\",\"tableType\":\"child\",\"using\":\"jt\",\"tagNum\":1,\"tags\":[]}" + }; + + for(int i = 0; i < sizeof(result)/sizeof(result[0]); i++){ + taosFprintfFile(pFile2, result[i]); + taosFprintfFile(pFile2, "\n"); + } + taosCloseFile(&pFile2); +} + +int main(int argc, char* argv[]) { + if(argc == 3 && strcmp(argv[1], "-c") == 0) { + strcpy(dir, argv[2]); + }else{ + strcpy(dir, "../../../sim/psim/cfg"); + } + + printf("env init\n"); + initLogFile(); + + if (init_env() < 0) { + return -1; + } + create_topic(); + + tmq_t* tmq = build_consumer(); + tmq_list_t* topic_list = build_topic_list(); + basic_consume_loop(tmq, topic_list); + /*sync_consume_loop(tmq, topic_list);*/ + taosCloseFile(&g_fp); +}